Jump to content
  • Advertisement


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


Collision Detection Question

This topic is 5733 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
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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!