Jump to content
  • Advertisement
Sign in to follow this  
Badgerigar

Slopes in a Tile-based platformer

This topic is 3565 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, let's my guy is running on a flat surface and bumping into walls, that all works because collision is based on tiles. But now let's say I introduce tiles with 30/45/60 degree slopes on them. They take up less than a full tile so tile-based collision won't work. As for pixel-perfect collision, I've never seen an example of this kinda thing in python (which I'm coding in) so I have no idea how to use that. If anyone knows of anything like this, or can give me advice in general of how to use sloped tiles, it would be much appreciated. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
If your map is side-view, you can use the x pixel of the character's position to determine the height. IE..

height = tile_height + (character_x - tile_x) * slope_factor

A 45 degree slope would have a factor of 1.

Share this post


Link to post
Share on other sites
Just wanted to drop a quick note regarding the pixel perfect collision in python. Here is a link that you may be interested in:

Pygame PixelPerfect Collision Detection Example

I apologize if this is something you were already aware of, but perhaps you will find it useful. I have not thoroughly studied the code myself, so please respond if you find it useful.

Best of luck

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!