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

Started by
0 comments, last by Alberth 8 years, 4 months ago
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
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?

This topic is closed to new replies.

Advertisement