Add particle rotation

This commit is contained in:
2024-10-04 18:17:46 +02:00
parent de3bb1e9c7
commit 4c7f832eb0
4 changed files with 4 additions and 10 deletions
+1 -1
View File
@@ -206,7 +206,7 @@ function reveal_cell_cosmetic(cell) {
let x = cell.offsetLeft - cell.scrollLeft;
let y = cell.offsetTop - cell.scrollTop;
spawn_particle(x, y, (Math.random() * 2 - 1) / 16, -0.3, 0, 1, dummy_image, w, h);
spawn_particle(x, y, (Math.random() * 2 - 1) / 16, -0.3, 0, (Math.random() * 2 - 1) / 16, dummy_image, w, h);
}
// Shows the game won/over popup.
-1
View File
@@ -8,7 +8,6 @@
<canvas id="particle-canvas"></canvas>
<div id="main-menu">
<span id="game-title">Gravedigger</span>
<span id="subtitle">a CFPI-FPSI creation</span>
<div id="button-list">
</div>
</div>
+3 -3
View File
@@ -51,9 +51,9 @@ function update_particles(delta_time) {
particle.vel_y += 0.001 * delta_time;
// Render particle.
particle_ctx.save();
// particle_ctx.translate(-particle.width / 2, -particle.height / 2);
// particle_ctx.rotate(particle.rot * Math.PI / 180);
particle_ctx.drawImage(particle.img, particle.x, particle.y, particle.w, particle.h)
particle_ctx.translate(particle.x + particle.w / 2, particle.y + particle.h / 2);
particle_ctx.rotate(particle.rot * Math.PI / 180);
particle_ctx.drawImage(particle.img, -particle.w / 2, -particle.h / 2, particle.w, particle.h)
particle_ctx.restore();
}
}
-5
View File
@@ -68,11 +68,6 @@ body.popup-victory { #nextlevel { display: block; } }
span#game-title {
font-size: 3em;
margin: 16px;
margin-bottom: 0;
}
span#subtitle {
margin: 16px;
}
#button-list {