Jump to content
  • Advertisement


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


2D tile based animation and collision detection?

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

I have a map of 50 * 50 tiles and the map data is stored as an array. Right now the way the character moves is tile by tile so he jumps to the next tile immediately (easy solution just add 50 when key is pressed) but I want to make it seem more natural. How would I do this? What happens if he moves by 5 instead of 50 everytime what happens when he''s in between two tiles? How will I determine which tile he''s on for collision detection? thanks.

Share this post

Link to post
Share on other sites
You could make the character "be in" both tiles while he is moving between them, but force the player to complete the move to the new tile, like a Zelda game or so. Then once the player is completely out of the old tile, it is only in a single tile.

Share this post

Link to post
Share on other sites
The way i do it in my tile engine is the map is displayed and tiles are set as "blocked" or "unblocked". For a game object to find out what tile it will be on in such a direction at such a distance, it just sends the coordinates to the engine and the engine returns the tile row/column. The object then locks the tile (to gain access to its properties) and then queries for a block. If so, then the game object knows it can''t move any further in that direction. This makes the map independent from the game objects and vice-versa. So now we can have planes fly around the map not caring about blocked tiles (except maybe buildings) and the map not haveing to care about what type of game objects it should and should not allow to pass through blocked tiles.


Drew Sikora
A.K.A. Gaiiden

ICQ #: 70449988
AOLIM: DarkPylat

Blade Edge Software
Staff Member, GDNet
Public Relations, Game Institute

3-time Contributing author, Game Design Methods , Charles River Media
Online column - Design Corner at Pixelate

Unnoficial IGDA chat! [polaris.starchat.net -> #igda]
NJ IGDA Chapter - NJ developers unite!! [Chapter Home | Chapter Forum]

"Real programmers don''t work from 9 to 5. If any real programmers are around at 9am it''s because they were up all night."

"It''s not the size of the source that matters, it''s how you use it"
- Self

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!