From 6d84240c6736cfe22db3837296af8a9228aaeebb Mon Sep 17 00:00:00 2001 From: Bluwww Date: Mon, 24 Nov 2025 14:38:41 +0700 Subject: [PATCH] Update JS --- Script.js | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/Script.js b/Script.js index 3d606b0..59ed2ca 100644 --- a/Script.js +++ b/Script.js @@ -5,6 +5,14 @@ var canvasHeight = 650; var c = undefined var ctx = undefined +var game = { + level: 1, + speed: 1, + gameOver: false, + frames: 0, + timer: 0, +} + window.onload = function () { init() } @@ -21,21 +29,27 @@ function keyDownPressed(e){ } -function keyDownPressed(e){ - +function keyUpPressed(e){ + } -function clearGame(){ - ctx.save(); - ctx.fillStyle = 'white'; - ctx.fillReact(100, 100, 100, 100); - ctx.fill(); - ctx.restore(); +function clearGame() { + ctx.clearRect(0, 0, canvasWidth, canvasHeight); +} + +function updateGame() { + + + game.frames++; +} + +function drawGame() { + } function gameLoop(timestamp){ - clearGame(); - updateGame(); - drawGame(); - window.requestAnimationFrame(gameLoop); + clearGame(); + updateGame(); + drawGame(); + window.requestAnimationFrame(gameLoop); } \ No newline at end of file