Colisiones básicas completadas

This commit is contained in:
2022-08-17 13:26:22 +02:00
parent a6d6f2854e
commit 9bd1e9b936
11 changed files with 115 additions and 41 deletions

View File

@@ -158,6 +158,13 @@ double MovingSprite::getAngle()
return mAngle;
}
// Establece la posición del objeto
void MovingSprite::setPos(SDL_Rect rect)
{
mPosX = (float)rect.x;
mPosY = (float)rect.y;
}
// Establece el valor de la variable
void MovingSprite::setPosX(float x)
{
@@ -314,4 +321,22 @@ void MovingSprite::undoMove()
{
mPosX = mPosXPrev;
mPosY = mPosYPrev;
}
// Deshace el último movimiento en el eje X
void MovingSprite::undoMoveX()
{
mPosX = mPosXPrev;
}
// Deshace el último movimiento en el eje Y
void MovingSprite::undoMoveY()
{
mPosY = mPosYPrev;
}
// Pone a cero las velocidades de desplacamiento
void MovingSprite::clearVel()
{
mVelX = mVelY = 0;
}