diff --git a/web/game.js b/web/game.js index 0e1c0ac..fb954b4 100644 --- a/web/game.js +++ b/web/game.js @@ -142,7 +142,6 @@ async function Movementloop() { function shoot(directionX, directionY) { shot = true; - circle(500, 100, 50); if (!projectile) { // Set the initial position of the projectile to the player's position @@ -159,16 +158,31 @@ function shoot(directionX, directionY) { direction.normalize(); direction.mult(shotSpeed); projectile.add(direction); + + if (projectile.dist(target) >= 1) { + shot = false; + // projectile = null; + } } // the function draw() is called every frame function draw() { keyPressed(); + // draw background background(0, 0, 0, 100); + // draw player + fill(0, 255, 255) circle(constrain(playerPosX, 0 + radius, width - radius), constrain(playerPosY, 0 + radius, height - radius), playerSize); + + // draw boss + fill(255,165,0) + circle(500, 100, 50); + // square(squareX,squareY,squareSize); // object_collision(); - - shoot(playerPosX, playerPosY); + + if (shot == false) { + shoot(playerPosX, playerPosY); + } } \ No newline at end of file