Jump to content
  • Advertisement


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


The Colision is trying to kill me! How do i do it?

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

Tried doing colision but i just can''t figure out how.. I have a map drawn out of an array called map[17][25]; if map[1][5] is OPEN then draw an empty sprite and etc. But how i do colision with them...?

Share this post

Link to post
Share on other sites
Assuming your game is looping through these steps:

- get input
- move player
- draw world

you want to stick the collision detection just before moving the player. Basically, if moving the player would put them into an invalid element in your map, ignore the input.

This gets more complicated when there are other things in your world besides the map, but the concept is the same; moving the player should involve tests for interaction with the world and objects in it.

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!