-
Notifications
You must be signed in to change notification settings - Fork 0
/
Entity.cpp
54 lines (53 loc) · 1.17 KB
/
Entity.cpp
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
#include "Entity.h"
#include <iostream>
#include <stdlib.h>
#include <ctime>
Entity::Entity() {}
void Entity::setPos(sf::Vector2f nPos) { //set position of character
//pos = sf::Vector2f(nxpos, nypos);
Sprite.setPosition(nPos);
}
void Entity::setCurSpeed(float xSpeed, float ySpeed) {
curSpeed = sf::Vector2f(xSpeed, ySpeed);
}
void Entity::setMaxSpeed(float nMaxSpeed) {
maxSpeed = nMaxSpeed;
}
void Entity::setSpeedMod(float nSpeedMod) {
speedMod = nSpeedMod;
}
void Entity::setRot(float rot) {
Sprite.setRotation(rot);
}
void Entity::setRotSpeed(float speed) {
rotSpeed = speed;
}
void Entity::setBound(int xBound, int yBound) {
bound[0] = xBound;
bound[1] = yBound;
}
void Entity::setScale(float xScale, float yScale) {
scale.x = xScale;
scale.y = yScale;
Sprite.setScale(scale);
}
void Entity::setSize() {
size[0] = Sprite.getGlobalBounds().width;
size[1] = Sprite.getGlobalBounds().height;
}
sf::Vector2f Entity::getPos() {
return pos;
}
sf::Sprite Entity::getSprite() {
return Sprite;
}
sf::FloatRect Entity::getBoundBox() {
return boundBox;
}
float* Entity::getSize() {
return size;
}
sf::Vector2f Entity::getScale() {
return scale;
}
void Entity::main() {}