-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprojectile.h
64 lines (55 loc) · 1.47 KB
/
projectile.h
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
55
56
57
58
59
60
61
62
63
64
#ifndef PROJECTILE
#define PROJECTILE
#include "globals.h"
#include "polygon3d.h"
#include "drawableObject.h"
#include <math.h>
#include <vector>
struct Explosion{
double x;
double y;
double z;
int decay;
int staticDecay;
double expansionRate;
double radius;
};
struct Trail{
double x;
double y;
double z;
int decay;
int staticDecay;
};
class Projectile:public DrawableObject{
private:
int trailInterval;
double drag(double speed);
double f(double p, double q, double drag);
double g(double p, double q, double drag);
void step();
std::vector<Explosion> explosions;
std::vector<Trail> trails;
float projR, projG, projB;
void baseInit(Point center, Point tankStart, double angleV, double angleH); // sets variable to the known most basic values
public:
enum{MOVING,EXPLODING,DYING,DEAD};
int state; // is one of the above
Point oldCenter;
int invincibility;
Point tankStart, local;
double angleV, angleH, velocity, mass, C;
double h, t, x, y, p, q;
//std::vector<Polygon3d> boundingBox;
//std::vector<Polygon3d> model;
Projectile(Point center);
Projectile(Point center, Point tankStart, double angleV, double angleH); //Vertical Angle = angleV, horizontal angle = angleH
Projectile(Point center, Point tankStart, double angleV, double angleH, float tankR, float tankG, float tankB);
void draw();
void update();
void drawExplosion(struct Explosion *ex);
void setExploding();
void setExploding(Point p);
void drawTrails(std::vector<Trail>& trailList);
};
#endif