-
Notifications
You must be signed in to change notification settings - Fork 0
/
Nave.h
87 lines (65 loc) · 1.66 KB
/
Nave.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
#ifndef NAVE_H
#define NAVE_H
//#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include "Bullet.h"
#include "Enemy1.h"
#include "Animacion.h"
#include <list>
#include <vector>
#include <iostream>
#include <math.h>
class Nave
{
public:
static int const ALTO=600;
static int const ANCHO=800;
static float const DEGTORAD=0.017453f;
sf::Sprite *sprite;
sf::Sprite *b_sprite;
sf::Sprite *e_sprite;
sf::Sprite *a_sprite;
sf::Texture texture;//nave
sf::Texture texture2;//bullet
sf::Texture texture3;//enemy
sf::Texture texture4;//animation
sf::Vector2i orientacion;
sf::Vector2f director;
std::list<Bullet> bullets;
std::list<Bullet>::iterator i;
std::list<Animacion> animaciones;
std::list<Animacion>::iterator a;
int alpha;
int weapon;
std::list<Enemy1> enemys;
std::list<Enemy1>::iterator e;
bool flag;
Nave(){
texture.loadFromFile("assets/nave.png");
texture2.loadFromFile("assets/missil.png");
texture3.loadFromFile("assets/hola.png");
texture4.loadFromFile("assets/exp.png");
sprite= new sf::Sprite(texture);
b_sprite= new sf::Sprite(texture2);
e_sprite= new sf::Sprite(texture3);
sprite->scale(.4,.4);
b_sprite->scale(.7,.7);
e_sprite->scale(.3,.3);
director.x=0;
director.y=-1;
sprite->setOrigin(texture.getSize().x/2, texture.getSize().y/2);
orientacion.x=400;
orientacion.y=300;
sprite->setPosition((sf::Vector2f)orientacion);
alpha=90;
weapon=1;
flag=true;
}
void shoot();
void actualizar();
void Draw(sf::RenderWindow &window);
void Mover(char e);
void detectarColisiones();
protected:
};
#endif