-
Notifications
You must be signed in to change notification settings - Fork 9
/
Tank.h
46 lines (39 loc) · 1.08 KB
/
Tank.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
#ifndef Tank_H
#define Tank_H
#include "WorldObject.h"
class Player;
class Tank : public WorldObject
{
public:
Tank();
~Tank();
void draw(sf::RenderTarget &target);
void step(float dt);
void handleCollision(WorldObject &b);
void reset();
void receiveMessage(const Message& msg);
void setMovement(int val);
void weapAct(float ); //called when hit by some weapon
void setPosition(const sf::Vector2f& pos);
void setPosition(int x,int y) { setPosition(sf::Vector2f(x,y)); }
friend class Player;
void setPlayer(Player *p);
Player &getPlayer() { return *myOwner; }
sf::Sprite& getTankSpr(){ return tank; }
sf::Sprite& getTurretSpr(){ return turret; }
sf::RectangleShape getTankRect();
private:
void setLifeFill(int l);
Player *myOwner;
int moving;//on land
sf::Sprite tank;
sf::Sprite turret;
sf::RectangleShape lifeBg;
sf::RectangleShape lifeFill;
bool freefall;
sf::Vector2f velocity;
sf::Text Name;
bool fadingLife;
float fadingTimer;//fading starts after this runs out
};
#endif // Tank_H