generated from sigonasr2/CPlusPlusProjectTemplate
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.9 KiB
50 lines
1.9 KiB
#ifndef METEOS_H
|
|
#define METEOS_H
|
|
#include "pixelGameEngine.h"
|
|
#include "Board.h"
|
|
#include <random>
|
|
#include "ComboOverlay.h"
|
|
|
|
class Meteos : public olc::PixelGameEngine{
|
|
public:
|
|
Meteos(){
|
|
sAppName="Meteos";
|
|
}
|
|
long frameTime=0;
|
|
const int BASE_SCORE = 60; //Cleared score is BASE_SCORE*combo.
|
|
const int MATCH_SCORE = 10; //Points earned when making a block match*combo.
|
|
const int BONUS_ATTACK_SCORE = 1000; //for every 10 blocks released at once, an extra 1000 BASE_SCORE is added.
|
|
float lastBlockLaunched=0.0f; //When enough time has passed, the attack is released to the opponent.
|
|
float blockLaunchWaitPeriod=3.0f;
|
|
int blocksInAttackQueue=0;
|
|
int accumulatedScore=0;
|
|
float lastBlockSpawn=0.0f;
|
|
float accumulatedTime=0.0f;
|
|
const float SCORE_DISPLAY_UPDATE_RATE=0.05f;
|
|
float lastScoreDisplayUpdate=0.0f;
|
|
std::uniform_int_distribution<> randBlockPos,coinFlip,comboOverlayOffset;
|
|
std::mt19937 gen;
|
|
Board gameBoard;
|
|
bool gameCanRun=true;
|
|
std::map<std::string,Renderable> SPRITES;
|
|
std::vector<ComboOverlay>comboDisplayList;
|
|
int score=0;
|
|
int displayTargetScore=0; //While technically the displayed score should be what the score actually is, if we're showing how many points we earn for a combo we want to delay adding it to our actual score display for flair and show a side bonus counter.
|
|
int displayScore=0;
|
|
bool OnUserCreate()override;
|
|
void updateGame(float fElapsedTime);
|
|
void handleInput();
|
|
void drawGame(float fElapsedTime,bool debugView);
|
|
bool OnUserUpdate(float fElapsedTime)override;
|
|
void spawnBlocks(float fElapsedTime);
|
|
void handleBlockGravity(float fElapsedTime);
|
|
void matchBlocks();
|
|
void matchFlyingBlockClumps();
|
|
void cleanupBlockClumps();
|
|
void matchGroundedBlocks();
|
|
void cleanupBlocks();
|
|
void handleWarningLevels(float fElapsedTime);
|
|
void validateSelectedBlock();
|
|
void handleComboAnimations();
|
|
};
|
|
#endif |