Merge branch 'master' into serk

This commit is contained in:
serk 2017-01-21 05:34:10 +01:00
commit c9255d854d
3 changed files with 8 additions and 3 deletions

View file

@ -5,7 +5,8 @@ Character::Character(int player){
ASSERT(texture.loadFromFile(spriteFile)); ASSERT(texture.loadFromFile(spriteFile));
height = texture.getSize().y/5; height = texture.getSize().y/5;
width = texture.getSize().x/5; width = texture.getSize().x/5;
next = timestamp = indexX = indexY = 0; next = timestamp = indexX = 0;
indexY = magicNumber;
setTexture(texture); setTexture(texture);
sf::IntRect rect = sf::IntRect(indexX*width, indexY*height, width, height); sf::IntRect rect = sf::IntRect(indexX*width, indexY*height, width, height);
setTextureRect(rect); setTextureRect(rect);
@ -13,9 +14,11 @@ Character::Character(int player){
if (playerNum == 0){ if (playerNum == 0){
setPosition(posX1, posY1); setPosition(posX1, posY1);
magicNumber = 0;
} }
else{ else{
setPosition(posX2, posY2); setPosition(posX2, posY2);
magicNumber = 2;
} }
} }
@ -41,11 +44,11 @@ void Character::setState(PlayerState::playerState state){
actualState = state; actualState = state;
if (state == PlayerState::idle){ if (state == PlayerState::idle){
indexX = 0; indexX = 0;
indexY = 0; indexY = 0 + magicNumber;
} }
else{ else{
indexX = 0; indexX = 0;
indexY = 1; indexY = 1 + magicNumber;
} }
} }

View file

@ -14,6 +14,8 @@ private:
float posX2 = 300, posY2 = 0; float posX2 = 300, posY2 = 0;
//END CONFIG //END CONFIG
int magicNumber;
sf::Texture texture; sf::Texture texture;
int indexX, indexY, width, height; int indexX, indexY, width, height;
int playerNum; int playerNum;