Add files via upload

This commit is contained in:
Daniel
2024-01-17 21:53:56 +02:00
committed by GitHub
parent 1c39199cc3
commit 7e04c3a9ef
8 changed files with 101 additions and 25 deletions

33
Particle.pde Normal file
View File

@@ -0,0 +1,33 @@
class Particle {
float x, y, z;
float speed;
color col;
float permOffset;
float offset = 0;
Block block;
Particle(float x, float y, float z, Block block, float speed, float treeSize) {
this.x = x;
this.y = y;
this.z = z;
this.block = block;
this.speed = speed;
this.permOffset = -150 - treeSize;
}
void update() {
offset -= speed;
if (offset < -100) offset = 0;
}
void display(float posZ) {
pushMatrix();
translate(x, y, posZ + permOffset + offset);
fill(block.treeColor);
float scaleDown = map(offset, 0, -150, 1, 10);
box(10/scaleDown, 8/scaleDown, 8/scaleDown);
scale(offset);
popMatrix();
update();
}
}