1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#include "Addons.h"
Addons::Addons(Player* player) {
this->_player = player;
//this->_id = id;
this->addonTexture.loadFromFile(EFFECTS_PATH);
this->_addon.setTexture(this->addonTexture);
int tempX = 6, tempY = 15, distanceX = 171, distanceY = 61;
switch (this->_id) {
case 1:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 0, tempY + distanceY * 0, 152, 42));
break;
case 2:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 1, tempY + distanceY * 0, 152, 42));
break;
case 3:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 2, tempY + distanceY * 0, 152, 42));
break;
case 4:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 0, tempY + distanceY * 1, 152, 42));
break;
case 5:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 1, tempY + distanceY * 1, 152, 42));
break;
case 6:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 2, tempY + distanceY * 1, 152, 42));
break;
case 7:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 0, tempY + distanceY * 2, 152, 42));
break;
case 8:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 1, tempY + distanceY * 2, 152, 42));
break;
case 9:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 2, tempY + distanceY * 2, 152, 42));
break;
case 10:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 0, tempY + distanceY * 3, 152, 42));
break;
case 11:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 1, tempY + distanceY * 3, 152, 42));
break;
case 12:
this->_addon.setTextureRect(IntRect(tempX + distanceX * 2, tempY + distanceY * 3, 152, 42));
break;
};
}
void Addons::move() {
this->_addon.move(0,this->addonMoveSpeed);
}
void Addons::draw(RenderWindow& window) {
this->move();
window.draw(this->_addon);
}
| |