[resolved] collision detection (2d array, sprite)
I'm writing a game but I can't get the collision detection to work quite right...
I have a map of tiles, each tile is 20x20 pixels and I have the map stored in a 2d array iMap[20][20] so my whole map is 400x400 pixels on the screen.
If I move my sprite 20 pixels at a time the collision detection works because then I can just go: sprite.x/20 to find out where in the array the player is and then chek to see if the next spot in the array is walkable or not.
The problem is that I want to move my sprite 5 pixels at a time so the method mentioned above won't work. I can partually move through walls and that is not the way I want it.
How can I get the collision detection to work even if I move 5 pixels at a time?