-
Notifications
You must be signed in to change notification settings - Fork 1
/
player.h
46 lines (37 loc) · 1.02 KB
/
player.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
/*
* player.h
*
* Created on: 2013-07-13
* Author: Liam
*/
#ifndef PLAYER_H_
#define PLAYER_H_
#include "graphics.h"
#include "physics.h"
#include "framerate.h"
#include "entity.h"
#include "observer.h"
#include "entitycreator.h"
#include "animation.h"
#define PLAYER_LEFT_RIGHT_SPEED 30.f
#define PLAYER_JUMP_SPEED -90.f
#define PLAYER_JUMP_HEIGHT 11.5f
typedef class Player : public Entity, public Subject {
public:
Player();
Player(const vec2d pos, const vec2d vel, const vec2d accel, const Image image);
virtual void setCanjump(bool x) {canjump = x;}
virtual bool write(std::ofstream &file);
virtual bool read(std::ifstream &file);
virtual void update(float dt);
private:
bool canjump;
Animation m_animation;
} Player_s;
typedef class _PlayerCreator: public EntityCreator {
virtual ~_PlayerCreator() {}
virtual Entity *create() const {return new Player;}
virtual Entity *create(const vec2d &pos, const vec2d &dummy1, const int &dummy2) const;
} Player_Creator;
extern Player *g_pPlayer;
#endif /* PLAYER_H_ */