From def2d167346011f60a95d9f1e4b07db8370024cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Tue, 15 Nov 2022 19:49:51 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20La=20animaci=C3=B3n=20de=20muerte=20era?= =?UTF-8?q?=20incorrecta=20y=20salia=20disparado=20el=20sprite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/common/sprite.cpp | 4 ++-- source/player.cpp | 3 ++- source/title.cpp | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/common/sprite.cpp b/source/common/sprite.cpp index e912494..faa81eb 100644 --- a/source/common/sprite.cpp +++ b/source/common/sprite.cpp @@ -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 diff --git a/source/player.cpp b/source/player.cpp index bb58c57..359b339 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -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); diff --git a/source/title.cpp b/source/title.cpp index ea0d8f3..010273f 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -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();