Jump to content
  • Advertisement

Archived

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

GroZZleR

Collision in a 2D Overhead Game (with a twist!)

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

Hey all, How do you do collision in a 2D overhead game (something like the old Secret of Mana / Chrono Trigger games), where your tile size differents from your player sprite size. Tiles are 32x32 and player sprites are slightly larger at 64x64. The problem is, I can''t do good tile collision because I can''t keep track of what tile the player is on (free movement around the screen). Anyone have any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Well you have tiles which are simply squares so you should be able to use 2d collisions for the big stuff (walls colliding with player). And you can calculate which squares the player would occupy which would allow you to do per pixel collsion if you need it. But more detail would be needed on what you are trying to do to give you a better idea of what you could do.

You should be able to keep track of which tiles the player is on (it could be on up to what.. maybe 6 tiles at once?) just take your tile 0,0 coordinate, translate that to your worldspace then find out how many tiles (and which ones) are 64 pixels away in either direction.

Share this post


Link to post
Share on other sites
I''m pretty sure to find a tile a given point is on, it''s simply position/tile_size, assuming both are integer values. You can do checks based on the four corners of the sprite, or a predefined rectangle representing their feet. If the movement rate and rectangles are small, you can just check the corners. There are some good tutorials on this site for tile based engines if you need more help.

Share this post


Link to post
Share on other sites
Thanks guys.

Can you point me at an article / tutorial on per pixel collision?

It seems like something I''d need but I haven''t heard of 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!