-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathship.h
60 lines (45 loc) · 1.41 KB
/
ship.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
#include "flyingObject.h"
#include "uiDraw.h"
#ifndef ship_h
#define ship_h
#define SHIP_SIZE 10
#define SHIELD_RADIUS 14
#define SHIELD_BUFFER 2
#define ROTATE_AMOUNT 8
#define THRUST_AMOUNT 0.5
// Put your Ship class here
class Ship : public FlyingObject
{
public:
Ship();
Ship(Point p);
~Ship(){}
private:
float angle;
float forwardSpeed;
bool thrust;
int shieldRadius;
void calculateNewVelocity();
public:
void setAngle(float angle) { this->angle = angle; }
float getAngle() { return angle; }
float getForwardSpeed() { return forwardSpeed; }
void setForwardSpeed(float forwardSpeed) { this->forwardSpeed = forwardSpeed; }
bool getThrust() { return thrust; }
void setThrust(bool thrust) { this->thrust = thrust; }
int getShieldRadius() { return shieldRadius; }
void setShieldRadius(int shieldRadius) { this->shieldRadius = shieldRadius; }
//ship movement
void rotateClockwise();
void rotateCounterClockwise();
void moveForward();
void applyBrakes();
//draw
virtual void draw()
{
drawShip(getPoint(), getAngle() - 90, getThrust());
}
void drawShipShield(int powers);
void reset();
};
#endif /* ship_h */