I'm Using ID's now. It seems to make a difference but not exactly what i want.
Basically I give each tile an ID. If the mouse positions is on a selected tile and its ID matches then its frame changes.
It kinda works.
Any more help would be appreciated. :)
SuperStrict Graphics 800,600 Global ThisImage:TImage = LoadAnimImage("12.png",32,32,0,2) Type T12Image Field x:Int Field y:Int Field frame:Int Field ID:Int Field image:TImage Global List:TList Global tempID:Int = 0 Global MAPWIDTH:Int = 22 Global MAPHEIGHT:Int = 18 Global TileMap:Int[ t12image.MAPWIDTH , t12image.MAPHEIGHT] Function create() If Not T12Image.List t12image.List = CreateList() End If For Local xiter:Int = 0 Until t12image.MAPWIDTH For Local yiter:Int = 0 Until t12image.MAPHEIGHT If t12image.TileMap[ xiter , yiter ] = 1 Local t:T12Image = New T12Image t.image = ThisImage t.x = xiter *32 t.y = yiter *32 t.frame = 0 t.id = T12Image.tempID T12image.List.AddLast(t) t12image.tempID:+1 End If Next Next End Function Method draw() For Local xiter:Int = 0 Until t12image.MAPWIDTH For Local yiter:Int = 0 Until t12image.MAPHEIGHT If t12image.TileMap[ xiter , yiter] = 1 DrawImage Image , x , y , frame EndIf Next Next End Method Method FrameChange() If ID = 2 If t12image.Tilemap[ MouseX()/32 , MouseY()/32] = 1 't12image.TileMap[MouseX()/32 , MouseY()/32].frame = 1 frame = 1 End If EndIf End Method Function DrawT() End Function End Type 'Global TileMap:Int[ t12image.MAPWIDTH , t12image.MAPHEIGHT ] Global mapdata:Int For Local yiter:Int = 0 Until t12image.MAPHEIGHT For Local xiter:Int = 0 Until t12image.MAPWIDTH ReadData mapdata T12Image.TileMap[ xiter, yiter] = mapdata Next Next t12image.create While Not KeyHit(KEY_ESCAPE) Cls For Local t:T12Image = EachIn T12Image.List t.draw t.FrameChange Next Flip Wend DefData 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DefData 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 DefData 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DefData 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 DefData 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DefData 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 DefData 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DefData 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 DefData 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DefData 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 DefData 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DefData 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 DefData 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DefData 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 DefData 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DefData 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 DefData 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DefData 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Basically I give each tile an ID. If the mouse positions is on a selected tile and its ID matches then its frame changes.
It kinda works.
Any more help would be appreciated. :)