View Single Post
Old 05-31-2013, 08:16 PM
passel's Avatar
passel passel is offline
Sinecure Expert

Super Moderator
* Guru *
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,031

How are you moving your object? Do you have restrictions on the directions you can move, i.e. if you're doing a maze, are you restricting movement to the four cardinal directions, up, down, left and right? Is your design of where you place your walls and objects to pick up going to be grid based, like pacman and many other games?
If so, then you usually wouldn't need to worry about collision detection. You would just use a "map", i.e. a two dimensional array of some sort that would define what is in each grid position, like a wall, or a object that is picked up, etc...
When you want to move in a given direction, you just check the array element in the direction you want to move to see if you can move there, and if so, move to the new location. If you can't move because the map indicates an obstacle, then you don't move.
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote