How to add a jumping mechanic to a game? #631
Replies: 7 comments
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022).
Posted: 2018-12-19 20:21:51
User: Dmartin42 [] (age: 1435 days 🔥; posts: 36)
Hello,
I have made a platformer but cannot figure out how to add a jumping mechanic. It is currently setup as follows:
The player presses 'space' and I move the entity up ten and let my GravityForce bring them back down.
private void jump(Creature player) { { Point2D jumpHeight = new Point2D.Double(player.getX(), player.getY()-10); player.setMoveDestination(jumpHeight); Game.getPhysicsEngine().move(player, player.getMoveDestination()); }
However, I want it so that the player can ONLY jump if they have collision with an entity or a static collision box. I have tried the game.getPhysics.collide() method in many ways but still cant figure it out. If anyone has suggestions, that would be great.
Beta Was this translation helpful? Give feedback.
All reactions