ResetMapAnims resets all the block animations sequences of a map back to their starting posiiotn.
FACTS:
* None
Mini Tutorial:
This example shows the hands on creation of a Map, the BLocks, Anims and Level.
; ============================== ; Part 1 - Create Map ; ============================== ; Set Width & Height variables of the Map tiles TileWidth=16 Tileheight=16 ; Get a free Map index MyMap=GetFreeMap() ; Create a map with provision for 5 levels CreateMap MyMap,5 ; ============================== ; Part 2 - Create Map Blocks ; ============================== ; Create some empty graphics blocks for MyMAP CreateMapGFX MyMap,TileWidth,TileHeight,10,RGB(0,0,0) For lp=1 To 10 ; draw a randomly coloured box BoxC 0,0,TileWidth-1,TileHeight-1,1,RndRGB() ; Copy the box image into MyMap GetMapBlk MyMap, lp, 0,0 Next ; ============================== ; Part 3 - Build Anims to Map ; ============================== ; Create Room for 50 Block Animations with this map MapAnimQuantity MyMap,50 ; Create ANim 15.. with space for 10 frames in the anim CreateMapAnim MyMap,15,10 ; Poke some random frames into the Anim 15 For lp=0 To 10 PokeMapAnim MyMap,15,lp,Rnd(10) Next ; ============================== ; Part 4 - Create Test Level ; ============================== ; Create level 1 CreateLevel MyMap,1,20,20 ; Enable Animation for this level LevelAnimated MyMap,1 ; Randomly Fill the level with Tiles For Ylp=0 To GetLevelWidth(myMap,1) For Xlp=0 To GetLevelWidth(myMap,1) PokeLevelTile MyMap,1,Xlp,Ylp,RndRange(1,10) Next Next ; Fill The Top/Bottom Edges of the level with our ANIM #15 For Ylp=0 To GetLevelHeight(myMap,1) PokeLevelTile MyMap,1,0,Ylp,15+$80000000 PokeLevelTile MyMap,1,GetLevelWidth(mymap,1),Ylp,15+$80000000 Next ; Fill The Top/Bottom Edges of the level with our ANIM #15 For xlp=0 To GetLevelWidth(myMap,1) PokeLevelTile MyMap,1,xlp,0,15+$80000000 PokeLevelTile MyMap,1,xlp,GetLevelHeight(mymap,1),15+$80000000 Next ; ============================== ; Part 5 - Main Loop ; ============================== ; Start of Do/Loop Do ; clear the screen to black Cls RGB(30,50,20) ; Draw Level #1 of MyMap to the screen at mouses position DrawMap MyMap,1,MouseX(),MouseY() ; Display a Message Print "Animated Map Example - Hold Space to Reset Blocks" If SpaceKey() ; Reset all the animations in this map to their ; starting positions ResetMapAnims MyMap Else ; Update the Map animations UpdateMapAnims MyMap EndIf ; Display the screen and loop back to the DO Sync Loop |
This example would output.
|