Dubbsta
Active member
- Joined
- Jul 13, 2017
- Messages
- 208
i found what seems like a great tutorial on tile based games and collisions. and of course right at the start it all hits rock bottom. i followed it exact and seems simple but not working as expected. can anyone tell me why this is not working. i cant spot it
Code:
Class Map
Field x:float = 0
Field y:float = 0
Field size:Int = 40
Field cols:Int = 16
Field rows:Int = 9
Field tiles:Int[] = [1,0,1,0,1,0,1,0,1,0,1,0,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,1,0,1,0,1,0,1,0,1,0,1]
Method Draw:Int()
For Local i:Int = 0 Until tiles.Length()
DrawRect((i Mod cols) * size,Floor(i/cols)*size,size,size)
Select tiles[i]
Case 0
SetColor 0,255,0
Case 1
SetColor 0,0,255
End
next
Return 0
End
End