Hopping Horse and physics

Can someone help me to make this horse hop (by pushing space) but without falling over and without knocking over the fences? But also without running through the fences. :slight_smile: I am new to using physics.


Hello @kelfjel, Nice game you’ve made!

The thing you are looking for is “Set Static” in the physics menu of the object. This makes it so the object wont be able to move, yet will collide with other physic objects; Then restricing the rotation of the horse allows it to only rotate on the axis you want, this can be done via code.

I’ve changed the jump so that repeatedly pressing space does not allow the horse to fly upwards (though fitting for a unicorn it does also defeat the purpose of the game haha). I have however added a double jump for fun, though if you’d rather have it restricted to 1 jump i’ve also added the code for that; Just delete the loop for double jump and turn on the other one on.

Also when resetting, the player now can’t move, collision is off and the player is set into the right rotation, this all so that it correctly resets the player.

Note; Currently clicking the unicorn sets the speed very high, and can increased infinitely; It might be usefull to restrict this.

Hope to have helped, and best of luck with the game!


Thank you so much! :blush:

1 Like