2 players color(?)
This commit is contained in:
parent
bd87393e9b
commit
a7e9dd9229
3 changed files with 8 additions and 3 deletions
|
@ -5,7 +5,8 @@ Character::Character(int player){
|
|||
ASSERT(texture.loadFromFile(spriteFile));
|
||||
height = texture.getSize().y/5;
|
||||
width = texture.getSize().x/5;
|
||||
next = timestamp = indexX = indexY = 0;
|
||||
next = timestamp = indexX = 0;
|
||||
indexY = magicNumber;
|
||||
setTexture(texture);
|
||||
sf::IntRect rect = sf::IntRect(indexX*width, indexY*height, width, height);
|
||||
setTextureRect(rect);
|
||||
|
@ -13,9 +14,11 @@ Character::Character(int player){
|
|||
|
||||
if (playerNum == 0){
|
||||
setPosition(posX1, posY1);
|
||||
magicNumber = 0;
|
||||
}
|
||||
else{
|
||||
setPosition(posX2, posY2);
|
||||
magicNumber = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,11 +44,11 @@ void Character::setState(PlayerState::playerState state){
|
|||
actualState = state;
|
||||
if (state == PlayerState::idle){
|
||||
indexX = 0;
|
||||
indexY = 0;
|
||||
indexY = 0 + magicNumber;
|
||||
}
|
||||
else{
|
||||
indexX = 0;
|
||||
indexY = 1;
|
||||
indexY = 1 + magicNumber;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ private:
|
|||
float posX2 = 300, posY2 = 0;
|
||||
//END CONFIG
|
||||
|
||||
int magicNumber;
|
||||
|
||||
sf::Texture texture;
|
||||
int indexX, indexY, width, height;
|
||||
int playerNum;
|
||||
|
|
Binary file not shown.
Reference in a new issue