-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBullet.h
55 lines (44 loc) · 1018 Bytes
/
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
//
// Bullet.h
// TankGame
//
// Created by Jacob Gonzalez on 4/05/2015.
// Copyright (c) 2015 Jacob Gonzalez. All rights reserved.
//
#ifndef BULLET_H
#define BULLET_H
#include "Sprite.h"
#include "Terrain.h"
// :: bullet class handles all tank bullet logic ::
// :: bullet handles terrain destruction and terrain impact
// :: does not handle tank impact ::
class Bullet : public Sprite
{
public:
Bullet(Point<int> start, float angle, float power, Terrain *terrain)
: Sprite("*"),
_angle(angle), _power(power)
{
_terrain = terrain;
_position = start;
_start_pos = _position;
_init();
}
~Bullet()
{}
// : reset and allow update :
void fire();
// : return _laucnhed
bool get_launched() const;
void update(int t);
void draw();
private:
Point<float> _velocity;
float _angle;
float _power;
bool _launched;
Point<int> _start_pos;
Terrain *_terrain;
void _init();
};
#endif // BULLET_H