Fix: La animación de muerte era incorrecta y salia disparado el sprite

This commit is contained in:
2022-11-15 19:49:51 +01:00
parent 9708f4e7ff
commit def2d16734
3 changed files with 8 additions and 3 deletions

View File

@@ -90,8 +90,8 @@ int Sprite::getHeight()
// Establece la posición del objeto
void Sprite::setPos(SDL_Rect rect)
{
x = rect.x;
y = rect.y;
this->x = rect.x;
this->y = rect.y;
}
// Establece el valor de la variable

View File

@@ -374,7 +374,8 @@ void Player::setAlive(bool value)
if (!value)
{
deathSprite->setPos(headSprite->getRect());
deathSprite->setPosX(headSprite->getRect().x);
deathSprite->setPosY(headSprite->getRect().y);
deathSprite->setAccelY(0.2f);
deathSprite->setVelY(-6.6f);
deathSprite->setVelX(3.3f);

View File

@@ -662,6 +662,10 @@ void Title::checkEventHandler()
{
switch (eventHandler->key.keysym.scancode)
{
case SDL_SCANCODE_ESCAPE:
section.name = PROG_SECTION_QUIT;
break;
case SDL_SCANCODE_F:
screen->switchVideoMode();
reloadTextures();