-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprojectile.h
More file actions
59 lines (44 loc) · 1.2 KB
/
projectile.h
File metadata and controls
59 lines (44 loc) · 1.2 KB
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
/*
Copyright (c) 2013 Auston Sterling
See license.txt for copying permission.
-----Projectile Class Declaration-----
Auston Sterling
austonst@gmail.com
Contains the header for the Projectile class.
*/
#ifndef _projectile_h_
#define _projectile_h_
#include <string>
#include "fleet.h"
#include "vec2f.h"
const int DEFAULT_PROJECTILE_SPEED = 200;
class Projectile
{
public:
//Constructors
Projectile();
Projectile(Vec2f start, Fleet* dest, std::string effect, float speed);
//Accessors
Vec2f pos() const {return pos_;}
double x() const {return pos_.x();}
double y() const {return pos_.y();}
Fleet* target() {return target_;}
std::string effect() const {return effect_;}
//General use functions
void update();
void display(SDL_Surface* screen, const SDL_Rect& camera);
private:
//Current coordinates of the projectile
Vec2f pos_;
//Target fleet
Fleet* target_;
//The speed, in pixels per second
int speed_;
//The effect as a parsable string
std::string effect_;
//The ticks at the last time update was called
int lastTicks_;
};
typedef std::list<Projectile>::iterator projectileIter;
typedef std::list<Projectile>::const_iterator projectileIterConst;
#endif