particle hit effect
This commit is contained in:
parent
2b875dfc2d
commit
6bd38df453
@ -1,3 +1,6 @@
|
||||
{
|
||||
"effect": "effects/ball-hit-spark.json"
|
||||
"lefteffect": "effects/ball-hit-spark-l.json",
|
||||
"righteffect": "effects/ball-hit-spark-r.json",
|
||||
"topeffect": "effects/ball-hit-spark-t.json",
|
||||
"boteffect": "effects/ball-hit-spark-b.json"
|
||||
}
|
85
assets/effects/ball-hit-spark-b.json
Executable file
85
assets/effects/ball-hit-spark-b.json
Executable file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"name": "Simple Sparkler",
|
||||
|
||||
"emitters":
|
||||
[
|
||||
{
|
||||
"name": "Spark",
|
||||
|
||||
"maxParticles": 11,
|
||||
"preloading": 11,
|
||||
|
||||
"texturePath": "textures/spark-white.png",
|
||||
"textureSize": [ 10, 10 ],
|
||||
|
||||
"hasInertion": "false",
|
||||
"gravity": [0, 0, 0],
|
||||
|
||||
"spawnRange_system": "PARTICLE_EFFECT",
|
||||
|
||||
"spawnTotal":
|
||||
{
|
||||
"interpolation": "LINEAR_SPLINE",
|
||||
"timelineType": "LIMITED",
|
||||
"timeline":
|
||||
[
|
||||
{
|
||||
"t": 0.000,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"t": 0.01,
|
||||
"value": 20
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"spawnRange":
|
||||
{
|
||||
"value": [ 0, 270, 0, 175 ]
|
||||
},
|
||||
|
||||
"lifeTime":
|
||||
{
|
||||
"min": 0.02,
|
||||
"max": 0.15
|
||||
},
|
||||
|
||||
"coords_system": "PARTICLE_BIRTH",
|
||||
"coords_axis_system": "PARTICLE_BIRTH",
|
||||
"rotation_system": "PARTICLE_EFFECT",
|
||||
|
||||
"coords":
|
||||
{
|
||||
"interpolation": "CUBIC_SPLINE",
|
||||
"timeline":
|
||||
[
|
||||
{
|
||||
"t": 0.000,
|
||||
"value": [ 10, 0, 0 ]
|
||||
},
|
||||
{
|
||||
"t": 0.15,
|
||||
"min": [ 60, 0, 0 ],
|
||||
"max": [ 100, 0, 0 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"rotation":
|
||||
{
|
||||
"value": [ 0, 0, 0 ]
|
||||
},
|
||||
|
||||
"scale":
|
||||
{
|
||||
"value": 0.5
|
||||
},
|
||||
|
||||
"color":
|
||||
{
|
||||
"value": [ 1, 1, 0, 1 ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
85
assets/effects/ball-hit-spark-l.json
Executable file
85
assets/effects/ball-hit-spark-l.json
Executable file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"name": "Simple Sparkler",
|
||||
|
||||
"emitters":
|
||||
[
|
||||
{
|
||||
"name": "Spark",
|
||||
|
||||
"maxParticles": 11,
|
||||
"preloading": 11,
|
||||
|
||||
"texturePath": "textures/spark-white.png",
|
||||
"textureSize": [ 10, 10 ],
|
||||
|
||||
"hasInertion": "false",
|
||||
"gravity": [0, 0, 0],
|
||||
|
||||
"spawnRange_system": "PARTICLE_EFFECT",
|
||||
|
||||
"spawnTotal":
|
||||
{
|
||||
"interpolation": "LINEAR_SPLINE",
|
||||
"timelineType": "LIMITED",
|
||||
"timeline":
|
||||
[
|
||||
{
|
||||
"t": 0.000,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"t": 0.01,
|
||||
"value": 20
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"spawnRange":
|
||||
{
|
||||
"value": [ 0, 180, 0, 175 ]
|
||||
},
|
||||
|
||||
"lifeTime":
|
||||
{
|
||||
"min": 0.02,
|
||||
"max": 0.15
|
||||
},
|
||||
|
||||
"coords_system": "PARTICLE_BIRTH",
|
||||
"coords_axis_system": "PARTICLE_BIRTH",
|
||||
"rotation_system": "PARTICLE_EFFECT",
|
||||
|
||||
"coords":
|
||||
{
|
||||
"interpolation": "CUBIC_SPLINE",
|
||||
"timeline":
|
||||
[
|
||||
{
|
||||
"t": 0.000,
|
||||
"value": [ 10, 0, 0 ]
|
||||
},
|
||||
{
|
||||
"t": 0.15,
|
||||
"min": [ 60, 0, 0 ],
|
||||
"max": [ 100, 0, 0 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"rotation":
|
||||
{
|
||||
"value": [ 0, 0, 0 ]
|
||||
},
|
||||
|
||||
"scale":
|
||||
{
|
||||
"value": 0.5
|
||||
},
|
||||
|
||||
"color":
|
||||
{
|
||||
"value": [ 1, 1, 0, 1 ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -6,8 +6,8 @@
|
||||
{
|
||||
"name": "Spark",
|
||||
|
||||
"maxParticles": 5,
|
||||
"preloading": 5,
|
||||
"maxParticles": 11,
|
||||
"preloading": 11,
|
||||
|
||||
"texturePath": "textures/spark-white.png",
|
||||
"textureSize": [ 10, 10 ],
|
||||
@ -28,21 +28,21 @@
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"t": 0.050,
|
||||
"value": 50
|
||||
"t": 0.01,
|
||||
"value": 20
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"spawnRange":
|
||||
{
|
||||
"value": [ 0, 0, 0, 170 ]
|
||||
"value": [ 0, 0, 0, 175 ]
|
||||
},
|
||||
|
||||
"lifeTime":
|
||||
{
|
||||
"min": 0.05,
|
||||
"max": 0.1
|
||||
"min": 0.02,
|
||||
"max": 0.15
|
||||
},
|
||||
|
||||
"coords_system": "PARTICLE_BIRTH",
|
||||
@ -51,17 +51,17 @@
|
||||
|
||||
"coords":
|
||||
{
|
||||
"interpolation": "LINEAR_SPLINE",
|
||||
"interpolation": "CUBIC_SPLINE",
|
||||
"timeline":
|
||||
[
|
||||
{
|
||||
"t": 0.000,
|
||||
"value": [ 0, 0, 0 ]
|
||||
"value": [ 10, 0, 0 ]
|
||||
},
|
||||
{
|
||||
"t": 2,
|
||||
"min": [ 300, 0, 0 ],
|
||||
"max": [ 600, 0, 0 ]
|
||||
"t": 0.15,
|
||||
"min": [ 60, 0, 0 ],
|
||||
"max": [ 100, 0, 0 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -73,7 +73,7 @@
|
||||
|
||||
"scale":
|
||||
{
|
||||
"value": 1
|
||||
"value": 0.5
|
||||
},
|
||||
|
||||
"color":
|
85
assets/effects/ball-hit-spark-t.json
Executable file
85
assets/effects/ball-hit-spark-t.json
Executable file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"name": "Simple Sparkler",
|
||||
|
||||
"emitters":
|
||||
[
|
||||
{
|
||||
"name": "Spark",
|
||||
|
||||
"maxParticles": 11,
|
||||
"preloading": 11,
|
||||
|
||||
"texturePath": "textures/spark-white.png",
|
||||
"textureSize": [ 10, 10 ],
|
||||
|
||||
"hasInertion": "false",
|
||||
"gravity": [0, 0, 0],
|
||||
|
||||
"spawnRange_system": "PARTICLE_EFFECT",
|
||||
|
||||
"spawnTotal":
|
||||
{
|
||||
"interpolation": "LINEAR_SPLINE",
|
||||
"timelineType": "LIMITED",
|
||||
"timeline":
|
||||
[
|
||||
{
|
||||
"t": 0.000,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"t": 0.01,
|
||||
"value": 20
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"spawnRange":
|
||||
{
|
||||
"value": [ 0, 90, 0, 175 ]
|
||||
},
|
||||
|
||||
"lifeTime":
|
||||
{
|
||||
"min": 0.02,
|
||||
"max": 0.15
|
||||
},
|
||||
|
||||
"coords_system": "PARTICLE_BIRTH",
|
||||
"coords_axis_system": "PARTICLE_BIRTH",
|
||||
"rotation_system": "PARTICLE_EFFECT",
|
||||
|
||||
"coords":
|
||||
{
|
||||
"interpolation": "CUBIC_SPLINE",
|
||||
"timeline":
|
||||
[
|
||||
{
|
||||
"t": 0.000,
|
||||
"value": [ 10, 0, 0 ]
|
||||
},
|
||||
{
|
||||
"t": 0.15,
|
||||
"min": [ 60, 0, 0 ],
|
||||
"max": [ 100, 0, 0 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"rotation":
|
||||
{
|
||||
"value": [ 0, 0, 0 ]
|
||||
},
|
||||
|
||||
"scale":
|
||||
{
|
||||
"value": 0.5
|
||||
},
|
||||
|
||||
"color":
|
||||
{
|
||||
"value": [ 1, 1, 0, 1 ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -323,6 +323,11 @@ void TBall::Go()
|
||||
void TBall::ReflectToLeft()
|
||||
{
|
||||
*SE::Console << "TBall::ReflectToLeft";
|
||||
|
||||
Application->lsparkler.setCoords({Pos(0),Pos(1),0});
|
||||
Application->lsparkler.stopSpawn();
|
||||
Application->lsparkler.startSpawn();
|
||||
|
||||
if (Velocity(0) > 0.f)
|
||||
{
|
||||
Velocity(0) = - Velocity(0);
|
||||
@ -332,6 +337,11 @@ void TBall::ReflectToLeft()
|
||||
void TBall::ReflectToRight()
|
||||
{
|
||||
*SE::Console << "TBall::ReflectToRight";
|
||||
|
||||
Application->rsparkler.setCoords({ Pos(0),Pos(1),0 });
|
||||
Application->rsparkler.stopSpawn();
|
||||
Application->rsparkler.startSpawn();
|
||||
|
||||
if (Velocity(0) < 0.f)
|
||||
{
|
||||
Velocity(0) = - Velocity(0);
|
||||
@ -341,6 +351,11 @@ void TBall::ReflectToRight()
|
||||
void TBall::ReflectToUp()
|
||||
{
|
||||
*SE::Console << "TBall::ReflectToUp";
|
||||
|
||||
Application->tsparkler.setCoords({ Pos(0),Pos(1),0 });
|
||||
Application->tsparkler.stopSpawn();
|
||||
Application->tsparkler.startSpawn();
|
||||
|
||||
if (Velocity(1) < 0.f)
|
||||
{
|
||||
Velocity(1) = - Velocity(1);
|
||||
@ -350,6 +365,11 @@ void TBall::ReflectToUp()
|
||||
void TBall::ReflectToDown()
|
||||
{
|
||||
*SE::Console << "TBall::ReflectToDown";
|
||||
|
||||
Application->bsparkler.setCoords({ Pos(0),Pos(1),0 });
|
||||
Application->bsparkler.stopSpawn();
|
||||
Application->bsparkler.startSpawn();
|
||||
|
||||
if (Velocity(1) > 0.f)
|
||||
{
|
||||
Velocity(1) = - Velocity(1);
|
||||
|
@ -85,11 +85,19 @@ void TMyApplication::InnerInit()
|
||||
GameState = CONST_GAMESTATE_PRELOADING;
|
||||
StateTimer = 0.f;
|
||||
|
||||
|
||||
/*
|
||||
ResourceManager->ShaderManager.AddShader("DefaultShader", "shader1vertex.txt", "shader1fragment.txt");
|
||||
ResourceManager->ShaderManager.AddShader("FrameShader", "frameshader_vertex.txt", "frameshader_fragment.txt");
|
||||
ResourceManager->ShaderManager.AddShader("BrickShader", "brickshader_vertex.txt", "brickshader_fragment.txt");
|
||||
Renderer->PushShader("DefaultShader");
|
||||
*/
|
||||
|
||||
ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/texture-shader.vertex", "shaders/texture-shader.fragment");
|
||||
ResourceManager->ShaderManager.AddShader("ColorShader", "shaders/color-shader.vertex", "shaders/color-shader.fragment");
|
||||
ResourceManager->ShaderManager.AddShader("FrameShader", "shaders/frameshader_vertex.txt", "shaders/frameshader_fragment.txt");
|
||||
ResourceManager->ShaderManager.AddShader("BrickShader", "shaders/brickshader_vertex.txt", "shaders/brickshader_fragment.txt");
|
||||
ResourceManager->ShaderManager.AddShader(ParticleEffect::PARTICLE_SHADER, "shaders/particle-shader.vertex", "shaders/particle-shader.fragment");
|
||||
Renderer->PushShader("DefaultShader");
|
||||
|
||||
ResourceManager->TexList.AddTexture(CONST_LOADING_BACKGROUND_BLACK + ".png", CONST_LOADING_BACKGROUND_BLACK);
|
||||
ResourceManager->TexList.AddTexture(CONST_LOADING_TEXTURE + ".png", CONST_LOADING_TEXTURE);
|
||||
@ -108,6 +116,7 @@ void TMyApplication::InnerInit()
|
||||
Renderer->SetFullScreenViewport();
|
||||
Application->SetGameLevelScreenScale();
|
||||
//GameLevel.SetLevelScale();
|
||||
EffectsInit();
|
||||
|
||||
}
|
||||
|
||||
@ -327,10 +336,10 @@ void TMyApplication::InnerDraw()
|
||||
{
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
sparkler.draw();
|
||||
|
||||
OnDrawSignal();
|
||||
|
||||
EffectsDraw();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -376,6 +385,7 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
{
|
||||
*SE::Console << "3CONST_GAMESTATE_LEVEL";
|
||||
GameLevel.Update(dt);
|
||||
EffectsUpdate(dt);
|
||||
}
|
||||
else if (GameState == CONST_GAMESTATE_MENU)
|
||||
{
|
||||
@ -544,3 +554,53 @@ void TMyApplication::InnerOnMouseDown(TMouseState& mouseState) {
|
||||
void TMyApplication::InnerOnMouseMove(TMouseState& mouseState) {
|
||||
|
||||
}
|
||||
|
||||
void TMyApplication::EffectsInit() {
|
||||
|
||||
boost::property_tree::ptree JSONsource;
|
||||
boost::property_tree::ptree JSONconfig;
|
||||
std::string effectJSON;
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + "config.json", JSONconfig);
|
||||
|
||||
// LEFT
|
||||
effectJSON = JSONconfig.get<std::string>("lefteffect");
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
|
||||
lsparkler.parse(JSONsource); // parse JSON
|
||||
lsparkler.load(); // load textures
|
||||
// RIGHT
|
||||
effectJSON = JSONconfig.get<std::string>("righteffect");
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
|
||||
rsparkler.parse(JSONsource);
|
||||
rsparkler.load();
|
||||
// TOP
|
||||
effectJSON = JSONconfig.get<std::string>("topeffect");
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
|
||||
tsparkler.parse(JSONsource);
|
||||
tsparkler.load();
|
||||
// BOTTOM
|
||||
effectJSON = JSONconfig.get<std::string>("boteffect");
|
||||
boost::property_tree::json_parser::read_json(ST::PathToResources + effectJSON, JSONsource);
|
||||
bsparkler.parse(JSONsource);
|
||||
bsparkler.load();
|
||||
|
||||
float width = Renderer->GetScreenWidth();
|
||||
float height = Renderer->GetScreenHeight();
|
||||
|
||||
lsparkler.setCoords({ width / 2, height / 2, 0 });
|
||||
rsparkler.setCoords({ width / 2, height / 2, 0 });
|
||||
tsparkler.setCoords({ width / 2, height / 2, 0 });
|
||||
bsparkler.setCoords({ width / 2, height / 2, 0 });
|
||||
}
|
||||
|
||||
void TMyApplication::EffectsUpdate(size_t dt) {
|
||||
lsparkler.update(dt / 1000.f);
|
||||
rsparkler.update(dt / 1000.f);
|
||||
tsparkler.update(dt / 1000.f);
|
||||
bsparkler.update(dt / 1000.f);
|
||||
}
|
||||
void TMyApplication::EffectsDraw() {
|
||||
lsparkler.draw();
|
||||
rsparkler.draw();
|
||||
tsparkler.draw();
|
||||
bsparkler.draw();
|
||||
}
|
@ -114,15 +114,18 @@ protected:
|
||||
void ApplySignalsToCredits();
|
||||
void DisapplySignalsToCredits();
|
||||
|
||||
void EffectsInit();
|
||||
|
||||
// Mouse new methods
|
||||
virtual void InnerOnMouseDown(TMouseState& mouseState);
|
||||
virtual void InnerOnMouseMove(TMouseState& mouseState);
|
||||
|
||||
ParticleEffect sparkler;
|
||||
|
||||
public:
|
||||
bool Loaded;
|
||||
|
||||
ParticleEffect lsparkler, rsparkler, tsparkler, bsparkler; // Diffrent directed reflection effects
|
||||
|
||||
TMyApplication() : TApplication(), Loaded(false), Inited(false) { }
|
||||
|
||||
virtual void InnerInit();
|
||||
@ -139,6 +142,8 @@ public:
|
||||
void GoFromCreditsToMenu();
|
||||
void MarkSetGameLevelPause();
|
||||
void MarkReleaseGameLevelPause();
|
||||
void EffectsUpdate(size_t dt);
|
||||
void EffectsDraw();
|
||||
|
||||
void OpenNextLevel();
|
||||
|
||||
|
@ -35,3 +35,69 @@ Tapped up:: 277 135
|
||||
Tapped up:: 337 145
|
||||
Tapped up:: 274 106
|
||||
Tapped up:: 548 155
|
||||
Tapped up:: 341 161
|
||||
Tapped up:: 363 192
|
||||
Tapped up:: 356 166
|
||||
Tapped up:: 218 129
|
||||
Tapped up:: 214 188
|
||||
Tapped up:: 327 196
|
||||
Tapped up:: 523 185
|
||||
Tapped up:: 289 215
|
||||
Tapped up:: 306 113
|
||||
Tapped up:: 290 130
|
||||
Tapped up:: 274 125
|
||||
Tapped up:: 321 153
|
||||
Tapped up:: 261 129
|
||||
Tapped up:: 331 142
|
||||
Tapped up:: 298 126
|
||||
Tapped up:: 335 129
|
||||
Tapped up:: 289 165
|
||||
Tapped up:: 316 137
|
||||
Tapped up:: 366 197
|
||||
Tapped up:: 378 190
|
||||
Tapped up:: 173 97
|
||||
Tapped up:: 297 157
|
||||
Tapped up:: 234 109
|
||||
Tapped up:: 290 118
|
||||
Tapped up:: 321 190
|
||||
Tapped up:: 357 157
|
||||
Tapped up:: 333 180
|
||||
Tapped up:: 293 150
|
||||
Tapped up:: 254 174
|
||||
Tapped up:: 291 160
|
||||
Tapped up:: 345 154
|
||||
Tapped up:: 327 161
|
||||
Tapped up:: 313 101
|
||||
Tapped up:: 286 178
|
||||
Tapped up:: 341 102
|
||||
Tapped up:: 369 121
|
||||
Tapped up:: 253 203
|
||||
Tapped up:: 264 131
|
||||
Tapped up:: 298 166
|
||||
Tapped up:: 246 161
|
||||
Tapped up:: 257 146
|
||||
Tapped up:: 303 151
|
||||
Tapped up:: 338 144
|
||||
Tapped up:: 313 119
|
||||
Tapped up:: 327 129
|
||||
Tapped up:: 376 133
|
||||
Tapped up:: 353 117
|
||||
Tapped up:: 344 149
|
||||
Tapped up:: 311 128
|
||||
Tapped up:: 414 185
|
||||
Tapped up:: 352 141
|
||||
Tapped up:: 274 141
|
||||
Tapped up:: 326 156
|
||||
Tapped up:: 314 131
|
||||
Tapped up:: 330 149
|
||||
Tapped up:: 315 95
|
||||
Tapped up:: 319 110
|
||||
Tapped up:: 356 181
|
||||
Tapped up:: 286 101
|
||||
Tapped up:: 353 102
|
||||
Tapped up:: 344 145
|
||||
Tapped up:: 327 169
|
||||
Tapped up:: 259 95
|
||||
Tapped up:: 302 131
|
||||
Tapped up:: 215 153
|
||||
Tapped up:: 326 138
|
||||
|
Loading…
Reference in New Issue
Block a user