Añadidos enemigos volteados verticalmente
This commit is contained in:
@@ -49,6 +49,8 @@ MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vel
|
||||
|
||||
// Establece el tipo de volteado
|
||||
currentFlip = SDL_FLIP_NONE;
|
||||
currentFlipH = false;
|
||||
currentFlipV = false;
|
||||
};
|
||||
|
||||
// Reinicia todas las variables
|
||||
@@ -305,16 +307,56 @@ void MovingSprite::switchRotate()
|
||||
rotateAmount *= -1;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void MovingSprite::setFlip(SDL_RendererFlip flip)
|
||||
// Actualiza el valor de la variable
|
||||
void MovingSprite::updateCurrentFlip()
|
||||
{
|
||||
currentFlip = flip;
|
||||
if (currentFlipH && currentFlipV)
|
||||
{
|
||||
currentFlip = SDL_RendererFlip(SDL_FLIP_HORIZONTAL | SDL_FLIP_VERTICAL);
|
||||
}
|
||||
|
||||
else if (currentFlipH && !currentFlipV)
|
||||
{
|
||||
currentFlip = SDL_FLIP_HORIZONTAL;
|
||||
}
|
||||
|
||||
else if (!currentFlipH && currentFlipV)
|
||||
{
|
||||
currentFlip = SDL_FLIP_VERTICAL;
|
||||
}
|
||||
|
||||
else if (!currentFlipH && !currentFlipV)
|
||||
{
|
||||
currentFlip = SDL_FLIP_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void MovingSprite::setFlipH(bool flip)
|
||||
{
|
||||
currentFlipH = flip;
|
||||
updateCurrentFlip();
|
||||
}
|
||||
|
||||
// Gira el sprite horizontalmente
|
||||
void MovingSprite::flip()
|
||||
void MovingSprite::flipH()
|
||||
{
|
||||
currentFlip = (currentFlip == SDL_FLIP_HORIZONTAL) ? SDL_FLIP_NONE : SDL_FLIP_HORIZONTAL;
|
||||
currentFlipH = !currentFlipH;
|
||||
updateCurrentFlip();
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void MovingSprite::setFlipV(bool flip)
|
||||
{
|
||||
currentFlipV = flip;
|
||||
updateCurrentFlip();
|
||||
}
|
||||
|
||||
// Voltea el sprite verticalmente
|
||||
void MovingSprite::flipV()
|
||||
{
|
||||
currentFlipV = !currentFlipV;
|
||||
updateCurrentFlip();
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
@@ -323,6 +365,18 @@ SDL_RendererFlip MovingSprite::getFlip()
|
||||
return currentFlip;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
bool MovingSprite::getFlipH()
|
||||
{
|
||||
return currentFlipH;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
bool MovingSprite::getFlipV()
|
||||
{
|
||||
return currentFlipV;
|
||||
}
|
||||
|
||||
// Devuelve el rectangulo donde está el sprite
|
||||
SDL_Rect MovingSprite::getRect()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user