multiplayer-test/common/player.js

21 lines
494 B
JavaScript
Raw Normal View History

2024-08-30 02:56:03 +00:00
export default class Player {
static SPEED = 400.0;
static SIZE = 50.0;
constructor(name, x, y, colour) {
this.x = x;
this.y = y;
this.in_x = 0.0;
this.in_y = 0.0;
this.draw_x = x;
this.draw_y = y;
this.name = name;
this.colour = colour;
}
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;
}
}