-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBullet.h
57 lines (46 loc) · 1.11 KB
/
Bullet.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
//
// Bullet.h
// FinalProjectFund2
//
// Created by Matt McGlynn on 3/31/13.
// Copyright (c) 2013 Matt McGlynn. All rights reserved.
//
#ifndef FinalProjectFund2_Bullet_h
#define FinalProjectFund2_Bullet_h
#include "GraphicsHeader.h"
class Bullet {
public:
double x;
double y;
double z;
double radius;
double speed;
double yaw;
double pitch;
Bullet(){};
Bullet(double xPos, double yPos, double zPos, double speedD, double yawA, double pitchA){
x = xPos;
y = yPos;
z = zPos;
speed = speedD;
yaw = yawA;
pitch = pitchA;
}
void moveBullet(){
double pi = 3.14159262;
double yawRad = (yaw * pi)/180;
double pitchRad = (pitch *pi)/180;
x = x + speed*cos(yawRad);
z = z - speed*sin(yawRad);
y = y + speed*sin(pitchRad);
}
void drawBullet(){
glTranslatef(x, y, z);
glColor4f(.16, .15, .15, .6);
glPushMatrix();
glutSolidSphere(.4, 20, 20);
glPopMatrix();
glTranslatef(-x, -y, -z);
}
};
#endif