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
+4 -2
View File
@@ -36,9 +36,11 @@ export function useBoard() {
ctx.fillStyle = "#000";
ctx.fillRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
// Draw spaceship at player position
const spaceshipX = (playerPosition.x / 10) * CANVAS_WIDTH + CANVAS_WIDTH / 20;
// Draw spaceship at player position (already in pixels)
const spaceshipX = playerPosition.x;
const spaceshipY = SPACESHIP_Y;
console.log('Rendering spaceship at X:', spaceshipX);
// Spaceship body (triangle pointing up)
ctx.fillStyle = "#00ff00";