Jump to content
  • Advertisement

Archived

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

hello_there

collision detection please help!!!

This topic is 6062 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

ok i figured a way to do sprite to background collision but i want work properly. ok here''s how i did it i made a function to tell me where in the screen the player is. and each tile is either a 0 passable or 1 wall. but when i do it half the wall you can walk through and i don''t know way a can''t figure it out. any surgestion? is there anywhere i can put my code to show you? i realy need some help.

Share this post


Link to post
Share on other sites
Advertisement
Test each vertex of the player sprite (ie 4 if its a quad) against the tiles, or test just one but remember to take into account the width of the player.

ie if the player is 20 units wide, and you only test the top left vertice and are testing against a wall on the right of the player, test the vertice against an area 20 units left of the wall. If it fails there, then the right of the player is entering the wall.

-----------------------
0wn 0wn 0wn your goat
gently down the pw33n

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!