-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObject.cpp
More file actions
32 lines (28 loc) · 928 Bytes
/
Object.cpp
File metadata and controls
32 lines (28 loc) · 928 Bytes
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
#include "Object.hpp"
Object::Object(bool evil, double x,double y, double len)
{
posn.x = x;
posn.y = y;
this->len = len;
this->evil = evil;
}
void Object::UpdatePosn()
{
double deltaTime = 1;
velocity.Vx = velocity.Vx + acceleration.Ax*deltaTime;
posn.x = posn.x + velocity.Vx*deltaTime;
velocity.Vy = velocity.Vy + acceleration.Ay*deltaTime;
posn.y = posn.y + velocity.Vy*deltaTime;
}
//getters
double Object::getLen(){return len;}
Vec2 Object::getPosn(){return posn;}
Vel2 Object::getVel(){return velocity;}
Acc2 Object::getAcc(){return acceleration;}
//setters
void Object::setAcc_x(double acc){acceleration.Ax = acc;}
void Object::setAcc_y(double acc){acceleration.Ay = acc;}
void Object::setPosn_x(double x){posn.x = x;}
void Object::setPosn_y(double y){posn.y = y;}
void Object::setVel_x(double velx){velocity.Vx = velx;}
void Object::setVel_y(double vely){velocity.Vy = vely;}