Jump to content
  • Advertisement
Sign in to follow this  
Zeepooh

How can I make the player colide with rocks but only in specific situations

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

Hello guys!

I'm making a 2D top down perspective game, where my goal is to reach a "mountain" which is 6 units high. In order to get to the top of the mountain I have to pick up rocks around the map that are 1 unit high and put them atop of each other to reach the mountain. I have can "jump" only 1 unit high so if there is a pillar of rocks that are 2 units or more higher of you you can't go to them (you collide). So I have to make some sort of stairs out of these rocks in order to get to the "mountain".

I have mastered the ways of AABB collision but I don't know how to do collide with the "pillars" that the player made and are 2 units or higher from the current position of the player. I'm making the game with OpenGL.

I would be grateful for any kind of help!

Regards

Share this post


Link to post
Share on other sites
Advertisement

As part of collision detection, ignore all rocks below 2 units of height relative to the player height?

Not sure how that works out with OpenGL though, or if that has any relevance (my guess is that it hasn't, but I never worked with OpenGL so far).

 

Edit: And then for deciding height, do take all rocks into account, and use 1+ height of highest rock that you collide with?

Edited by Alberth

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.

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!