• Advertisement

Archived

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 5064 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
Advertisement
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