react-native-games 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +66 -0
- package/README.md +269 -0
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +391 -0
- package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js +293 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js.map +1 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +156 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js.map +1 -0
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js +227 -0
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js.map +1 -0
- package/lib/module/games/balloon-blaster/components/GameArea.js +42 -0
- package/lib/module/games/balloon-blaster/components/GameArea.js.map +1 -0
- package/lib/module/games/balloon-blaster/components/GameBackground.js +544 -0
- package/lib/module/games/balloon-blaster/components/GameBackground.js.map +1 -0
- package/lib/module/games/balloon-blaster/components/GameControls.js +229 -0
- package/lib/module/games/balloon-blaster/components/GameControls.js.map +1 -0
- package/lib/module/games/balloon-blaster/components/GameOverModal.js +133 -0
- package/lib/module/games/balloon-blaster/components/GameOverModal.js.map +1 -0
- package/lib/module/games/balloon-blaster/components/ParticleSystem.js +52 -0
- package/lib/module/games/balloon-blaster/components/ParticleSystem.js.map +1 -0
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js +119 -0
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/balloon-blaster/components/SliceTrail.js +58 -0
- package/lib/module/games/balloon-blaster/components/SliceTrail.js.map +1 -0
- package/lib/module/games/balloon-blaster/components/index.js +11 -0
- package/lib/module/games/balloon-blaster/components/index.js.map +1 -0
- package/lib/module/games/cat-popper/CatPopper.js +230 -0
- package/lib/module/games/cat-popper/CatPopper.js.map +1 -0
- package/lib/module/games/cat-popper/CatPopperService.js +100 -0
- package/lib/module/games/cat-popper/CatPopperService.js.map +1 -0
- package/lib/module/games/cat-popper/CatPopperStore.js +113 -0
- package/lib/module/games/cat-popper/CatPopperStore.js.map +1 -0
- package/lib/module/games/cat-popper/components/CatCharacter.js +281 -0
- package/lib/module/games/cat-popper/components/CatCharacter.js.map +1 -0
- package/lib/module/games/cat-popper/components/GameBackground.js +531 -0
- package/lib/module/games/cat-popper/components/GameBackground.js.map +1 -0
- package/lib/module/games/cat-popper/components/GameControls.js +230 -0
- package/lib/module/games/cat-popper/components/GameControls.js.map +1 -0
- package/lib/module/games/cat-popper/components/GameGrid.js +66 -0
- package/lib/module/games/cat-popper/components/GameGrid.js.map +1 -0
- package/lib/module/games/cat-popper/components/GameHole.js +183 -0
- package/lib/module/games/cat-popper/components/GameHole.js.map +1 -0
- package/lib/module/games/cat-popper/components/GameOverModal.js +131 -0
- package/lib/module/games/cat-popper/components/GameOverModal.js.map +1 -0
- package/lib/module/games/cat-popper/components/ScoreBoard.js +77 -0
- package/lib/module/games/cat-popper/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/cat-popper/components/index.js +10 -0
- package/lib/module/games/cat-popper/components/index.js.map +1 -0
- package/lib/module/games/fruit-slicer/FruitSlicer.js +411 -0
- package/lib/module/games/fruit-slicer/FruitSlicer.js.map +1 -0
- package/lib/module/games/fruit-slicer/FruitSlicerService.js +293 -0
- package/lib/module/games/fruit-slicer/FruitSlicerService.js.map +1 -0
- package/lib/module/games/fruit-slicer/FruitSlicerStore.js +156 -0
- package/lib/module/games/fruit-slicer/FruitSlicerStore.js.map +1 -0
- package/lib/module/games/fruit-slicer/components/FruitComponent.js +99 -0
- package/lib/module/games/fruit-slicer/components/FruitComponent.js.map +1 -0
- package/lib/module/games/fruit-slicer/components/GameArea.js +50 -0
- package/lib/module/games/fruit-slicer/components/GameArea.js.map +1 -0
- package/lib/module/games/fruit-slicer/components/GameBackground.js +1296 -0
- package/lib/module/games/fruit-slicer/components/GameBackground.js.map +1 -0
- package/lib/module/games/fruit-slicer/components/GameControls.js +230 -0
- package/lib/module/games/fruit-slicer/components/GameControls.js.map +1 -0
- package/lib/module/games/fruit-slicer/components/GameOverModal.js +189 -0
- package/lib/module/games/fruit-slicer/components/GameOverModal.js.map +1 -0
- package/lib/module/games/fruit-slicer/components/ParticleSystem.js +52 -0
- package/lib/module/games/fruit-slicer/components/ParticleSystem.js.map +1 -0
- package/lib/module/games/fruit-slicer/components/ScoreBoard.js +121 -0
- package/lib/module/games/fruit-slicer/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/fruit-slicer/components/SliceTrail.js +58 -0
- package/lib/module/games/fruit-slicer/components/SliceTrail.js.map +1 -0
- package/lib/module/games/fruit-slicer/components/index.js +11 -0
- package/lib/module/games/fruit-slicer/components/index.js.map +1 -0
- package/lib/module/games/maze-runner/MazeRunner.js +242 -0
- package/lib/module/games/maze-runner/MazeRunner.js.map +1 -0
- package/lib/module/games/maze-runner/MazeRunnerService.js +560 -0
- package/lib/module/games/maze-runner/MazeRunnerService.js.map +1 -0
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +149 -0
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js.map +1 -0
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js +357 -0
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js.map +1 -0
- package/lib/module/games/maze-runner/components/GameBackground.js +216 -0
- package/lib/module/games/maze-runner/components/GameBackground.js.map +1 -0
- package/lib/module/games/maze-runner/components/GameControls.js +129 -0
- package/lib/module/games/maze-runner/components/GameControls.js.map +1 -0
- package/lib/module/games/maze-runner/components/GameOverModal.js +134 -0
- package/lib/module/games/maze-runner/components/GameOverModal.js.map +1 -0
- package/lib/module/games/maze-runner/components/ScoreBoard.js +81 -0
- package/lib/module/games/maze-runner/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/maze-runner/components/SkiaPipeComponent.js +209 -0
- package/lib/module/games/maze-runner/components/SkiaPipeComponent.js.map +1 -0
- package/lib/module/games/maze-runner/components/StaticGameBackground.js +169 -0
- package/lib/module/games/maze-runner/components/StaticGameBackground.js.map +1 -0
- package/lib/module/games/maze-runner/components/WallComponent.js +90 -0
- package/lib/module/games/maze-runner/components/WallComponent.js.map +1 -0
- package/lib/module/games/maze-runner/components/index.js +10 -0
- package/lib/module/games/maze-runner/components/index.js.map +1 -0
- package/lib/module/games/space-traveller/SpaceTraveller.js +393 -0
- package/lib/module/games/space-traveller/SpaceTraveller.js.map +1 -0
- package/lib/module/games/space-traveller/SpaceTravellerService.js +298 -0
- package/lib/module/games/space-traveller/SpaceTravellerService.js.map +1 -0
- package/lib/module/games/space-traveller/SpaceTravellerStore.js +139 -0
- package/lib/module/games/space-traveller/SpaceTravellerStore.js.map +1 -0
- package/lib/module/games/space-traveller/components/AsteroidComponent.js +111 -0
- package/lib/module/games/space-traveller/components/AsteroidComponent.js.map +1 -0
- package/lib/module/games/space-traveller/components/GameArea.js +75 -0
- package/lib/module/games/space-traveller/components/GameArea.js.map +1 -0
- package/lib/module/games/space-traveller/components/GameBackground.js +294 -0
- package/lib/module/games/space-traveller/components/GameBackground.js.map +1 -0
- package/lib/module/games/space-traveller/components/GameControls.js +177 -0
- package/lib/module/games/space-traveller/components/GameControls.js.map +1 -0
- package/lib/module/games/space-traveller/components/GameOverModal.js +182 -0
- package/lib/module/games/space-traveller/components/GameOverModal.js.map +1 -0
- package/lib/module/games/space-traveller/components/ParticleComponent.js +34 -0
- package/lib/module/games/space-traveller/components/ParticleComponent.js.map +1 -0
- package/lib/module/games/space-traveller/components/ScoreBoard.js +143 -0
- package/lib/module/games/space-traveller/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/space-traveller/components/SettingsModal.js +222 -0
- package/lib/module/games/space-traveller/components/SettingsModal.js.map +1 -0
- package/lib/module/games/space-traveller/components/Spacecraft3D.js +362 -0
- package/lib/module/games/space-traveller/components/Spacecraft3D.js.map +1 -0
- package/lib/module/games/space-traveller/components/SpacecraftPath.js +37 -0
- package/lib/module/games/space-traveller/components/SpacecraftPath.js.map +1 -0
- package/lib/module/games/space-traveller/components/index.js +13 -0
- package/lib/module/games/space-traveller/components/index.js.map +1 -0
- package/lib/module/index.js +12 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/services/GamesConstants.js +561 -0
- package/lib/module/services/GamesConstants.js.map +1 -0
- package/lib/module/services/GamesService.js +34 -0
- package/lib/module/services/GamesService.js.map +1 -0
- package/lib/module/shared/settings/GameSettings.js +295 -0
- package/lib/module/shared/settings/GameSettings.js.map +1 -0
- package/lib/module/shared/settings/SettingsService.js +119 -0
- package/lib/module/shared/settings/SettingsService.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts +16 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts +66 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts +37 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/components/BalloonComponent.d.ts +10 -0
- package/lib/typescript/src/games/balloon-blaster/components/BalloonComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts +17 -0
- package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/balloon-blaster/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts +10 -0
- package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts +9 -0
- package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts +8 -0
- package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts +9 -0
- package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts +11 -0
- package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/components/index.d.ts +9 -0
- package/lib/typescript/src/games/balloon-blaster/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/CatPopper.d.ts +13 -0
- package/lib/typescript/src/games/cat-popper/CatPopper.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts +32 -0
- package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts +21 -0
- package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts +7 -0
- package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/cat-popper/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts +10 -0
- package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/components/GameGrid.d.ts +13 -0
- package/lib/typescript/src/games/cat-popper/components/GameGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/components/GameHole.d.ts +12 -0
- package/lib/typescript/src/games/cat-popper/components/GameHole.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/components/GameOverModal.d.ts +9 -0
- package/lib/typescript/src/games/cat-popper/components/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/components/ScoreBoard.d.ts +8 -0
- package/lib/typescript/src/games/cat-popper/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/cat-popper/components/index.d.ts +8 -0
- package/lib/typescript/src/games/cat-popper/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts +16 -0
- package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/FruitSlicerService.d.ts +67 -0
- package/lib/typescript/src/games/fruit-slicer/FruitSlicerService.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/FruitSlicerStore.d.ts +37 -0
- package/lib/typescript/src/games/fruit-slicer/FruitSlicerStore.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/components/FruitComponent.d.ts +10 -0
- package/lib/typescript/src/games/fruit-slicer/components/FruitComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts +17 -0
- package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/fruit-slicer/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts +10 -0
- package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/components/GameOverModal.d.ts +9 -0
- package/lib/typescript/src/games/fruit-slicer/components/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts +8 -0
- package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts +9 -0
- package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts +11 -0
- package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-slicer/components/index.d.ts +9 -0
- package/lib/typescript/src/games/fruit-slicer/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts +18 -0
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts +82 -0
- package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/EnhancedBallComponent.d.ts +11 -0
- package/lib/typescript/src/games/maze-runner/components/EnhancedBallComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/EnhancedGameArea.d.ts +12 -0
- package/lib/typescript/src/games/maze-runner/components/EnhancedGameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts +10 -0
- package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts +11 -0
- package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts +8 -0
- package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/SkiaPipeComponent.d.ts +25 -0
- package/lib/typescript/src/games/maze-runner/components/SkiaPipeComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/StaticGameBackground.d.ts +7 -0
- package/lib/typescript/src/games/maze-runner/components/StaticGameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/WallComponent.d.ts +10 -0
- package/lib/typescript/src/games/maze-runner/components/WallComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/components/index.d.ts +8 -0
- package/lib/typescript/src/games/maze-runner/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts +17 -0
- package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/SpaceTravellerService.d.ts +65 -0
- package/lib/typescript/src/games/space-traveller/SpaceTravellerService.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/SpaceTravellerStore.d.ts +35 -0
- package/lib/typescript/src/games/space-traveller/SpaceTravellerStore.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts +9 -0
- package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts +17 -0
- package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/space-traveller/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts +10 -0
- package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts +9 -0
- package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts +8 -0
- package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts +8 -0
- package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts +9 -0
- package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/Spacecraft3D.d.ts +9 -0
- package/lib/typescript/src/games/space-traveller/components/Spacecraft3D.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/SpacecraftPath.d.ts +10 -0
- package/lib/typescript/src/games/space-traveller/components/SpacecraftPath.d.ts.map +1 -0
- package/lib/typescript/src/games/space-traveller/components/index.d.ts +11 -0
- package/lib/typescript/src/games/space-traveller/components/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/services/GamesConstants.d.ts +372 -0
- package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -0
- package/lib/typescript/src/services/GamesService.d.ts +8 -0
- package/lib/typescript/src/services/GamesService.d.ts.map +1 -0
- package/lib/typescript/src/shared/settings/GameSettings.d.ts +36 -0
- package/lib/typescript/src/shared/settings/GameSettings.d.ts.map +1 -0
- package/lib/typescript/src/shared/settings/SettingsService.d.ts +32 -0
- package/lib/typescript/src/shared/settings/SettingsService.d.ts.map +1 -0
- package/package.json +125 -0
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export class MazeRunnerService {
|
|
4
|
+
gameTimer = null;
|
|
5
|
+
constructor(gridSize = 15, gameAreaWidth = 350, gameAreaHeight = 500) {
|
|
6
|
+
this.gameConfig = {
|
|
7
|
+
GRID_SIZE: gridSize,
|
|
8
|
+
CELL_SIZE: Math.min(gameAreaWidth, gameAreaHeight) / gridSize,
|
|
9
|
+
BALL_SIZE: 18,
|
|
10
|
+
PIPE_WIDTH: 8,
|
|
11
|
+
GAME_AREA_WIDTH: gameAreaWidth,
|
|
12
|
+
GAME_AREA_HEIGHT: gameAreaHeight,
|
|
13
|
+
COLLISION_TOLERANCE: 5,
|
|
14
|
+
SCORE_PER_COMPLETION: 100,
|
|
15
|
+
TIME_BONUS_MULTIPLIER: 10
|
|
16
|
+
};
|
|
17
|
+
this.gameState = {
|
|
18
|
+
isPlaying: false,
|
|
19
|
+
isPaused: false,
|
|
20
|
+
score: 0,
|
|
21
|
+
timeElapsed: 0,
|
|
22
|
+
ballPosition: {
|
|
23
|
+
x: 0,
|
|
24
|
+
y: 0
|
|
25
|
+
},
|
|
26
|
+
targetPosition: {
|
|
27
|
+
x: 0,
|
|
28
|
+
y: 0
|
|
29
|
+
},
|
|
30
|
+
isCompleted: false
|
|
31
|
+
};
|
|
32
|
+
this.maze = [];
|
|
33
|
+
this.walls = [];
|
|
34
|
+
this.initializeMaze();
|
|
35
|
+
// Generate initial maze on service creation
|
|
36
|
+
this.generateMazeWithBacktracking();
|
|
37
|
+
this.generateWalls();
|
|
38
|
+
this.setStartAndEndPositions();
|
|
39
|
+
}
|
|
40
|
+
setGameStateChangeCallback(callback) {
|
|
41
|
+
this.onGameStateChange = callback;
|
|
42
|
+
}
|
|
43
|
+
notifyGameStateChange() {
|
|
44
|
+
if (this.onGameStateChange) {
|
|
45
|
+
this.onGameStateChange({
|
|
46
|
+
...this.gameState
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
initializeMaze() {
|
|
51
|
+
// Initialize maze grid
|
|
52
|
+
this.maze = [];
|
|
53
|
+
for (let y = 0; y < this.gameConfig.GRID_SIZE; y++) {
|
|
54
|
+
this.maze[y] = [];
|
|
55
|
+
for (let x = 0; x < this.gameConfig.GRID_SIZE; x++) {
|
|
56
|
+
if (this.maze[y]) {
|
|
57
|
+
this.maze[y][x] = {
|
|
58
|
+
x,
|
|
59
|
+
y,
|
|
60
|
+
walls: {
|
|
61
|
+
top: true,
|
|
62
|
+
right: true,
|
|
63
|
+
bottom: true,
|
|
64
|
+
left: true
|
|
65
|
+
},
|
|
66
|
+
visited: false
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
generateNewMaze() {
|
|
73
|
+
this.initializeMaze();
|
|
74
|
+
this.generateMazeWithBacktracking();
|
|
75
|
+
this.generateWalls();
|
|
76
|
+
this.setStartAndEndPositions();
|
|
77
|
+
|
|
78
|
+
// Reset game state for new maze
|
|
79
|
+
this.gameState.isCompleted = false;
|
|
80
|
+
this.gameState.isPlaying = false; // Don't auto-start, let user click start
|
|
81
|
+
this.gameState.isPaused = false;
|
|
82
|
+
this.gameState.timeElapsed = 0;
|
|
83
|
+
this.notifyGameStateChange();
|
|
84
|
+
}
|
|
85
|
+
generateMazeWithBacktracking() {
|
|
86
|
+
// Create a proper maze using recursive backtracking algorithm
|
|
87
|
+
const stack = [];
|
|
88
|
+
const startCell = this.maze[0]?.[0];
|
|
89
|
+
if (startCell) {
|
|
90
|
+
startCell.visited = true;
|
|
91
|
+
stack.push(startCell);
|
|
92
|
+
}
|
|
93
|
+
while (stack.length > 0) {
|
|
94
|
+
const current = stack[stack.length - 1];
|
|
95
|
+
const neighbors = current ? this.getUnvisitedNeighbors(current) : [];
|
|
96
|
+
if (neighbors.length > 0) {
|
|
97
|
+
// Completely random neighbor selection for unpredictable maze generation
|
|
98
|
+
const next = neighbors[Math.floor(Math.random() * neighbors.length)];
|
|
99
|
+
if (current && next) this.removeWallBetween(current, next);
|
|
100
|
+
if (next) {
|
|
101
|
+
next.visited = true;
|
|
102
|
+
stack.push(next);
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
stack.pop();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Only minimal simplification to ensure connectivity
|
|
110
|
+
this.ensureConnectivity();
|
|
111
|
+
}
|
|
112
|
+
ensureConnectivity() {
|
|
113
|
+
// Only ensure basic connectivity without creating obvious paths
|
|
114
|
+
// Check if there's a path from start to end using BFS
|
|
115
|
+
if (!this.hasPathFromStartToEnd()) {
|
|
116
|
+
// If no path exists, create minimal connections
|
|
117
|
+
this.createMinimalPath();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
hasPathFromStartToEnd() {
|
|
121
|
+
// Use BFS to check if there's a path from start (0,0) to end (GRID_SIZE-1, GRID_SIZE-1)
|
|
122
|
+
const visited = Array(this.gameConfig.GRID_SIZE).fill(null).map(() => Array(this.gameConfig.GRID_SIZE).fill(false));
|
|
123
|
+
const queue = [{
|
|
124
|
+
x: 0,
|
|
125
|
+
y: 0
|
|
126
|
+
}];
|
|
127
|
+
if (visited[0]) visited[0][0] = true;
|
|
128
|
+
while (queue.length > 0) {
|
|
129
|
+
const current = queue.shift();
|
|
130
|
+
if (current.x === this.gameConfig.GRID_SIZE - 1 && current.y === this.gameConfig.GRID_SIZE - 1) {
|
|
131
|
+
return true; // Found path to end
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Check all four directions
|
|
135
|
+
const directions = [{
|
|
136
|
+
dx: 0,
|
|
137
|
+
dy: -1,
|
|
138
|
+
wall: 'top'
|
|
139
|
+
},
|
|
140
|
+
// Up
|
|
141
|
+
{
|
|
142
|
+
dx: 1,
|
|
143
|
+
dy: 0,
|
|
144
|
+
wall: 'right'
|
|
145
|
+
},
|
|
146
|
+
// Right
|
|
147
|
+
{
|
|
148
|
+
dx: 0,
|
|
149
|
+
dy: 1,
|
|
150
|
+
wall: 'bottom'
|
|
151
|
+
},
|
|
152
|
+
// Down
|
|
153
|
+
{
|
|
154
|
+
dx: -1,
|
|
155
|
+
dy: 0,
|
|
156
|
+
wall: 'left'
|
|
157
|
+
} // Left
|
|
158
|
+
];
|
|
159
|
+
for (const dir of directions) {
|
|
160
|
+
const newX = current.x + dir.dx;
|
|
161
|
+
const newY = current.y + dir.dy;
|
|
162
|
+
if (newX >= 0 && newX < this.gameConfig.GRID_SIZE && newY >= 0 && newY < this.gameConfig.GRID_SIZE && !visited[newY]?.[newX]) {
|
|
163
|
+
// Check if there's no wall blocking this direction
|
|
164
|
+
const currentCell = this.maze[current.y]?.[current.x];
|
|
165
|
+
if (currentCell && !currentCell.walls[dir.wall]) {
|
|
166
|
+
if (visited[newY]) visited[newY][newX] = true;
|
|
167
|
+
queue.push({
|
|
168
|
+
x: newX,
|
|
169
|
+
y: newY
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return false; // No path found
|
|
176
|
+
}
|
|
177
|
+
createMinimalPath() {
|
|
178
|
+
// Create a winding, unpredictable path from start to end
|
|
179
|
+
// This should only be called if no path exists after maze generation
|
|
180
|
+
let currentX = 0;
|
|
181
|
+
let currentY = 0;
|
|
182
|
+
const endX = this.gameConfig.GRID_SIZE - 1;
|
|
183
|
+
const endY = this.gameConfig.GRID_SIZE - 1;
|
|
184
|
+
const visited = new Set();
|
|
185
|
+
while (currentX !== endX || currentY !== endY) {
|
|
186
|
+
const key = `${currentX},${currentY}`;
|
|
187
|
+
if (visited.has(key)) {
|
|
188
|
+
// Prevent infinite loops - break out and create direct path
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
visited.add(key);
|
|
192
|
+
|
|
193
|
+
// Randomly choose direction, but prefer moving towards target occasionally
|
|
194
|
+
const possibleMoves = [];
|
|
195
|
+
if (currentX < endX) possibleMoves.push('right');
|
|
196
|
+
if (currentY < endY) possibleMoves.push('down');
|
|
197
|
+
if (currentX > 0) possibleMoves.push('left');
|
|
198
|
+
if (currentY > 0) possibleMoves.push('up');
|
|
199
|
+
if (possibleMoves.length === 0) break;
|
|
200
|
+
|
|
201
|
+
// 60% chance to move towards target, 40% chance random direction
|
|
202
|
+
let direction;
|
|
203
|
+
if (Math.random() < 0.6 && (currentX !== endX || currentY !== endY)) {
|
|
204
|
+
// Move towards target
|
|
205
|
+
if (currentX < endX && Math.random() < 0.5) {
|
|
206
|
+
direction = 'right';
|
|
207
|
+
} else if (currentY < endY) {
|
|
208
|
+
direction = 'down';
|
|
209
|
+
} else if (currentX < endX) {
|
|
210
|
+
direction = 'right';
|
|
211
|
+
} else {
|
|
212
|
+
direction = possibleMoves[Math.floor(Math.random() * possibleMoves.length)];
|
|
213
|
+
}
|
|
214
|
+
} else {
|
|
215
|
+
// Random direction
|
|
216
|
+
direction = possibleMoves[Math.floor(Math.random() * possibleMoves.length)];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Remove wall in chosen direction
|
|
220
|
+
const cell = this.maze[currentY]?.[currentX];
|
|
221
|
+
if (direction === 'right' && currentX < this.gameConfig.GRID_SIZE - 1 && cell) {
|
|
222
|
+
cell.walls.right = false;
|
|
223
|
+
const rightCell = this.maze[currentY]?.[currentX + 1];
|
|
224
|
+
if (rightCell) rightCell.walls.left = false;
|
|
225
|
+
currentX++;
|
|
226
|
+
} else if (direction === 'down' && currentY < this.gameConfig.GRID_SIZE - 1 && cell) {
|
|
227
|
+
cell.walls.bottom = false;
|
|
228
|
+
const bottomCell = this.maze[currentY + 1]?.[currentX];
|
|
229
|
+
if (bottomCell) bottomCell.walls.top = false;
|
|
230
|
+
currentY++;
|
|
231
|
+
} else if (direction === 'left' && currentX > 0 && cell) {
|
|
232
|
+
cell.walls.left = false;
|
|
233
|
+
const leftCell = this.maze[currentY]?.[currentX - 1];
|
|
234
|
+
if (leftCell) leftCell.walls.right = false;
|
|
235
|
+
currentX--;
|
|
236
|
+
} else if (direction === 'up' && currentY > 0 && cell) {
|
|
237
|
+
cell.walls.top = false;
|
|
238
|
+
const topCell = this.maze[currentY - 1]?.[currentX];
|
|
239
|
+
if (topCell) topCell.walls.bottom = false;
|
|
240
|
+
currentY--;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
getUnvisitedNeighbors(cell) {
|
|
245
|
+
const neighbors = [];
|
|
246
|
+
const {
|
|
247
|
+
x,
|
|
248
|
+
y
|
|
249
|
+
} = cell;
|
|
250
|
+
|
|
251
|
+
// Top
|
|
252
|
+
if (y > 0 && this.maze[y - 1]?.[x] && !this.maze[y - 1]?.[x]?.visited) {
|
|
253
|
+
const topCell = this.maze[y - 1]?.[x];
|
|
254
|
+
if (topCell) {
|
|
255
|
+
neighbors.push(topCell);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Right
|
|
259
|
+
if (x < this.gameConfig.GRID_SIZE - 1 && this.maze[y]?.[x + 1] && !this.maze[y]?.[x + 1]?.visited) {
|
|
260
|
+
const rightCell = this.maze[y]?.[x + 1];
|
|
261
|
+
if (rightCell) {
|
|
262
|
+
neighbors.push(rightCell);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// Bottom
|
|
266
|
+
if (y < this.gameConfig.GRID_SIZE - 1 && this.maze[y + 1]?.[x] && !this.maze[y + 1]?.[x]?.visited) {
|
|
267
|
+
const bottomCell = this.maze[y + 1]?.[x];
|
|
268
|
+
if (bottomCell) {
|
|
269
|
+
neighbors.push(bottomCell);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// Left
|
|
273
|
+
if (x > 0 && this.maze[y]?.[x - 1] && !this.maze[y]?.[x - 1]?.visited) {
|
|
274
|
+
const leftCell = this.maze[y]?.[x - 1];
|
|
275
|
+
if (leftCell) {
|
|
276
|
+
neighbors.push(leftCell);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return neighbors;
|
|
280
|
+
}
|
|
281
|
+
removeWallBetween(current, next) {
|
|
282
|
+
const dx = current.x - next.x;
|
|
283
|
+
const dy = current.y - next.y;
|
|
284
|
+
if (dx === 1) {
|
|
285
|
+
// Next is to the left
|
|
286
|
+
current.walls.left = false;
|
|
287
|
+
next.walls.right = false;
|
|
288
|
+
} else if (dx === -1) {
|
|
289
|
+
// Next is to the right
|
|
290
|
+
current.walls.right = false;
|
|
291
|
+
next.walls.left = false;
|
|
292
|
+
} else if (dy === 1) {
|
|
293
|
+
// Next is above
|
|
294
|
+
current.walls.top = false;
|
|
295
|
+
next.walls.bottom = false;
|
|
296
|
+
} else if (dy === -1) {
|
|
297
|
+
// Next is below
|
|
298
|
+
current.walls.bottom = false;
|
|
299
|
+
next.walls.top = false;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
generateWalls() {
|
|
303
|
+
this.walls = [];
|
|
304
|
+
const wallThickness = 4;
|
|
305
|
+
const cellSize = this.gameConfig.CELL_SIZE;
|
|
306
|
+
const mazeWidth = this.gameConfig.GRID_SIZE * cellSize;
|
|
307
|
+
const mazeHeight = this.gameConfig.GRID_SIZE * cellSize;
|
|
308
|
+
|
|
309
|
+
// Create outer boundary walls (solid perimeter around the maze area)
|
|
310
|
+
// Top boundary
|
|
311
|
+
this.walls.push({
|
|
312
|
+
x: 0,
|
|
313
|
+
y: 0,
|
|
314
|
+
width: mazeWidth,
|
|
315
|
+
height: wallThickness,
|
|
316
|
+
type: 'horizontal'
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
// Bottom boundary
|
|
320
|
+
this.walls.push({
|
|
321
|
+
x: 0,
|
|
322
|
+
y: mazeHeight - wallThickness,
|
|
323
|
+
width: mazeWidth,
|
|
324
|
+
height: wallThickness,
|
|
325
|
+
type: 'horizontal'
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
// Left boundary
|
|
329
|
+
this.walls.push({
|
|
330
|
+
x: 0,
|
|
331
|
+
y: 0,
|
|
332
|
+
width: wallThickness,
|
|
333
|
+
height: mazeHeight,
|
|
334
|
+
type: 'vertical'
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
// Right boundary
|
|
338
|
+
this.walls.push({
|
|
339
|
+
x: mazeWidth - wallThickness,
|
|
340
|
+
y: 0,
|
|
341
|
+
width: wallThickness,
|
|
342
|
+
height: mazeHeight,
|
|
343
|
+
type: 'vertical'
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// Generate internal walls based on maze cells
|
|
347
|
+
// Only add walls where they are needed to avoid duplicates
|
|
348
|
+
for (let y = 0; y < this.gameConfig.GRID_SIZE; y++) {
|
|
349
|
+
for (let x = 0; x < this.gameConfig.GRID_SIZE; x++) {
|
|
350
|
+
const cell = this.maze[y]?.[x];
|
|
351
|
+
if (!cell) continue;
|
|
352
|
+
const cellX = x * cellSize;
|
|
353
|
+
const cellY = y * cellSize;
|
|
354
|
+
|
|
355
|
+
// Add horizontal walls (only add each wall once)
|
|
356
|
+
// Add top wall if this cell has a top wall and we're not at the top edge
|
|
357
|
+
if (cell.walls.top && y > 0) {
|
|
358
|
+
this.walls.push({
|
|
359
|
+
x: cellX,
|
|
360
|
+
y: cellY,
|
|
361
|
+
width: cellSize,
|
|
362
|
+
height: wallThickness,
|
|
363
|
+
type: 'horizontal'
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// Add vertical walls (only add each wall once)
|
|
368
|
+
// Add left wall if this cell has a left wall and we're not at the left edge
|
|
369
|
+
if (cell.walls.left && x > 0) {
|
|
370
|
+
this.walls.push({
|
|
371
|
+
x: cellX,
|
|
372
|
+
y: cellY,
|
|
373
|
+
width: wallThickness,
|
|
374
|
+
height: cellSize,
|
|
375
|
+
type: 'vertical'
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
setStartAndEndPositions() {
|
|
382
|
+
const cellSize = this.gameConfig.CELL_SIZE;
|
|
383
|
+
|
|
384
|
+
// Start position (top-left)
|
|
385
|
+
this.gameState.ballPosition = {
|
|
386
|
+
x: cellSize / 2,
|
|
387
|
+
y: cellSize / 2
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// End position (bottom-right)
|
|
391
|
+
this.gameState.targetPosition = {
|
|
392
|
+
x: (this.gameConfig.GRID_SIZE - 1) * cellSize + cellSize / 2,
|
|
393
|
+
y: (this.gameConfig.GRID_SIZE - 1) * cellSize + cellSize / 2
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
updateSettings(gridSize, _gameDuration) {
|
|
397
|
+
// Update game configuration with new settings
|
|
398
|
+
const gameAreaWidth = this.gameConfig.GAME_AREA_WIDTH;
|
|
399
|
+
const gameAreaHeight = this.gameConfig.GAME_AREA_HEIGHT;
|
|
400
|
+
this.gameConfig.GRID_SIZE = gridSize;
|
|
401
|
+
this.gameConfig.CELL_SIZE = Math.min(gameAreaWidth, gameAreaHeight) / gridSize;
|
|
402
|
+
|
|
403
|
+
// Generate new maze with updated settings
|
|
404
|
+
this.generateNewMaze();
|
|
405
|
+
|
|
406
|
+
// Reset game state
|
|
407
|
+
this.gameState.isPlaying = false;
|
|
408
|
+
this.gameState.isPaused = false;
|
|
409
|
+
this.gameState.timeElapsed = 0;
|
|
410
|
+
this.gameState.isCompleted = false;
|
|
411
|
+
this.stopTimer();
|
|
412
|
+
this.notifyGameStateChange();
|
|
413
|
+
}
|
|
414
|
+
resetGame() {
|
|
415
|
+
// Generate a completely new maze for fresh gameplay
|
|
416
|
+
this.generateNewMaze();
|
|
417
|
+
|
|
418
|
+
// Reset game state without starting - just prepare for a new game
|
|
419
|
+
this.gameState.isPlaying = false; // Don't auto-start
|
|
420
|
+
this.gameState.isPaused = false;
|
|
421
|
+
this.gameState.timeElapsed = 0;
|
|
422
|
+
this.gameState.isCompleted = false;
|
|
423
|
+
this.stopTimer(); // Make sure timer is stopped
|
|
424
|
+
this.notifyGameStateChange();
|
|
425
|
+
}
|
|
426
|
+
startGame() {
|
|
427
|
+
// Start the game with current maze (don't regenerate here since resetGame already did)
|
|
428
|
+
this.gameState.ballPosition = {
|
|
429
|
+
x: this.gameConfig.CELL_SIZE / 2,
|
|
430
|
+
y: this.gameConfig.CELL_SIZE / 2
|
|
431
|
+
};
|
|
432
|
+
this.gameState.targetPosition = {
|
|
433
|
+
x: (this.gameConfig.GRID_SIZE - 1) * this.gameConfig.CELL_SIZE + this.gameConfig.CELL_SIZE / 2,
|
|
434
|
+
y: (this.gameConfig.GRID_SIZE - 1) * this.gameConfig.CELL_SIZE + this.gameConfig.CELL_SIZE / 2
|
|
435
|
+
};
|
|
436
|
+
this.gameState.isPlaying = true;
|
|
437
|
+
this.gameState.isPaused = false;
|
|
438
|
+
this.gameState.timeElapsed = 0;
|
|
439
|
+
this.gameState.isCompleted = false;
|
|
440
|
+
this.startTimer();
|
|
441
|
+
this.notifyGameStateChange();
|
|
442
|
+
}
|
|
443
|
+
pauseGame() {
|
|
444
|
+
this.gameState.isPaused = true;
|
|
445
|
+
this.stopTimer();
|
|
446
|
+
this.notifyGameStateChange();
|
|
447
|
+
}
|
|
448
|
+
resumeGame() {
|
|
449
|
+
this.gameState.isPaused = false;
|
|
450
|
+
this.startTimer();
|
|
451
|
+
this.notifyGameStateChange();
|
|
452
|
+
}
|
|
453
|
+
stopGame() {
|
|
454
|
+
this.gameState.isPlaying = false;
|
|
455
|
+
this.gameState.isPaused = false;
|
|
456
|
+
this.stopTimer();
|
|
457
|
+
this.notifyGameStateChange();
|
|
458
|
+
}
|
|
459
|
+
startTimer() {
|
|
460
|
+
this.stopTimer();
|
|
461
|
+
this.gameTimer = setInterval(() => {
|
|
462
|
+
if (!this.gameState.isPaused && this.gameState.isPlaying) {
|
|
463
|
+
this.gameState.timeElapsed += 1;
|
|
464
|
+
this.notifyGameStateChange();
|
|
465
|
+
}
|
|
466
|
+
}, 1000);
|
|
467
|
+
}
|
|
468
|
+
stopTimer() {
|
|
469
|
+
if (this.gameTimer) {
|
|
470
|
+
clearInterval(this.gameTimer);
|
|
471
|
+
this.gameTimer = null;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
updateBallPosition(newPosition) {
|
|
475
|
+
if (!this.gameState.isPlaying || this.gameState.isPaused) {
|
|
476
|
+
return false;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// Check if the new position is valid (within maze path)
|
|
480
|
+
if (this.isValidPosition(newPosition)) {
|
|
481
|
+
this.gameState.ballPosition = newPosition;
|
|
482
|
+
|
|
483
|
+
// Check if reached target (only if not already completed)
|
|
484
|
+
if (!this.gameState.isCompleted && this.isNearTarget(newPosition)) {
|
|
485
|
+
this.completeLevel();
|
|
486
|
+
}
|
|
487
|
+
this.notifyGameStateChange();
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
isValidPosition(position) {
|
|
493
|
+
const {
|
|
494
|
+
x,
|
|
495
|
+
y
|
|
496
|
+
} = position;
|
|
497
|
+
const ballRadius = this.gameConfig.BALL_SIZE / 2;
|
|
498
|
+
|
|
499
|
+
// Check if ball would collide with any wall
|
|
500
|
+
for (const wall of this.walls) {
|
|
501
|
+
if (this.ballCollidesWithWall(x, y, ballRadius, wall)) {
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// Check game area boundaries (with some padding)
|
|
507
|
+
const padding = ballRadius + 2;
|
|
508
|
+
if (x - ballRadius < padding || x + ballRadius > this.gameConfig.GAME_AREA_WIDTH - padding || y - ballRadius < padding || y + ballRadius > this.gameConfig.GAME_AREA_HEIGHT - padding) {
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
return true;
|
|
512
|
+
}
|
|
513
|
+
ballCollidesWithWall(ballX, ballY, ballRadius, wall) {
|
|
514
|
+
// Calculate the closest point on the wall rectangle to the ball center
|
|
515
|
+
const closestX = Math.max(wall.x, Math.min(ballX, wall.x + wall.width));
|
|
516
|
+
const closestY = Math.max(wall.y, Math.min(ballY, wall.y + wall.height));
|
|
517
|
+
|
|
518
|
+
// Calculate the distance from the ball center to this closest point
|
|
519
|
+
const distanceX = ballX - closestX;
|
|
520
|
+
const distanceY = ballY - closestY;
|
|
521
|
+
const distanceSquared = distanceX * distanceX + distanceY * distanceY;
|
|
522
|
+
|
|
523
|
+
// Check if the distance is less than the ball radius
|
|
524
|
+
return distanceSquared < ballRadius * ballRadius;
|
|
525
|
+
}
|
|
526
|
+
isNearTarget(position) {
|
|
527
|
+
const distance = Math.sqrt(Math.pow(position.x - this.gameState.targetPosition.x, 2) + Math.pow(position.y - this.gameState.targetPosition.y, 2));
|
|
528
|
+
return distance < this.gameConfig.BALL_SIZE;
|
|
529
|
+
}
|
|
530
|
+
completeLevel() {
|
|
531
|
+
const timeBonus = Math.max(0, 60 - this.gameState.timeElapsed) * this.gameConfig.TIME_BONUS_MULTIPLIER;
|
|
532
|
+
this.gameState.score += this.gameConfig.SCORE_PER_COMPLETION + timeBonus;
|
|
533
|
+
this.gameState.isCompleted = true;
|
|
534
|
+
this.gameState.isPlaying = false; // Stop the game when maze is completed
|
|
535
|
+
this.stopTimer();
|
|
536
|
+
this.notifyGameStateChange();
|
|
537
|
+
}
|
|
538
|
+
getGameState() {
|
|
539
|
+
return {
|
|
540
|
+
...this.gameState
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
getGameConfig() {
|
|
544
|
+
return {
|
|
545
|
+
...this.gameConfig
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
getWalls() {
|
|
549
|
+
return [...this.walls];
|
|
550
|
+
}
|
|
551
|
+
getMaze() {
|
|
552
|
+
return this.maze.map(row => row.map(cell => ({
|
|
553
|
+
...cell
|
|
554
|
+
})));
|
|
555
|
+
}
|
|
556
|
+
cleanup() {
|
|
557
|
+
this.stopTimer();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
//# sourceMappingURL=MazeRunnerService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MazeRunnerService","gameTimer","constructor","gridSize","gameAreaWidth","gameAreaHeight","gameConfig","GRID_SIZE","CELL_SIZE","Math","min","BALL_SIZE","PIPE_WIDTH","GAME_AREA_WIDTH","GAME_AREA_HEIGHT","COLLISION_TOLERANCE","SCORE_PER_COMPLETION","TIME_BONUS_MULTIPLIER","gameState","isPlaying","isPaused","score","timeElapsed","ballPosition","x","y","targetPosition","isCompleted","maze","walls","initializeMaze","generateMazeWithBacktracking","generateWalls","setStartAndEndPositions","setGameStateChangeCallback","callback","onGameStateChange","notifyGameStateChange","top","right","bottom","left","visited","generateNewMaze","stack","startCell","push","length","current","neighbors","getUnvisitedNeighbors","next","floor","random","removeWallBetween","pop","ensureConnectivity","hasPathFromStartToEnd","createMinimalPath","Array","fill","map","queue","shift","directions","dx","dy","wall","dir","newX","newY","currentCell","currentX","currentY","endX","endY","Set","key","has","add","possibleMoves","direction","cell","rightCell","bottomCell","leftCell","topCell","wallThickness","cellSize","mazeWidth","mazeHeight","width","height","type","cellX","cellY","updateSettings","_gameDuration","stopTimer","resetGame","startGame","startTimer","pauseGame","resumeGame","stopGame","setInterval","clearInterval","updateBallPosition","newPosition","isValidPosition","isNearTarget","completeLevel","position","ballRadius","ballCollidesWithWall","padding","ballX","ballY","closestX","max","closestY","distanceX","distanceY","distanceSquared","distance","sqrt","pow","timeBonus","getGameState","getGameConfig","getWalls","getMaze","row","cleanup"],"sourceRoot":"../../../../src","sources":["games/maze-runner/MazeRunnerService.ts"],"mappings":";;AA+CA,OAAO,MAAMA,iBAAiB,CAAC;EAKrBC,SAAS,GAA0B,IAAI;EAG/CC,WAAWA,CACTC,QAAgB,GAAG,EAAE,EACrBC,aAAqB,GAAG,GAAG,EAC3BC,cAAsB,GAAG,GAAG,EAC5B;IACA,IAAI,CAACC,UAAU,GAAG;MAChBC,SAAS,EAAEJ,QAAQ;MACnBK,SAAS,EAAEC,IAAI,CAACC,GAAG,CAACN,aAAa,EAAEC,cAAc,CAAC,GAAGF,QAAQ;MAC7DQ,SAAS,EAAE,EAAE;MACbC,UAAU,EAAE,CAAC;MACbC,eAAe,EAAET,aAAa;MAC9BU,gBAAgB,EAAET,cAAc;MAChCU,mBAAmB,EAAE,CAAC;MACtBC,oBAAoB,EAAE,GAAG;MACzBC,qBAAqB,EAAE;IACzB,CAAC;IAED,IAAI,CAACC,SAAS,GAAG;MACfC,SAAS,EAAE,KAAK;MAChBC,QAAQ,EAAE,KAAK;MACfC,KAAK,EAAE,CAAC;MACRC,WAAW,EAAE,CAAC;MACdC,YAAY,EAAE;QAAEC,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;MAC5BC,cAAc,EAAE;QAAEF,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;MAC9BE,WAAW,EAAE;IACf,CAAC;IAED,IAAI,CAACC,IAAI,GAAG,EAAE;IACd,IAAI,CAACC,KAAK,GAAG,EA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