Skip to content

Commit

Permalink
allows left right movement on jumplatforms, but climbs walls
Browse files Browse the repository at this point in the history
  • Loading branch information
jm1021 committed Feb 15, 2024
1 parent 98cf42c commit 3246e07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assets/js/platformer2/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,21 @@ export class Player extends Character {
if (this.collisionData.touchPoints.other.left) {
this.movement.right = false;
this.gravityEnabled = true;
this.y -= GameEnv.gravity; // allows movemnt on platform, but climbs walls

// this.x -= this.isActiveAnimation("s") ? this.moveSpeed : this.speed; // Move to left

}
if (this.collisionData.touchPoints.other.right) {
this.movement.left = false;
this.gravityEnabled = true;
this.y -= GameEnv.gravity; // allows movemnt on platform, but climbs walls

// this.x += this.isActiveAnimation("s") ? this.moveSpeed : this.speed; // Move to right
}
if (this.collisionData.touchPoints.this.top) {
this.movement.down = false; // enable movement down without gravity
this.gravityEnabled = false;
// this.y -= GameEnv.gravity;
this.setAnimation(this.directionKey); // set animation to direction
}}

Expand Down

0 comments on commit 3246e07

Please sign in to comment.