Add particle rotation
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user