turn left and right
This commit is contained in:
parent
76f6f2f9d5
commit
45c42ee210
1 changed files with 3 additions and 0 deletions
|
@ -89,6 +89,9 @@ export default {
|
||||||
let vx = this.player_velocity_x * RECIPROCAL
|
let vx = this.player_velocity_x * RECIPROCAL
|
||||||
let vy = this.player_velocity_y * RECIPROCAL
|
let vy = this.player_velocity_y * RECIPROCAL
|
||||||
|
|
||||||
|
if (vx < 0) this.player_direction = 'left'
|
||||||
|
if (vx > 0) this.player_direction = 'right'
|
||||||
|
|
||||||
if (vx > 0 && this.blockedRight) vx = 0
|
if (vx > 0 && this.blockedRight) vx = 0
|
||||||
if (vx < 0 && this.blockedLeft) vx = 0
|
if (vx < 0 && this.blockedLeft) vx = 0
|
||||||
if (vy > 0 && this.blockedDown) vy = 0
|
if (vy > 0 && this.blockedDown) vy = 0
|
||||||
|
|
Loading…
Reference in a new issue