summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--themes/LeafParticleRender.cpp12
-rw-r--r--themes/LeafParticleRender.h1
-rwxr-xr-xthemes/dist/output.wasmbin55929 -> 56705 bytes
3 files changed, 13 insertions, 0 deletions
diff --git a/themes/LeafParticleRender.cpp b/themes/LeafParticleRender.cpp
index c006c06..fd35888 100644
--- a/themes/LeafParticleRender.cpp
+++ b/themes/LeafParticleRender.cpp
@@ -86,7 +86,17 @@ void LeafParticleRender::update(float32 dtSeconds) {
}
if (updateDataItem->onGround) {
+ updateDataItem->timeFallingSeconds += dtSeconds;
+ if (updateDataItem->timeFallingSeconds >= updateDataItem->resetTime) {
+ updateDataItem->onGround = false;
+ updateDataItem->isFalling = false;
+ updateDataItem->color.w = 1.f;
+ }
+ else {
+ updateDataItem->color.w = 1.f - (updateDataItem->timeFallingSeconds / updateDataItem->resetTime);
+ updateLeaf(updateDataItem->vertexPtr, updateDataItem->fallPosition, updateDataItem->color);
+ }
}
else if (updateDataItem->isFalling) {
updateDataItem->timeFallingSeconds += dtSeconds;
@@ -96,6 +106,8 @@ void LeafParticleRender::update(float32 dtSeconds) {
if (updateDataItem->fallPosition.y <= 25.f) { // TODO: Hardcoded ground for now
updateDataItem->fallPosition.y = 25.f;
updateDataItem->onGround = true;
+ updateDataItem->timeFallingSeconds = 0;
+ updateDataItem->resetTime = randomFloatBetween(2.f, 5.f); // TODO: Hardcoded reset interval
}
updateLeaf(updateDataItem->vertexPtr, updateDataItem->fallPosition, updateDataItem->color);
}
diff --git a/themes/LeafParticleRender.h b/themes/LeafParticleRender.h
index 0627322..9f5d5f4 100644
--- a/themes/LeafParticleRender.h
+++ b/themes/LeafParticleRender.h
@@ -24,6 +24,7 @@ struct LeafParticleUpdateData {
float32 fallHorizontalFrequency;
bool onGround = false;
+ float32 resetTime = 0.f;
Renderer2dVertex* vertexPtr = NULL;
};
diff --git a/themes/dist/output.wasm b/themes/dist/output.wasm
index d341f4f..f994bca 100755
--- a/themes/dist/output.wasm
+++ b/themes/dist/output.wasm
Binary files differ