Skip to content

Commit

Permalink
Sync onladder state
Browse files Browse the repository at this point in the history
  • Loading branch information
lorgan3 committed Oct 27, 2024
1 parent 881b31e commit 03336d1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/data/collision/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,22 @@ export class Body implements PhysicsBody {
}

serialize() {
return [this.active, this.xVelocity, this.yVelocity, this.x, this.y];
return [
this.active,
this.xVelocity,
this.yVelocity,
this.x,
this.y,
this._onLadder,
];
}

deserialize(data: any[]) {
this.active = data[0];
this.xVelocity = data[1];
this.yVelocity = data[2];
this.move(data[3], data[4]);
this._onLadder = data[5];
}

walk(direction: 1 | -1) {
Expand Down

0 comments on commit 03336d1

Please sign in to comment.