-
Notifications
You must be signed in to change notification settings - Fork 0
/
hero.h
67 lines (53 loc) · 1.56 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
#pragma once
#include <SFML/Graphics.hpp>
#include "declarations.h"
#include "loot.h"
#include "shot.h"
#include "view.h"
#include "sprites.h"
#include "level.h"
using namespace sf;
struct Hero
{
Vector2f pos;
Texture texture;
Sprite sprite;
Direction dir;
Direction dirLast;
int slotNo;
int nSlots; //number of slots in inventory
int health;
float currentFrame;
HeroState state;
bool isBeastAttack;
float beastTimer;
float lastAttackTime;
bool isAmmo;
float lastReloadTime;
bool isReloading;
int savedNeighbors;
int maxNeighbors;
bool isWeaponSwitch;
float shotLastTime;
Inventory item;
float damageResistance;
bool isSmashed; //for boss
float lastSmashTime;
bool isSoundShoot;
bool isSoundBeastAtttack;
bool isSoundLoot;
bool isSoundNpcSurvive;
bool isSoundTakeDamage;
bool isSoundEnemyExplosion;
bool isSoundNpcDeath;
};
void InitializeHero(Hero & hero);
void UpdateDirection(Hero & hero);
bool IsInventorySwitch(Hero & hero);
void UpdateInventory(Hero & hero, vector<Inventory> & inventoryList, float & time);
Inventory GetNewInventoryItem(Loot & loot, Sprite & items);
void CheckUsingItems(Hero & hero, vector<Inventory> & inventoryList, vector<Shot> & shotList, float & time, Sprite & sprite_shot, Sprite & sprite_grenade);
void UpdateHeroFrame(Hero & hero, float & time);
void DrawHero(RenderWindow & window, Sprite & hero);
void DrawText(RenderWindow & window, vector<Inventory> & inventoryList, Hero & hero, View & view, Text & text);
void CheckLoot(Hero & hero, vector<Loot> & lootList, vector<Inventory> & inventoryList, Sprite & items);