Archived

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

CHiEF

PACMAN tile collision (PLEASE HELP ME!!!)

Recommended Posts

Just wondering if anyone could help me with this pacman style game I was trying to work on... It''s driving me nuts! The basis of the game currently works fine - my tiles are 32x32 pixels, as is my pacman. The level is represented by 1''s and 0''s. At the minute, when the pacman is moved, I am shifting him by 32 pixels each time. The collision detection I''m using for this is simple - just detect the new coordinates when the direction key is pressed and if the new location is equal to a 1 then the pacman coordinates will be moved back by 32 to ensure he can''t move. The problem I now face is that I want it to be more ''smooth'', and have the pacman moving just 1 pixel at a time. I''ve tried and tried with this but I just can''t understand the collision detection I would need. My source code can be found at: http://members.fortunecity.com/n9951788/ If anyone can help it will save me from going bald at an early age! cheers. ..CHiEF/AsylumX..

Share this post


Link to post
Share on other sites
quote:
Original post by CHiEF

Just wondering if anyone could help me with this pacman style game I was trying to work on... It''s driving me nuts!

The basis of the game currently works fine - my tiles are 32x32 pixels, as is my pacman. The level is represented by 1''s and 0''s. At the minute, when the pacman is moved, I am shifting him by 32 pixels each time.

The collision detection I''m using for this is simple - just detect the new coordinates when the direction key is pressed and if the new location is equal to a 1 then the pacman coordinates will be moved back by 32 to ensure he can''t move.

The problem I now face is that I want it to be more ''smooth'', and have the pacman moving just 1 pixel at a time. I''ve tried and tried with this but I just can''t understand the collision detection I would need.

My source code can be found at:
http://members.fortunecity.com/n9951788/

If anyone can help it will save me from going bald at an early age!

cheers.

..CHiEF/AsylumX..


You could check out the Project-2: Threads in this forum:
Hands-On Interactive Game Development

The threads are alphabetized instead of my last post. Just start with the Overviews first.




BeS
It''s Da BOMB Baby!!!
. o O ~
A little nonsense now and then,
is relished by the wisest men
~ O o .
-- Willy Wonka

Share this post


Link to post
Share on other sites
Cheers dude, that was a great help! I''ve been searching for that kind of info everywhere! Thanks for pointing me in the right direction - my hair has been saved.

..CHiEF/AsylumX..

Share this post


Link to post
Share on other sites