moveByVector method
Implementation
bool moveByVector(Vector2 speed) {
double innerSpeedX = speed.x * dtUpdate;
double innerSpeedY = speed.y * dtUpdate;
Vector2 displacement = position.translate(innerSpeedX, innerSpeedY);
if (_isCollision(displacement)) {
return false;
}
isIdle = false;
position = displacement;
return true;
}