Animacio 2p

This commit is contained in:
marti.lloveras 2017-01-21 11:47:43 +01:00
parent 279c401f4d
commit 770739c352
5 changed files with 3 additions and 3 deletions

View file

@ -26,16 +26,16 @@ void Character::update(float deltaTime){
timestamp += deltaTime;
if (timestamp >= frameTime){
timestamp = 0;
sf::IntRect rect = sf::IntRect(indexX*width, indexY*height, width, height);
setTextureRect(rect);
//Acabar automaticament la animacio de attack
if (actualState == PlayerState::attacking and indexX >= 3){
setState(PlayerState::idle);
}
else {
indexX = (indexX+1)%4;
}
sf::IntRect rect = sf::IntRect(indexX*width, indexY*height, width, height);
setTextureRect(rect);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB