Michael Tang 1 rok temu
rodzic
commit
cb84b1ddcf
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      orange/L6-build-shooting-hoops.js

+ 3 - 1
orange/L6-build-shooting-hoops.js

@@ -32,7 +32,9 @@ ballSprite.setPosition(randint(10, screen.width - 10), playerSprite.y)
 
 // game mechanics
 forever(function () {
-	
+    if (playerSprite.overlapsWith(ballSprite) && controller.A.isPressed()) {
+        ballSprite.follow(hoopSprite, randint(50, 100))
+    }
 })
 
 // on countdown end