end of level particle effect

This commit is contained in:
alexander.biryukov committed 2018-04-03 14:47:08 +05:00
1 parent 6bd38df453
commit c97c179199
13 files changed
+809 -72

No files matched your search

+11 -15
View File
@@ -20,7 +20,7 @@ const float CONST_TIMER_LOADING = 150.f;
const float CONST_PAUSE_APPEAR_TIME = 150.f;
const float CONST_FINISH_FREEZE_TIME = 1000.f;
const float CONST_FINISH_FREEZE_TIME = 4000.f; // 1000.f
const float CONST_FINISHING_TIME = 250.f;
const float CONST_BALL_VELOCITY = 200.f;
@@ -324,9 +324,7 @@ void TBall::ReflectToLeft()
{
*SE::Console << "TBall::ReflectToLeft";
Application->lsparkler.setCoords({Pos(0),Pos(1),0});
Application->lsparkler.stopSpawn();
Application->lsparkler.startSpawn();
Application->hitSpark("left",Pos);
if (Velocity(0) > 0.f)
{
@@ -338,9 +336,7 @@ void TBall::ReflectToRight()
{
*SE::Console << "TBall::ReflectToRight";
Application->rsparkler.setCoords({ Pos(0),Pos(1),0 });
Application->rsparkler.stopSpawn();
Application->rsparkler.startSpawn();
Application->hitSpark("right", Pos);
if (Velocity(0) < 0.f)
{
@@ -352,9 +348,7 @@ void TBall::ReflectToUp()
{
*SE::Console << "TBall::ReflectToUp";
Application->tsparkler.setCoords({ Pos(0),Pos(1),0 });
Application->tsparkler.stopSpawn();
Application->tsparkler.startSpawn();
Application->hitSpark("up", Pos);
if (Velocity(1) < 0.f)
{
@@ -366,9 +360,7 @@ void TBall::ReflectToDown()
{
*SE::Console << "TBall::ReflectToDown";
Application->bsparkler.setCoords({ Pos(0),Pos(1),0 });
Application->bsparkler.stopSpawn();
Application->bsparkler.startSpawn();
Application->hitSpark("down", Pos);
if (Velocity(1) > 0.f)
{
@@ -574,7 +566,7 @@ bool TGameLevel::TapInBackBtnArea(const Vector2f& pos)
void TGameLevel::SetFinishFreeze()
{
*SE::Console << "TGameLevel::SetFinishFreeze";
StateTimer = CONST_FINISH_FREEZE_TIME;
StateTimer = CONST_FINISH_FREEZE_TIME; // Firework timeline timer
LevelState = CONST_LEVELSTATE_FINISH_FREEZE;
@@ -858,6 +850,8 @@ void TGameLevel::Draw()
iBonus->Draw();
}
Application->EffectsDraw();
DrawBallInstancingList();
Renderer->PopShader();
@@ -1201,6 +1195,8 @@ void TGameLevel::Update(size_t dt)
if (noMoreBlocks && LevelState != CONST_LEVELSTATE_FINISH_FREEZE)
{
Application->fireworkEffect(); // Firework start
Application->OpenNextLevel();
Application->MarkSetGameLevelPause();
SetFinishFreeze();
@@ -1695,4 +1691,4 @@ void TGameLevel::TryGoToMenu()
{
OutScale = 1.f;
}
}
}
+2 -2
View File
@@ -17,8 +17,8 @@ const int CONST_BRICKSTATE_APPEAR = 0;
const float CONST_BRICK_DISAPPEAR_TIME = 200.f;
const float CONST_BRICK_APPEAR_TIME = 200.f;
const int CONST_BRICKMATRIX_WIDTH = 12;
const int CONST_BRICKMATRIX_HEIGHT = 13;
const int CONST_BRICKMATRIX_WIDTH = 12; // 12
const int CONST_BRICKMATRIX_HEIGHT = 13; // 13
const float CONST_BRICK_WIDTH = 38.65f;
const float CONST_BRICK_HEIGHT = 0.5f*CONST_BRICK_WIDTH;
const float CONST_BRICK_SHIFT_X = 8.2f;
+37 -1
View File
@@ -338,7 +338,6 @@ void TMyApplication::InnerDraw()
OnDrawSignal();
EffectsDraw();
}
@@ -582,6 +581,11 @@ void TMyApplication::EffectsInit() {
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
bsparkler.parse(JSONsource);
bsparkler.load();
// Level finish
effectJSON = JSONconfig.get<std::string>("lvlFinish");
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
lvlFirework.parse(JSONsource);
lvlFirework.load();
float width = Renderer->GetScreenWidth();
float height = Renderer->GetScreenHeight();
@@ -590,6 +594,7 @@ void TMyApplication::EffectsInit() {
rsparkler.setCoords({ width / 2, height / 2, 0 });
tsparkler.setCoords({ width / 2, height / 2, 0 });
bsparkler.setCoords({ width / 2, height / 2, 0 });
lvlFirework.setCoords({ width / 2, 0, 0 });
}
void TMyApplication::EffectsUpdate(size_t dt) {
@@ -597,10 +602,41 @@ void TMyApplication::EffectsUpdate(size_t dt) {
rsparkler.update(dt / 1000.f);
tsparkler.update(dt / 1000.f);
bsparkler.update(dt / 1000.f);
lvlFirework.update(dt / 1000.f);
}
void TMyApplication::EffectsDraw() {
lsparkler.draw();
rsparkler.draw();
tsparkler.draw();
bsparkler.draw();
lvlFirework.draw();
}
void TMyApplication::hitSpark(std::string direct,Vector2f Pos) {
if (direct == "left") {
lsparkler.setCoords({ Pos(0),Pos(1),0 });
lsparkler.stopSpawn();
lsparkler.startSpawn();
}
if (direct == "right") {
rsparkler.setCoords({ Pos(0),Pos(1),0 });
rsparkler.stopSpawn();
rsparkler.startSpawn();
}
if (direct == "up") {
tsparkler.setCoords({ Pos(0),Pos(1),0 });
tsparkler.stopSpawn();
tsparkler.startSpawn();
}
if (direct == "down") {
bsparkler.setCoords({ Pos(0),Pos(1),0 });
bsparkler.stopSpawn();
bsparkler.startSpawn();
}
}
void TMyApplication::fireworkEffect() {
lvlFirework.stopSpawn();
lvlFirework.startSpawn();
}
+9 -8
View File
@@ -92,6 +92,9 @@ protected:
int levelScreenHeight;
float levelScreenRatio = 1.6;
ParticleEffect lsparkler, rsparkler, tsparkler, bsparkler; // Different directed reflection effects
ParticleEffect lvlFirework; // Level finished effect
TGameMenu Menu;
TGameLevel GameLevel;
TGameCredits GameCredits;
@@ -124,8 +127,6 @@ protected:
public:
bool Loaded;
ParticleEffect lsparkler, rsparkler, tsparkler, bsparkler; // Diffrent directed reflection effects
TMyApplication() : TApplication(), Loaded(false), Inited(false) { }
virtual void InnerInit();
@@ -142,9 +143,15 @@ public:
void GoFromCreditsToMenu();
void MarkSetGameLevelPause();
void MarkReleaseGameLevelPause();
// Effects -------
void EffectsUpdate(size_t dt);
void EffectsDraw();
void fireworkEffect();
void hitSpark(std::string direct, Vector2f Pos);
// Effects -------
void OpenNextLevel();
bool IsLoaded();
@@ -171,10 +178,4 @@ public:
extern TMyApplication* Application;
class TMySalmonRenderer : public TSalmonRenderer
{
public:
void DrawRect(const Vector2f& p1, const Vector2f& p2);
};
#endif
-5
View File
@@ -172,11 +172,6 @@ void TGameMenu::OnTapUp(Vector2f pos)
{
*SE::Console << "TGameMenu::OnTapUp";
HoldToTap = false;
std::fstream tapLog;
tapLog.open("tapLog.txt", std::ios::app);
tapLog << "Tapped up:: " << pos(0) << " " << pos(1) << endl;
tapLog.close();
if (SelectedGame != -1)
{