add basic missiles
This commit is contained in:
parent
21a30ad212
commit
ac089f3e8e
19 changed files with 215 additions and 85 deletions
19
public/js/starbugs/player.js
Normal file
19
public/js/starbugs/player.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
class Player {
|
||||
constructor(name, team, ship) {
|
||||
this.name = name;
|
||||
this.team = team;
|
||||
this.ship = ship;
|
||||
|
||||
this.lastInputs = [];
|
||||
}
|
||||
|
||||
packDelta() {
|
||||
// W, A, D, Space
|
||||
let inputs = [87, 65, 68];
|
||||
inputs = inputs.map(k => game.input.keys.held[k] || false);
|
||||
inputs[3] = game.input.keys.pressed[32] || false;
|
||||
let delta = this.lastInputs == inputs ? false : inputs;
|
||||
this.lastInputs = inputs;
|
||||
return delta;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue