game: fix: w is to up and s to down
This commit is contained in:
parent
b6c87832e4
commit
a30260bcf4
@ -19,6 +19,8 @@ class MyPlayer extends Player
|
||||
* @type {Client}
|
||||
*/
|
||||
this.client = client;
|
||||
|
||||
this.increment_sign = this.rail.start.y > this.rail.stop.y ? 1 : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -29,9 +31,9 @@ class MyPlayer extends Player
|
||||
let new_pos = this.position;
|
||||
|
||||
if (keys_pressed.includes("s"))
|
||||
new_pos -= this.game.config.paddle_speed_per_second_max * this.game.time.deltaTimeSecond() * 1.0;
|
||||
new_pos -= this.game.config.paddle_speed_per_second_max * this.game.time.deltaTimeSecond() * 1.0 * this.increment_sign;
|
||||
if (keys_pressed.includes("w"))
|
||||
new_pos += this.game.config.paddle_speed_per_second_max * this.game.time.deltaTimeSecond() * 1.0;
|
||||
new_pos += this.game.config.paddle_speed_per_second_max * this.game.time.deltaTimeSecond() * 1.0 * this.increment_sign;
|
||||
new_pos = Math.max(0 + this.game.config.paddle_ratio / 2, new_pos);
|
||||
new_pos = Math.min(1 - this.game.config.paddle_ratio / 2, new_pos);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user