-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogic.h
87 lines (61 loc) · 2.1 KB
/
logic.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
#pragma once
#include <vector>
#include <iostream>
#include "player.h"
#include "gridmanager.h"
#include "levels.h"
#include "enemies.h"
#include <array>
#include <limits>
#include <cmath>
#include <random>
#include "items.h"
class Logic {
public:
Logic(Player& player, Enemies& enemies, Items& items);
const int gridWidth = 320; // Number of grid cells horizontally
const int gridHeight = 18; // Number of grid cells vertically
const int cellSize = 40; // Size of each grid cell in pixels
std::vector<sf::FloatRect> platformBounds;
void debugKeys();
float randNum(float start, float end);
void gravityZ();
void vJoy();
void gameOver();
void comboCounter();
void comboCounterReset();
void updatePlayerVelocity();
void updateEnemyVelocity();
void preCalculatePlatformPositions();
void playerDamaged();
void attackHitBoxManager();
void attackStart();
void attackEnd();
void playerLevelUp();
void weaponCollision();
void checkWeaponCollision(sf::RectangleShape weapon);
void itemCollision();
void itemCollisionWithLevel();
std::array<bool, 4> collisionSide(const std::vector<sf::FloatRect>& platformBounds);
int numberOfEnemiesKilled = 0;
bool restart = false;
bool gameover = false;
std::vector<std::vector<bool>> enemyCollisionSide();
void enemyCollisionWithSelf();
void enemiesRespawner();
void enemiesAI();
void enemyDamaged(int index, int attack);
void enemyWallBounce();
void itemRespawner(int index);
sf::Vector2f locatePlayerWithIndexV2(int index);
sf::Vector2f calculateDistances(int enemyIndex, const sf::FloatRect& platformBounds);
void enemyJump(int index);
sf::Vector2i getPlayerCell() const;
void logicMain();
private:
Player& player;
Enemies& enemies;
Items& items;
GridManager gridmanager;
Levels levels;
};