moveLeft method
Move player to Left
Implementation
bool moveLeft(double speed, {bool notifyOnMove = true}) {
double innerSpeed = speed * dtUpdate;
Vector2 displacement = position.translate((innerSpeed * -1), 0);
if (_isCollision(displacement)) {
if (notifyOnMove) {
onMove(0, Direction.left, getAngleByDirectional(Direction.left));
}
return false;
}
isIdle = false;
position = displacement;
lastDirection = Direction.left;
lastDirectionHorizontal = Direction.left;
if (notifyOnMove) {
onMove(speed, lastDirection, getAngleByDirectional(lastDirection));
}
return true;
}