12 setDestCoord((w/2)-(getDestW()/2), (h/2)-(getDestH()/2));
15 void Object::setName(
string s) {
18 string Object::getName() {
33 void Object::centerOn(
Input i) {
34 setDestCoord(i.getMouseX()-(getDestW()/2), i.getMouseY()-(getDestH()/2));
37 void Object::centerOn(
int cx,
int cy) {
38 setPosCoord(cx-(getDestW()/2), cy-(getDestH()/2));
42 double angle = atan2(o.getDestY() - getDestY(), o.getDestX() - getDestX());
43 double c = cos(angle) * getSpeed();
44 double s = sin(angle) * getSpeed();
50 double angle = atan2(y-getDestY(), x-getDestX());
51 double c = cos(angle) * getSpeed();
52 double s = sin(angle) * getSpeed();
58 double angle = atan2(o.getDestY() - getDestY(), o.getDestX() - getDestX()) * (180/PI);
64 tmp.setDestCoord(i.getMouseX(), i.getMouseY());
68 void Object::centerOn(
Object obj) {
69 centerOn(obj.getDestX()-(obj.getDestW()/2), obj.getDestY()-(obj.getDestH()/2));
72 void Object::rotateAngle(
int rot) {
76 void Object::moveToVel() {
77 moveDest(getVelX(), getVelY());
This class stores information for an Object in the game.
void setDest(SDL_Rect i)
Set the destination with a given SDL_Rect.
double getAngle() const
Get the Object's angle.
virtual void checkDisplayable(Object screen)
Checks if the Object is in the given screen.
SDL_Rect getPos() const
Get the position of the Object in the world.
void center(int w, int h)
Center the Object based on a width and height.
Class used for calculating different types of collision between given Objects.
void lookAt(Object o)
Set the object's angle towards another object.
bool isTouching(Object a, Object b)
Check if two objects are touching.
void setVelTo(Object o)
Set the object's velocity toward another object.
void setAngle(double a)
Set the angle.