-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersonajesAnimados.h
106 lines (88 loc) · 2.91 KB
/
PersonajesAnimados.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
Versus is a PC game programmed in C++ using the Allegro 5.0.11 library.
Copyright (C) 2015 Nexer Rodríguez (rnexer) and Ricardo A. Interiano (Raim)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
For contact information read the README.md file.
**/
#ifndef PERSONAJESANIMADOS_H
#define PERSONAJESANIMADOS_H
#include "Entidad.h"
#include "ObjetosAnimados.h"
#include "Disparos.h"
enum MYKEYS {
KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT
};
enum Estados{
IZQUIERDA,
DERECHA,
CENTRO
};
enum Animaciones{
PARADO_DERECHA,
PARADO_IZQUIERDA,
CAMINANDO_DERECHA,
CAMINANDO_IZQUIERDA,
DISPARANDO_DERECHA,
DISPARANDO_IZQUIERDA,
SALTANDO_DERECHA,
SALTANDO_IZQUIERDA,
CAYENDO_DERECHA,
CAYENDO_IZQUIERDA,
MUERTO_DERECHA,
MUERTO_IZQUIERDA
};
class PersonajesAnimados : public Entidad
{
public:
//estados del personaje
int vidas;
bool muerto;
char orientacion;
int mapa_actual;
unsigned int animacion_actual = 0;
bool key[6] = { false, false, false, false};
int frame;
float velocidad_y;
float aceleracion_y;
float gravedad;
bool jump, down;
map<int, vector<ALLEGRO_BITMAP*> > mapa_sprites;
ALLEGRO_BITMAP *health;
ALLEGRO_BITMAP *damage;
ALLEGRO_SAMPLE *sonido;
ALLEGRO_SAMPLE_ID idsonido;
ALLEGRO_SAMPLE *stop;
ALLEGRO_SAMPLE_ID idstop;
list<PersonajesAnimados*>*personajes;
list<ObjetosAnimados*>*obstaculos;
list<ObjetosAnimados*>*disparos;
ALLEGRO_EVENT ev;
ALLEGRO_TIMEOUT timeout;
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
ALLEGRO_DISPLAY *display;
PersonajesAnimados();
string toString(int number);
virtual int getTime() = 0;
virtual void draw();
void init(list<PersonajesAnimados *> *personajes, list<ObjetosAnimados*>*obstaculos, ALLEGRO_DISPLAY *display);
void detectColision();
PersonajesAnimados* getPrincipal();
void setAnimacion(int nombre);
void teclaPresionada(int keycode, bool *variable);
bool teclaDownEvent(int keycode);
int enumToInt(string animacion);
void limpiarEnemigos();
virtual ~PersonajesAnimados();
protected:
private:
};
#endif // PERSONAJESANIMADOS_H