function movePlayer():Void
{
if (this.player.canControl() == false) {
return;
}
if (this.player.hasNoHealth()) {
this.player.velocity.x = 0;
this.player.velocity.y = 0;
return;
}
var angle:Float = joystick.getAngle();
var accelerationX = joystick.acceleration.x;
var accelerationY = joystick.acceleration.y;
var velocityX:Float = GameSize.getPositionByPlatform(20) * accelerationX;
if (angle > -90 && angle < 90) {
this.player.moveRight(0);
} else if (angle > 90 || angle < -90) {
this.player.moveLeft(0);
} else {
this.player.returnUpRight();
}
this.player.velocity.x = velocityX;
if (this.player.isInAir()) {
this.player.velocity.y = 0;
return;
}
this.player.velocity.y = GameSize.getPositionByPlatform(20) * accelerationY;
}