feat: implement pixel-based spaceship animation with 100ms movement duration

Refactor spaceship positioning from column-based to pixel-based coordinates
with time-based interpolation, enabling smooth animation to letter positions
in exactly 100ms regardless of distance. Fixes coordinate mismatch that
prevented spaceship from moving to spawned letters.
This commit is contained in:
2025-11-03 22:22:11 +00:00
parent 5a0d8b5221
commit aff5ccecbf
5 changed files with 77 additions and 21 deletions
+2 -1
View File
@@ -21,11 +21,12 @@ export function useGameStatus(onGameLoopTick?: (deltaTime: number, letters: Fall
if (currentTime - lastSpawnRef.current > SPAWN_INTERVAL && lettersRef.current.length < MAX_ACTIVE_LETTERS) {
const randomLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26)); // A-Z
const randomX = Math.random() * 800;
const randomY = Math.random() * 150; // Between 0-150 (top half of screen)
const newLetter: FallingLetter = {
id: `${currentTime}-${randomX}`,
letter: randomLetter,
x: randomX,
y: 0,
y: randomY,
};
lettersRef.current.push(newLetter);
lastSpawnRef.current = currentTime;