turn left and right

This commit is contained in:
koehr 2018-05-04 00:51:38 +02:00
parent 76f6f2f9d5
commit 45c42ee210

View file

@ -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