reworking reconcilation and improved debug
This commit is contained in:
parent
cdaa7c678d
commit
f1c9af7b6b
4 changed files with 251 additions and 142 deletions
|
@ -1,5 +1,7 @@
|
|||
import { WORLD_SIZE } from "./world.js";
|
||||
|
||||
export default class Player {
|
||||
static SPEED = 400.0;
|
||||
static SPEED = 200.0;
|
||||
static SIZE = 50.0;
|
||||
|
||||
constructor(name, x, y, colour) {
|
||||
|
@ -16,5 +18,8 @@ export default class Player {
|
|||
update(delta) {
|
||||
if (this.in_x != 0) this.x += this.in_x * Player.SPEED * delta;
|
||||
if (this.in_y != 0) this.y += this.in_y * Player.SPEED * delta;
|
||||
|
||||
this.x = Math.min(Math.max(this.x, 0.0), WORLD_SIZE);
|
||||
this.y = Math.min(Math.max(this.y, 0.0), WORLD_SIZE);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue