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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user