reworking reconcilation and improved debug

This commit is contained in:
ari melody 2024-08-30 15:18:07 +01:00
parent cdaa7c678d
commit f1c9af7b6b
Signed by: ari
GPG key ID: CF99829C92678188
4 changed files with 251 additions and 142 deletions

View file

@ -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);
}
}