Can I make an actor have the ability to jump only when touching the top of another actor?
Hi, I am making a game where actors (rocks in this case) spawn at the top of the screen at random x coordinates and the fall to the bottom of the screen. The player has to jump from rock to rock to get to the top before a rock either falls on his head or the rising lava touches him. There are two problems that I can't find a solution for on the internet:
I need to make it so that the actor can only jump when touching the top of a rock, the actor MUST be touching the top of the rock otherwise the game can be exploited and you can climb the side of a pillar of rocks that is usually too high to jump.
I need to make it so that if a rock lands on a player while the rock is falling the player loads the death screen. I have tried making two actors spawn and one of them at the bottom of the rock and when this actor collides with the player the player dies. This way works but has lots of problems.
Thanks in advance!
Answers
I did a tutorial about killing and enemy only when you jump on it's head/top. Maybe you could adapt that to your needs?
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
This would work but there are several rocks on screen at a time and every rock is an instance of the same prototype rock. Is there a way to make it work with the y coordinates of only the rock that the player is touching? I realise that I should have mentioned this in the original question but I forgot. Sorry.
Thanks, RThurman that helps a lot. I should have thought about putting the code in the rocks not the player.