Jump to content
  • Advertisement
Sign in to follow this  
HyperDrachen

World Boundaries Questions.

This topic is 4255 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 appologize if this is a repost. Ive asked this question before on a forum and cant remember which one it was. I didnt get an answer : (. Im programming in C++/C# , using C# Visual Basic XNA as my compiler. My abilities are very limited. I am primarily interested in making 2D fighters, 2D Platformers, and eventually a 3D adventure game. I would like help with respect to 2D platformers. I want to make a game like Sonic the Hedgehog. I can already make the character, animate it move it, detect collisions with it. I'm confused however when it comes to the ground the character is to walk on. My current methods do not work if the ground is curved, and seem shotty anyway. Right now gravity pulls the character toward the bottom of the screen, as long as the characters state (which is a datamember of the struct Character) = 1(airborne). if it intersects the ground the "state" is set to 1(grounded). The characters position Y value is set to the top of the grounds bounding box and the characters Y velocity is set to 0. This really sucks I have no desire to modify this particular detection/response method. Id like to know how people really make a ground to walk on, especially a curved one. Application specific answer is not nescessary. A general concept of the method to make a surface and have things move along it would be much appreciated.

Share this post


Link to post
Share on other sites
Advertisement
For a curved ground surface (Hills, valleys, etc)... I think the only way to do it is through pixel perfect collision detection. Check out this article: http://www.gamedev.net/reference/articles/article735.asp

You could keep your collision detection the way it is for other objects and such, but for the ground I think you would have to do it this way. Check only the pixels on the bottom of your character's feet against the pixels on the ground underneath your character.

Hope that helps.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!