-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDropToTheBeatGame.h
66 lines (57 loc) · 1.77 KB
/
DropToTheBeatGame.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
/*****************************************************************//**
* \file DropToTheBeatGame.h
* \brief Game mode that requires player to
* hard drop when there is a beat to keep the combo.
*
* \author Chau Le
* \date July 2021
*********************************************************************/
#pragma once
#ifndef DROP_TO_BEAT_H
#define DROP_TO_BEAT_H
#include "GameBase.h"
#include "Enums.h"
#include "Button.h"
#include "ResultScreen.h"
#include "Utils.h"
#include "GravityButton.h"
/**
* Drop to the beat game mode.
*/
class DropToTheBeatGame :
public GameBase
{
private:
std::list<int> beatsTime;
std::list<int> beatsTimeOriginal;
int combo = 0;
int maxCombo = 0;
bool beatPressed = false;
int bonus = 0;
int beatAccuracyCount[3] = {0,0,0}; // miss || too late, almost, hit
int accuracyTimer = 0;
int health = 100; // 0 <= health <= 100
int healthCounter = 0; // if reaches 60, health +=1 (every second, health +=1_
int gravityCharge = 0; // if gravity charge is 100, the gravity can be activated
int threshold = 0;
GravityButton *gravityButton;
void loadStaticAssets();
public:
DropToTheBeatGame(StateManager &stateManager, std::string folderPath);
~DropToTheBeatGame();
std::string comboString="";
HitType hitType = HitType::INVALID; // miss=0, almost=1, hit=2,
// Game Base functions
//*****************************************************
void tick(const float & dt, sf::RenderWindow& window);
void keyEvent(const float & dt, sf::Event event);
void mouseEvent(const float & dt, sf::RenderWindow& window, sf::Event event);
void restart();
void render(sf::RenderWindow& window);
void renderBeatSignal(sf::RenderWindow& window);
private:
void checkDropOnBeat(int beatTime);
void gameOver();
void activateGravity(int beatTime);
};
#endif