-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBodyPart.cpp
More file actions
56 lines (42 loc) · 1.27 KB
/
BodyPart.cpp
File metadata and controls
56 lines (42 loc) · 1.27 KB
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
#include "BodyPart.hpp"
#include "Resources.hpp"
BodyPart::BodyPart() {}
BodyPart::BodyPart(GameManager *gm, float px, float py, float sx, float sy, int idBody)
: Collisionable(gm, &Resources::bodyPartTexture, sx, sy, 1, 1) {
sprite = sf::Sprite();
switch (idBody){
case 1:
sprite.setTexture(Resources::legsText);
break;
case 2:
sprite.setTexture(Resources::bodyText);
break;
case 3:
sprite.setTexture(Resources::armsText);
break;
case 4:
sprite.setTexture(Resources::handText);
break;
case 5:
sprite.setTexture(Resources::headText);
break;
case 6:
sprite.setTexture(Resources::wingsText);
break;
default:
break;
}
sprite.setPosition(px,py);
// sprite.setScale(sx/sprite.getGlobalBounds().width, sy/sprite.getGlobalBounds().height);
id = idBody;
}
BodyPart::~BodyPart() {
}
int BodyPart::getId(){
return id;
}
void BodyPart::draw(sf::RenderWindow* window) {
window->draw(sprite);
}
void BodyPart::update(float deltaTime) {
}