Hi! Thanks for the reply. I have created some very messy code to show you what I want doing.
You can download here: http://www.kamikazekrow.com/storage/bombtest.zip
Basically it draws bombs to screen. When the mouse is clicked and it is over a bomb it activates the anim.
Notice that when a second or third bomb is activated the animation starts from the same position as the last one. ie it doesn't start from the begining for the newly activated bomb.
heres the code
I know the codes a mess.
You can download here: http://www.kamikazekrow.com/storage/bombtest.zip
Basically it draws bombs to screen. When the mouse is clicked and it is over a bomb it activates the anim.
Notice that when a second or third bomb is activated the animation starts from the same position as the last one. ie it doesn't start from the begining for the newly activated bomb.
heres the code
SuperStrict Graphics 800, 600 Global bomb:TImage = LoadAnimImage("bomb.png", 32, 32, 0, 14) Global MapWidth:Int = 25 Global MapHeight:Int = 600 / 32 Global MapArray:TTile[MapWidth, MapHeight] Type TTile Field x:Int Field y:Int Field image:TImage Field Frame:Int Field BombFRame:Int Field BombFrameTimer:Int Global List:TList Function Create:TTile() Return New TTile End Function Function PrefillMapArray() For Local y:Int = 0 Until MapHeight For Local x:Int = 0 Until MapWidth MapArray[x, y]= TTile.Create() MapArray[x, y].Frame = 0 If MapArray[x, y].Frame = 0 TTile.CreateBomb End If Next Next End Function Function Draw() For Local x:Int = 0 Until MapWidth For Local y:Int = 0 Until MapHeight Select MapArray[x, y].Frame Case 0 DrawImage bomb, X * 32, Y * 32, 0 Case 1 ' This bit below. I want the bombs to animate seperetaly when the character is on it. ' Useing the mouse position to activate the anim would be fine for this example. For Local b:TTile = EachIn TTile.List DrawImage bomb, x * 32, y * 32, b.BombFRame b.UpdateBomb Next End Select Next Next End Function Function CreateBomb() If not TTile.List TTile.List = CreateList() End If Local b:TTile = New TTile b.BombFRame = 0 b.BombFrameTimer = MilliSecs() TTile.List.AddLast(b) End Function Method UpdateBomb() If MilliSecs() > BombFRameTimer + 200 BombFrame:+1 If BombFrame > 13 Then BombFrame = 0 BombFrameTimer = MilliSecs() End If End Method Function ActivateBomb() If MapArray[MouseX() / 32, MouseY() / 32].Frame = 0 If MouseHit(MOUSE_LEFT) MapArray[MouseX() / 32, MouseY() / 32].Frame = 1 End If End If End Function End Type TTile.PrefillMapArray While not KeyHit(KEY_ESCAPE) Cls TTile.Draw TTile.ActivateBomb Flip WEnd
I know the codes a mess.