moveRight method
Move player to Right
Implementation
bool moveRight(double speed, {bool notifyOnMove = true}) {
double innerSpeed = speed * dtUpdate;
Vector2 displacement = position.translate(innerSpeed, 0);
if (_isCollision(displacement)) {
if (notifyOnMove) {
onMove(
0,
Direction.right,
BonfireUtil.getAngleFromDirection(Direction.right),
);
}
return false;
}
isIdle = false;
position = displacement;
lastDirection = Direction.right;
lastDirectionHorizontal = Direction.right;
if (notifyOnMove) {
onMove(
speed,
lastDirection,
BonfireUtil.getAngleFromDirection(lastDirection),
);
}
return true;
}