paddle-game/src/index.ts
2025-03-31 16:18:59 +02:00

15 lines
No EOL
545 B
TypeScript

import { initKeyboardInput } from './input';
import { canvas, setupCanvas } from './canvas';
import { createPaddle } from './objects/paddle';
import { initGame } from './game';
import { createBall } from './objects/ball';
// Setup canvas and initialize input
setupCanvas();
initKeyboardInput();
// Create paddle and start game
const paddle = createPaddle(canvas.width / 2, canvas.height - 200, "white", "Player");
const ball = createBall(canvas.width / 2, canvas.height / 2);
ball.velocityX = 200;
ball.velocityY = 200;
initGame(paddle, ball);