blob: 71bf7cdffa2b902fb9e7f87706abda22a39a5cba (
plain)
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
|
#include "acceleration.h"
#include "velocity.h"
Velocity :: Velocity() {
setDx(0.0f);
setDy(0.0f);
}
Velocity :: Velocity(const float dx, const float dy) {
setDx(0.0f);
setDy(0.0f);
}
void Velocity :: setDx(const float dx) {
this->dx = dx;
}
void Velocity :: setDy(const float dy) {
this->dy = dy;
}
float Velocity :: getDx() {
return this->dx;
}
float Velocity :: getDy() {
return this->dy;
}
void Velocity :: addVelocity (Velocity &vel) {
this->dx += vel.getDx();
this->dy += vel.getDy();
}
void Velocity :: update(Acceleration &acc) {
this->dx += acc.getD2x();
this->dy += acc.getD2y();
}
|