-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHero.h
85 lines (72 loc) · 1.63 KB
/
Hero.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
#pragma once
#ifndef HERO_H
#define HERO_H
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include "Drawable.h"
#include "Weapon.h"
#include "Animate.h"
#include "SpriteExt.h"
#include <vector>
class Hero : public Drawable
{
public:
static const int SPRITE_SIZE = 32; // 32 bo szerokosc tekstury
static sf::Vector2f myPosition; //hero position
static int currentWeapon;
static bool armor; //pancerz
static bool invincible; //niesmiertelnosc
private:
bool fire;
int SCREEN_WIDTH;
int SCREEN_HEIGHT;
int weaponType;
int numberOfWeapons;
float myDistanceToMouse;
float velocity;
float currentVelocity;
float direction;
sf::Key::Code keyUp;
sf::Key::Code keyDown;
sf::Key::Code keyLeft;
sf::Key::Code keyRight;
enum State{
UP,
DOWN,
RIGHT,
LEFT,
STAY
};
State ANIMATION_TYPE;
Animate **animate;
Animate **animate_armor;
Weapon **weapon;
SpriteExt Me;
SpriteExt Me_armor;
sf::Sprite invinc_effect;
sf::Image MyTexture;
sf::Image MyTexture_armor;
sf::String strMyPosition;
sf::Clock invinc_timer;
const sf::Input &steering;//Interakcja z otoczeniem
public:
Hero(const sf::Input &_steering,float _velocity = 2); //Konstruktor Bohatera
~Hero(void);
sf::Vector2f get_position(){return myPosition;}
void Display(sf::RenderWindow *window);
void UpdateSystem();
void EventHandling();
void Logic();
void Move();
void Shoot();
void GetEvent();
sf::Vector2f GetPosition();
void UpdatePosition();
void PutScreenSize(int _SCREEN_WIDTH, int _SCREEN_HEIGHT);
void UpdateCollision();
//
static void getHitByLaser();
//
void SetCamera(sf::View *View, sf::RenderWindow *window); //Ustawienie kamery
};
#endif