Skip to content

Commit

Permalink
Application de la friction que lorsque le joueur est au sol
Browse files Browse the repository at this point in the history
  • Loading branch information
nbourre committed Sep 19, 2023
1 parent 710a9ce commit a000cb9
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions s03_jumping/s03_jumping.pde
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ void manageInputs() {
player.applyForce(PVector.mult(forward, -1.0));
}
} else {
PVector friction = player.velocity.copy();

friction.normalize();
friction.mult(-1);
friction.mult(0.2);

player.applyForce(friction);
if (player.onFloor()) {

PVector friction = player.velocity.copy();

friction.normalize();
friction.mult(-1);
friction.mult(0.2);

player.applyForce(friction);
}
}

}
Expand Down

0 comments on commit a000cb9

Please sign in to comment.