Splatter: Angry-Birds slingshot serve — pull back to toss, dotted-line aim, release fires

The touch serve drag now inverts: pull toward yourself to launch up-court.
The first pull past the deadzone starts the real toss animation (serveToss),
dragServe fires straight from the toss phase without banishing its own fresh
toss, and a held aim keeps the toss airborne instead of dropping. Render shows
an Angry-Birds dotted trajectory racket->target (red = zombie locked). Two-stage
tap serve, mid-rally re-toss/banish, and keyboard serve+arrow-aim unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wuwiandClaude Opus 4.8 committed 2026-07-17 22:56:22 +02:00
1 parent 6df0ddb00f
commit 013fe8152d
3 files changed
+31 -16

No files matched your search

+6 -3
View File
@@ -5,7 +5,7 @@
import { cv } from './dom.js';
import { audio } from './audio.js';
import { G, score } from './state.js';
import { keyPressed, dragServe, selectWeapon } from './gameplay.js';
import { keyPressed, dragServe, selectWeapon, serveToss } from './gameplay.js';
import { rackHit } from './render.js';
import { togglePanel } from './panel.js';
@@ -75,8 +75,11 @@ cv.addEventListener('touchmove', e => {
if (t.identifier !== stick.id) continue;
const dx = t.clientX - stick.x0, dy = t.clientY - stick.y0, dist = Math.hypot(dx, dy);
if (dist > DEAD) stick.moved = true;
if (stick.aimable) { // aiming, not steering: the reticle tracks the thumb (home = auto-target)
G.aim = dist > DEAD ? { fx: dx / dist, fy: dy / dist, mag: dist } : { fx: 0, fy: 0, mag: 0 };
if (stick.aimable) { // slingshot: PULL BACK, launch forward — aim is the inverse of the drag (home = auto-target)
if (dist > DEAD) {
if (!stick.tossed) { serveToss(); stick.tossed = true; } // the pull kicks off the toss animation
G.aim = { fx: -dx / dist, fy: -dy / dist, mag: dist };
} else G.aim = { fx: 0, fy: 0, mag: 0 };
continue;
}
const r = cv.getBoundingClientRect();