Hey JGO, I got bored and decided to goof around and make a player that has physics. (Mass, gravity, velocity etc)
I’m wondering how would I implement wall jumping?
(Video on what I’m talking about: Short youtube video)
Here’s a picture, if anyone needs code snippets from the platformer let me know
Code snippets:
/** Update method */
public void tick() {
// Handles w,a,s,d, space_bar etc
processInput();
// Handles jumping/falling/velocity etc
processPhysics();
// Handles collision (x<=1 etc)
processCollision();
}
/** Process collision method */
private void processCollision() {
// Player has somehow reached top of level o.0
if(y <= 0) {
y = 0;
jumping = false;
jumpTimeSoFar = - 1;
jumpTimeStart = - 1;
jumpTicks = 0;
fallTimeSoFar = - 1;
fallTimeStart = System.currentTimeMillis();
falling = true;
}
if(x <= 1) {
// Player is touching the left wall
x = 1;
leftWallCollision = true;
}
if((x + width) >= (Launcher.WIDTH - 11)) {
// Player is touching the right wall
x = (Launcher.WIDTH - 11) - width;
rightWallCollision = true;
}
}
Thanks for any help/feedback JGO, I only found 1 post on our forums relating to wall jumping and I took all the knowledge I can from it and am now stuck :S