Skyfall was designed around a mouse-driven crosshair, but a large share of its traffic plays on a phone with a thumb instead of a cursor. Rather than writing a second, parallel control scheme for touchscreens, the game funnels every kind of pointer — mouse, trackpad, or finger — through one shared function that converts whatever event just fired into a plain x/y coordinate on the canvas.
Mouse events and touch events describe position completely differently. A mouse event has clientX/clientY sitting right on it; a touch event buries the same information inside a touches array, because a touchscreen can, in principle, report several fingers at once. Skyfall only ever cares about the first one, so its position helper checks whether the incoming event has a touches array and, if so, reads the first entry's coordinates instead of the event's own — then subtracts the canvas's on-screen offset either way. Everything downstream of that one function — the crosshair, the hit test, the shot itself — has no idea whether it was fed a click or a tap.
On desktop, moving the mouse alone is enough to draw the crosshair where you're aiming; a separate mouse-down is what actually fires. Touch doesn't get that luxury — there's no "hover" state on a touchscreen, so the very first contact has to both position the crosshair and take the shot in the same instant. That's why touchstart both updates the aim position and calls the shot handler directly, while mousemove and mousedown stay split across two listeners. It's a small asymmetry in the code that exists purely because the two input types physically can't behave the same way.
When a finger lifts, the crosshair is pushed off-canvas rather than left hanging in its last position, the same way it disappears when a mouse leaves the canvas area. Leaving a static crosshair frozen mid-screen after a tap ended up looking like a rendering bug in early testing, so touchend clears it explicitly.
preventDefault(): without it, a fast series of taps on some mobile browsers can be interpreted as a double-tap-to-zoom gesture, or scroll the page out from under the canvas mid-round. Blocking the default touch behavior on the canvas keeps every tap purely a shot, with no accidental page zoom breaking your aim.
The point of unifying the two input paths isn't only less code to maintain — it's that a player on a phone and a player on a laptop are, mechanically, playing the identical hit-detection logic. There's no separate "touch hitbox" that's more forgiving or less forgiving than the mouse one; both feed the same coordinates into the same collision check. Whatever balance decisions went into bird sizes and reaction windows apply equally regardless of how you're aiming.