Spaces:
Running
Running
Bot commited on
Commit ·
292ab5d
1
Parent(s): ff24b60
feat: increase fireball size and speed
Browse files- static/main.js +4 -4
static/main.js
CHANGED
|
@@ -336,8 +336,8 @@ function processFireball(hands) {
|
|
| 336 |
const d = Math.hypot(c1.x - c2.x, c1.y - c2.y);
|
| 337 |
if (d < 0.3) {
|
| 338 |
chargeFrames++;
|
| 339 |
-
// Grow fireball up to
|
| 340 |
-
chargeRadius = Math.min(
|
| 341 |
chargePos = { x: (c1.x + c2.x) / 2 * W, y: (c1.y + c2.y) / 2 * H };
|
| 342 |
|
| 343 |
if (chargeFrames > 30 && throwCooldown === 0) {
|
|
@@ -345,7 +345,7 @@ function processFireball(hands) {
|
|
| 345 |
const v2 = getVelocity(c2, palmCenter(prevHands[1]));
|
| 346 |
if (v1.speed > 0.02 && v2.speed > 0.02) {
|
| 347 |
audio.play('fireball');
|
| 348 |
-
fireballs.push(new Fireball(chargePos.x, chargePos.y, (v1.vx+v2.vx)*W*0.5, (v1.vy+v2.vy)*H*0.5, 40));
|
| 349 |
chargeFrames = 0; throwCooldown = 30; chargeRadius = 0;
|
| 350 |
actionText = "🔥 MASSIVE FIREBALL";
|
| 351 |
}
|
|
@@ -360,7 +360,7 @@ function processFireball(hands) {
|
|
| 360 |
const v = getVelocity(c, palmCenter(prevHands[0]));
|
| 361 |
if (v.speed > 0.04 && throwCooldown === 0) {
|
| 362 |
audio.play('fireball');
|
| 363 |
-
fireballs.push(new Fireball(c.x*W, c.y*H, v.vx*W, v.vy*H,
|
| 364 |
throwCooldown = 20;
|
| 365 |
actionText = "🔥 THROW";
|
| 366 |
}
|
|
|
|
| 336 |
const d = Math.hypot(c1.x - c2.x, c1.y - c2.y);
|
| 337 |
if (d < 0.3) {
|
| 338 |
chargeFrames++;
|
| 339 |
+
// Grow fireball up to 300px radius to engulf hands in 5 seconds (300 frames)
|
| 340 |
+
chargeRadius = Math.min(300, chargeFrames * 1.0);
|
| 341 |
chargePos = { x: (c1.x + c2.x) / 2 * W, y: (c1.y + c2.y) / 2 * H };
|
| 342 |
|
| 343 |
if (chargeFrames > 30 && throwCooldown === 0) {
|
|
|
|
| 345 |
const v2 = getVelocity(c2, palmCenter(prevHands[1]));
|
| 346 |
if (v1.speed > 0.02 && v2.speed > 0.02) {
|
| 347 |
audio.play('fireball');
|
| 348 |
+
fireballs.push(new Fireball(chargePos.x, chargePos.y, (v1.vx+v2.vx)*W*0.5, (v1.vy+v2.vy)*H*0.5, Math.max(40, chargeRadius)));
|
| 349 |
chargeFrames = 0; throwCooldown = 30; chargeRadius = 0;
|
| 350 |
actionText = "🔥 MASSIVE FIREBALL";
|
| 351 |
}
|
|
|
|
| 360 |
const v = getVelocity(c, palmCenter(prevHands[0]));
|
| 361 |
if (v.speed > 0.04 && throwCooldown === 0) {
|
| 362 |
audio.play('fireball');
|
| 363 |
+
fireballs.push(new Fireball(c.x*W, c.y*H, v.vx*W, v.vy*H, 60));
|
| 364 |
throwCooldown = 20;
|
| 365 |
actionText = "🔥 THROW";
|
| 366 |
}
|