-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBullet.cpp
44 lines (32 loc) · 877 Bytes
/
Bullet.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
#include "Player.h"
#include "InputManager.h"
#include "GLManager.h"
#include "Config.h"
#include "externs.h"
#include "Frame.h"
#include "Bullet.h"
#include <math.h>
extern Config conf;
using namespace std;
float Bullet::speed;
Bullet::Bullet(Vertex *coords, float ang, float ang_rad) {
this->coords = new Vertex();
this->coords->x = coords->x;
this->coords->z = coords->z;
this->coords->y = g_map->triangulateHeight(coords->x, coords->z);
this->ang = ang;
this->ang_rad = ang_rad;
this->anim = new Frame();
this->anim->add_anim(MOVE_WALK, Bullets::anim_start, Bullets::anim_end);
this->anim->set_anim(MOVE_WALK);
}
Bullet::~Bullet() {
}
void Bullet::update() {
coords->x += cos(ang_rad) * speed;
coords->z += sin(ang_rad) * speed;
coords->y = g_map->triangulateHeight(coords->x, coords->z);
}
void Bullet::inc_frame() {
this->anim->inc_frame();
}