Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

slickshoes113

Collision Detection Question

This topic is 5655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i''m trying to make a console version of pac man. i haven''t tried to put in ghosts or dots, all i''m trying to do right now is move around the maze. i can move around but i cant get any collision detection with the walls, i just move through them. the only way i can think of to make it work is to set each character of the maze as a coordinate using the COORD variable and check to see if the place i will move is one of the coordinates set as a wall before moving. the problem is i have about 200 - 300 characters i would have to individually set like that (at 3 lines of code apiece). is there a better way to do this?

Share this post


Link to post
Share on other sites
Advertisement
Put your maze in a text file, or a 2dimensional-array..
(If you choose the file, read it to an aray. The file just make it easier to do modifications to the level).

say 1 for walkable, 0 for wall.

Then keep your pacman x and y positions( relative to the array) in 2 variables or a struct and just check movement possiblities in the array.

My 2 cents anyway

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!