diff --git a/VaporWaveWars/character.cpp b/VaporWaveWars/character.cpp index 4ff62ab..e17daa3 100644 --- a/VaporWaveWars/character.cpp +++ b/VaporWaveWars/character.cpp @@ -3,7 +3,7 @@ Character::Character(int player){ playerNum = player; ASSERT(texture.loadFromFile(spriteFile)); - height = texture.getSize().y/6; + height = texture.getSize().y/8; width = texture.getSize().x/4; timestamp = indexX = idleFrame = 0; indexY = magicNumber; @@ -18,7 +18,7 @@ Character::Character(int player){ } else{ setPosition(posX2, posY2); - magicNumber = 3; + magicNumber = 4; } } @@ -35,16 +35,10 @@ void Character::update(float deltaTime){ indexX = (indexX+1)%4; //Acabar automaticament la animacio de attack - if (actualState == PlayerState::attacking and indexX%4 == 3){ + if ((actualState == PlayerState::attacking or actualState == PlayerState::hurt or actualState == PlayerState::success) and indexX%4 == 3){ setState(PlayerState::idle); } - //Acabar automaticament la animacio de hurt - if (actualState == PlayerState::hurt and indexX%4 == 3){ - setState(PlayerState::idle); - } - - idleFrame = (idleFrame+1)%4; } } @@ -67,6 +61,11 @@ void Character::setState(PlayerState::playerState state){ indexX = 0; indexY = 2 + magicNumber; } + else if (state == PlayerState::success){ + std::cout << "i am succeed!" << std::endl; + indexX = 0; + indexY = 3 + magicNumber; + } } bool Character::isLastFrame(){ diff --git a/VaporWaveWars/commons.hpp b/VaporWaveWars/commons.hpp index 60aeb88..fc0ce6b 100644 --- a/VaporWaveWars/commons.hpp +++ b/VaporWaveWars/commons.hpp @@ -43,7 +43,7 @@ enum gameScene{menu,inGame,help,credits}; } namespace PlayerState { -enum playerState{idle, attacking, inMidle, hurt}; +enum playerState{idle, attacking, inMidle, hurt, success}; } #endif // COMMONS_HPP diff --git a/build-VaporWaveWars-Desktop_Qt_5_7_0_GCC_64bit-Debug/VaporWaveWars b/build-VaporWaveWars-Desktop_Qt_5_7_0_GCC_64bit-Debug/VaporWaveWars index b827d7e..eae4a80 100755 Binary files a/build-VaporWaveWars-Desktop_Qt_5_7_0_GCC_64bit-Debug/VaporWaveWars and b/build-VaporWaveWars-Desktop_Qt_5_7_0_GCC_64bit-Debug/VaporWaveWars differ