Updateing Framecount individually?

BlitzMax Forums/BlitzMax Beginners Area/Updateing Framecount individually?

How? Doen't it work?

I post you source (I deleted some thing unused)
When you click with the mouse on a bomb it starts to animate (from frame 1). If you click on another bomb it starts to animate from frame 1 too!


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
	
		

	Function PrefillMapArray() 
		For Local y:Int = 0 Until MapHeight
			For Local x:Int = 0 Until MapWidth
				MapArray[x, y]= TTile.CreateBomb() 
			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
						Local amap:ttile = MapArray[x , y]
						amap.UpdateBomb()
						DrawImage bomb, x * 32, y * 32, amap.BombFRame

				End Select
				
			Next
		Next
	End Function

	Function CreateBomb:ttile() 
		Local b:TTile = New TTile
		b.BombFRame = 0
		b.BombFrameTimer = MilliSecs() 
		Return 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