react-native-games 0.3.0 → 0.5.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/README.md +134 -130
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +116 -343
- package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +182 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js +123 -101
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +119 -92
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js +123 -113
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/GameArea.js +137 -23
- package/lib/module/games/balloon-blaster/components/GameArea.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/GameBackground.js +8 -83
- package/lib/module/games/balloon-blaster/components/GameBackground.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js +15 -22
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/index.js +0 -4
- package/lib/module/games/balloon-blaster/components/index.js.map +1 -1
- package/lib/module/games/fruit-ninja/FruitNinja.js +143 -0
- package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -0
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +148 -0
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -0
- package/lib/module/games/{fruit-slicer/FruitSlicerService.js → fruit-ninja/FruitNinjaService.js} +43 -21
- package/lib/module/games/fruit-ninja/FruitNinjaService.js.map +1 -0
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js +191 -0
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.js +1 -1
- package/lib/module/games/fruit-ninja/components/FruitComponent.js.map +1 -0
- package/lib/module/games/fruit-ninja/components/GameArea.js +215 -0
- package/lib/module/games/fruit-ninja/components/GameArea.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameBackground.js +250 -304
- package/lib/module/games/fruit-ninja/components/GameBackground.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/ScoreBoard.js +17 -47
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/fruit-ninja/components/index.js +7 -0
- package/lib/module/games/fruit-ninja/components/index.js.map +1 -0
- package/lib/module/games/maze-runner/MazeRunner.js +184 -169
- package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerConstants.js +100 -0
- package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -0
- package/lib/module/games/maze-runner/MazeRunnerService.js +37 -14
- package/lib/module/games/maze-runner/MazeRunnerService.js.map +1 -1
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +5 -4
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js.map +1 -1
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js +20 -15
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js.map +1 -1
- package/lib/module/games/maze-runner/components/GameBackground.js +151 -192
- package/lib/module/games/maze-runner/components/GameBackground.js.map +1 -1
- package/lib/module/games/maze-runner/components/ScoreBoard.js +15 -25
- package/lib/module/games/maze-runner/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/maze-runner/components/WallComponent.js +3 -2
- package/lib/module/games/maze-runner/components/WallComponent.js.map +1 -1
- package/lib/module/games/maze-runner/components/index.js +0 -2
- package/lib/module/games/maze-runner/components/index.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidget.js +294 -0
- package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js +113 -0
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidgetService.js +132 -0
- package/lib/module/games/popit-fidget/PopitFidgetService.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidgetStore.js +163 -0
- package/lib/module/games/popit-fidget/PopitFidgetStore.js.map +1 -0
- package/lib/module/games/popit-fidget/components/BubbleComponent.js +198 -0
- package/lib/module/games/popit-fidget/components/BubbleComponent.js.map +1 -0
- package/lib/module/games/popit-fidget/components/FidgetGrid.js +165 -0
- package/lib/module/games/popit-fidget/components/FidgetGrid.js.map +1 -0
- package/lib/module/games/popit-fidget/components/GameBackground.js +177 -0
- package/lib/module/games/popit-fidget/components/GameBackground.js.map +1 -0
- package/lib/module/games/popit-fidget/components/ScoreBoard.js +75 -0
- package/lib/module/games/popit-fidget/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/popit-fidget/components/index.js +7 -0
- package/lib/module/games/popit-fidget/components/index.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighter.js +169 -0
- package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighterConstants.js +108 -0
- package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -0
- package/lib/module/games/{space-traveller/SpaceTravellerService.js → space-fighter/SpaceFighterService.js} +48 -21
- package/lib/module/games/space-fighter/SpaceFighterService.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighterStore.js +195 -0
- package/lib/module/games/space-fighter/SpaceFighterStore.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/AsteroidComponent.js +7 -5
- package/lib/module/games/space-fighter/components/AsteroidComponent.js.map +1 -0
- package/lib/module/games/space-fighter/components/GameArea.js +295 -0
- package/lib/module/games/space-fighter/components/GameArea.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/GameBackground.js +10 -65
- package/lib/module/games/space-fighter/components/GameBackground.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/ScoreBoard.js +20 -26
- package/lib/module/games/space-fighter/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/Spacecraft3D.js +72 -111
- package/lib/module/games/space-fighter/components/Spacecraft3D.js.map +1 -0
- package/lib/module/games/space-fighter/components/SpacecraftPath.js +52 -0
- package/lib/module/games/space-fighter/components/SpacecraftPath.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/index.js +0 -4
- package/lib/module/games/space-fighter/components/index.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMole.js +263 -0
- package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +115 -0
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMoleService.js +120 -0
- package/lib/module/games/whack-a-mole/WhackAMoleService.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js +172 -0
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js.map +1 -0
- package/lib/module/games/{cat-popper → whack-a-mole}/components/GameBackground.js +31 -91
- package/lib/module/games/whack-a-mole/components/GameBackground.js.map +1 -0
- package/lib/module/games/whack-a-mole/components/GameGrid.js +97 -0
- package/lib/module/games/whack-a-mole/components/GameGrid.js.map +1 -0
- package/lib/module/games/{cat-popper → whack-a-mole}/components/GameHole.js +67 -54
- package/lib/module/games/whack-a-mole/components/GameHole.js.map +1 -0
- package/lib/module/games/{cat-popper/components/CatCharacter.js → whack-a-mole/components/MoleCharacter.js} +75 -115
- package/lib/module/games/whack-a-mole/components/MoleCharacter.js.map +1 -0
- package/lib/module/games/{cat-popper → whack-a-mole}/components/ScoreBoard.js +13 -17
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/{cat-popper → whack-a-mole}/components/index.js +1 -3
- package/lib/module/games/whack-a-mole/components/index.js.map +1 -0
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/GamesConstants.js +41 -519
- package/lib/module/services/GamesConstants.js.map +1 -1
- package/lib/module/services/GamesService.js +35 -23
- package/lib/module/services/GamesService.js.map +1 -1
- package/lib/module/services/HapticsService.js +77 -0
- package/lib/module/services/HapticsService.js.map +1 -0
- package/lib/module/services/SoundsService.js +171 -0
- package/lib/module/services/SoundsService.js.map +1 -0
- package/lib/module/shared/helpers/AnimationFrame.js +120 -0
- package/lib/module/shared/helpers/AnimationFrame.js.map +1 -0
- package/lib/module/shared/helpers/AnimationTracker.js +89 -0
- package/lib/module/shared/helpers/AnimationTracker.js.map +1 -0
- package/lib/module/shared/helpers/ErrorHandler.js +269 -0
- package/lib/module/shared/helpers/ErrorHandler.js.map +1 -0
- package/lib/module/shared/helpers/GameControlButton.js +219 -0
- package/lib/module/shared/helpers/GameControlButton.js.map +1 -0
- package/lib/module/{games/balloon-blaster/components → shared/helpers}/GameOverModal.js +25 -17
- package/lib/module/shared/helpers/GameOverModal.js.map +1 -0
- package/lib/module/shared/helpers/GameSettingsModal.js +287 -0
- package/lib/module/shared/helpers/GameSettingsModal.js.map +1 -0
- package/lib/module/shared/helpers/ParticleBlast.js +133 -0
- package/lib/module/shared/helpers/ParticleBlast.js.map +1 -0
- package/lib/module/shared/helpers/ResponsiveScoreBoard.js +81 -0
- package/lib/module/shared/helpers/ResponsiveScoreBoard.js.map +1 -0
- package/lib/module/shared/helpers/index.js +12 -0
- package/lib/module/shared/helpers/index.js.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts +2 -14
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +144 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts +12 -2
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/BalloonComponent.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts +1 -15
- package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/GameBackground.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts +1 -7
- package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/index.d.ts +0 -4
- package/lib/typescript/src/games/balloon-blaster/components/index.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts +4 -0
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts +112 -0
- package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer/FruitSlicerService.d.ts → fruit-ninja/FruitNinjaService.d.ts} +13 -5
- package/lib/typescript/src/games/fruit-ninja/FruitNinjaService.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer/FruitSlicerStore.d.ts → fruit-ninja/FruitNinjaStore.d.ts} +13 -4
- package/lib/typescript/src/games/fruit-ninja/FruitNinjaStore.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.d.ts +1 -1
- package/lib/typescript/src/games/fruit-ninja/components/FruitComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts +3 -0
- package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/index.d.ts +5 -0
- package/lib/typescript/src/games/fruit-ninja/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts +2 -16
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts +41 -0
- package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts +4 -2
- package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/EnhancedBallComponent.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/EnhancedGameArea.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts +2 -1
- package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/WallComponent.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/index.d.ts +0 -2
- package/lib/typescript/src/games/maze-runner/components/index.d.ts.map +1 -1
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts +5 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts +45 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts +33 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts +36 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts +12 -0
- package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts +12 -0
- package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts +9 -0
- package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts +8 -0
- package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/index.d.ts +5 -0
- package/lib/typescript/src/games/popit-fidget/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts +4 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts +71 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller/SpaceTravellerService.d.ts → space-fighter/SpaceFighterService.d.ts} +7 -4
- package/lib/typescript/src/games/space-fighter/SpaceFighterService.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller/SpaceTravellerStore.d.ts → space-fighter/SpaceFighterStore.d.ts} +12 -4
- package/lib/typescript/src/games/space-fighter/SpaceFighterStore.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts +8 -0
- package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts +3 -0
- package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller → space-fighter}/components/Spacecraft3D.d.ts +1 -1
- package/lib/typescript/src/games/space-fighter/components/Spacecraft3D.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/SpacecraftPath.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller → space-fighter}/components/index.d.ts +0 -4
- package/lib/typescript/src/games/space-fighter/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts +4 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +79 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts +33 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts +41 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameGrid.d.ts +2 -2
- package/lib/typescript/src/games/whack-a-mole/components/GameGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameHole.d.ts +3 -2
- package/lib/typescript/src/games/whack-a-mole/components/GameHole.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts +7 -0
- package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/components/index.d.ts +6 -0
- package/lib/typescript/src/games/whack-a-mole/components/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesConstants.d.ts +61 -340
- package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesService.d.ts +21 -3
- package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
- package/lib/typescript/src/services/HapticsService.d.ts +16 -0
- package/lib/typescript/src/services/HapticsService.d.ts.map +1 -0
- package/lib/typescript/src/services/SoundsService.d.ts +154 -0
- package/lib/typescript/src/services/SoundsService.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts +41 -0
- package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts +45 -0
- package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts +124 -0
- package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/GameControlButton.d.ts +17 -0
- package/lib/typescript/src/shared/helpers/GameControlButton.d.ts.map +1 -0
- package/lib/typescript/src/{games/cat-popper/components → shared/helpers}/GameOverModal.d.ts +5 -0
- package/lib/typescript/src/shared/helpers/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts +9 -0
- package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts +12 -0
- package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts +42 -0
- package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/index.d.ts +13 -0
- package/lib/typescript/src/shared/helpers/index.d.ts.map +1 -0
- package/package.json +9 -6
- package/lib/module/games/balloon-blaster/components/GameControls.js +0 -229
- package/lib/module/games/balloon-blaster/components/GameControls.js.map +0 -1
- package/lib/module/games/balloon-blaster/components/GameOverModal.js.map +0 -1
- package/lib/module/games/balloon-blaster/components/ParticleSystem.js +0 -52
- package/lib/module/games/balloon-blaster/components/ParticleSystem.js.map +0 -1
- package/lib/module/games/balloon-blaster/components/SliceTrail.js +0 -58
- package/lib/module/games/balloon-blaster/components/SliceTrail.js.map +0 -1
- package/lib/module/games/cat-popper/CatPopper.js +0 -230
- package/lib/module/games/cat-popper/CatPopper.js.map +0 -1
- package/lib/module/games/cat-popper/CatPopperService.js +0 -100
- package/lib/module/games/cat-popper/CatPopperService.js.map +0 -1
- package/lib/module/games/cat-popper/CatPopperStore.js +0 -113
- package/lib/module/games/cat-popper/CatPopperStore.js.map +0 -1
- package/lib/module/games/cat-popper/components/CatCharacter.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameBackground.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameControls.js +0 -230
- package/lib/module/games/cat-popper/components/GameControls.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameGrid.js +0 -66
- package/lib/module/games/cat-popper/components/GameGrid.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameHole.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameOverModal.js +0 -131
- package/lib/module/games/cat-popper/components/GameOverModal.js.map +0 -1
- package/lib/module/games/cat-popper/components/ScoreBoard.js.map +0 -1
- package/lib/module/games/cat-popper/components/index.js.map +0 -1
- package/lib/module/games/fruit-slicer/FruitSlicer.js +0 -411
- package/lib/module/games/fruit-slicer/FruitSlicer.js.map +0 -1
- package/lib/module/games/fruit-slicer/FruitSlicerService.js.map +0 -1
- package/lib/module/games/fruit-slicer/FruitSlicerStore.js +0 -156
- package/lib/module/games/fruit-slicer/FruitSlicerStore.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/FruitComponent.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/GameArea.js +0 -50
- package/lib/module/games/fruit-slicer/components/GameArea.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/GameBackground.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/GameControls.js +0 -230
- package/lib/module/games/fruit-slicer/components/GameControls.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/GameOverModal.js +0 -189
- package/lib/module/games/fruit-slicer/components/GameOverModal.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/ParticleSystem.js +0 -52
- package/lib/module/games/fruit-slicer/components/ParticleSystem.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/ScoreBoard.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/SliceTrail.js +0 -58
- package/lib/module/games/fruit-slicer/components/SliceTrail.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/index.js +0 -11
- package/lib/module/games/fruit-slicer/components/index.js.map +0 -1
- package/lib/module/games/maze-runner/components/GameControls.js +0 -129
- package/lib/module/games/maze-runner/components/GameControls.js.map +0 -1
- package/lib/module/games/maze-runner/components/GameOverModal.js +0 -134
- package/lib/module/games/maze-runner/components/GameOverModal.js.map +0 -1
- package/lib/module/games/space-traveller/SpaceTraveller.js +0 -393
- package/lib/module/games/space-traveller/SpaceTraveller.js.map +0 -1
- package/lib/module/games/space-traveller/SpaceTravellerService.js.map +0 -1
- package/lib/module/games/space-traveller/SpaceTravellerStore.js +0 -139
- package/lib/module/games/space-traveller/SpaceTravellerStore.js.map +0 -1
- package/lib/module/games/space-traveller/components/AsteroidComponent.js.map +0 -1
- package/lib/module/games/space-traveller/components/GameArea.js +0 -75
- package/lib/module/games/space-traveller/components/GameArea.js.map +0 -1
- package/lib/module/games/space-traveller/components/GameBackground.js.map +0 -1
- package/lib/module/games/space-traveller/components/GameControls.js +0 -177
- package/lib/module/games/space-traveller/components/GameControls.js.map +0 -1
- package/lib/module/games/space-traveller/components/GameOverModal.js +0 -182
- package/lib/module/games/space-traveller/components/GameOverModal.js.map +0 -1
- package/lib/module/games/space-traveller/components/ParticleComponent.js +0 -34
- package/lib/module/games/space-traveller/components/ParticleComponent.js.map +0 -1
- package/lib/module/games/space-traveller/components/ScoreBoard.js.map +0 -1
- package/lib/module/games/space-traveller/components/SettingsModal.js +0 -222
- package/lib/module/games/space-traveller/components/SettingsModal.js.map +0 -1
- package/lib/module/games/space-traveller/components/Spacecraft3D.js.map +0 -1
- package/lib/module/games/space-traveller/components/SpacecraftPath.js +0 -37
- package/lib/module/games/space-traveller/components/SpacecraftPath.js.map +0 -1
- package/lib/module/games/space-traveller/components/index.js.map +0 -1
- package/lib/module/shared/settings/GameSettings.js +0 -295
- package/lib/module/shared/settings/GameSettings.js.map +0 -1
- package/lib/module/shared/settings/SettingsService.js +0 -119
- package/lib/module/shared/settings/SettingsService.js.map +0 -1
- package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts +0 -9
- package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts +0 -8
- package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts.map +0 -1
- package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts +0 -11
- package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/CatPopper.d.ts +0 -13
- package/lib/typescript/src/games/cat-popper/CatPopper.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts +0 -32
- package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts +0 -21
- package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts +0 -7
- package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameBackground.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameGrid.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameHole.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/ScoreBoard.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/index.d.ts +0 -8
- package/lib/typescript/src/games/cat-popper/components/index.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts +0 -16
- package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/FruitSlicerService.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/FruitSlicerStore.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/FruitComponent.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts +0 -17
- package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/GameBackground.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/GameOverModal.d.ts +0 -9
- package/lib/typescript/src/games/fruit-slicer/components/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts +0 -8
- package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts +0 -9
- package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts +0 -11
- package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/index.d.ts +0 -9
- package/lib/typescript/src/games/fruit-slicer/components/index.d.ts.map +0 -1
- package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts +0 -11
- package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts +0 -17
- package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/SpaceTravellerService.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/SpaceTravellerStore.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts +0 -9
- package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts +0 -17
- package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/GameBackground.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts +0 -9
- package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts +0 -8
- package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts +0 -8
- package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts +0 -9
- package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/Spacecraft3D.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/SpacecraftPath.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/index.d.ts.map +0 -1
- package/lib/typescript/src/shared/settings/GameSettings.d.ts +0 -36
- package/lib/typescript/src/shared/settings/GameSettings.d.ts.map +0 -1
- package/lib/typescript/src/shared/settings/SettingsService.d.ts +0 -32
- package/lib/typescript/src/shared/settings/SettingsService.d.ts.map +0 -1
- /package/lib/typescript/src/games/{cat-popper → fruit-ninja}/components/GameBackground.d.ts +0 -0
- /package/lib/typescript/src/games/{fruit-slicer → space-fighter}/components/GameBackground.d.ts +0 -0
- /package/lib/typescript/src/games/{space-traveller → space-fighter}/components/SpacecraftPath.d.ts +0 -0
- /package/lib/typescript/src/games/{space-traveller → whack-a-mole}/components/GameBackground.d.ts +0 -0
- /package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/ScoreBoard.d.ts +0 -0
|
@@ -1,57 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { create } from 'zustand';
|
|
4
|
+
import { subscribeWithSelector } from 'zustand/middleware';
|
|
4
5
|
import { GAME_CONFIG } from "./BalloonBlasterService.js";
|
|
5
|
-
|
|
6
|
+
import { immerMiddleware } from "../../services/GamesService.js";
|
|
7
|
+
// Optimized store with selective subscriptions for low-end devices
|
|
8
|
+
export const useBalloonBlasterStore = create()(subscribeWithSelector(immerMiddleware((set, get) => ({
|
|
6
9
|
// Initial state
|
|
7
10
|
score: 0,
|
|
8
|
-
timeLeft:
|
|
11
|
+
timeLeft: 60,
|
|
12
|
+
// Fixed 60 seconds regardless of difficulty
|
|
9
13
|
isPlaying: false,
|
|
10
14
|
gameOver: false,
|
|
11
15
|
combo: 0,
|
|
12
16
|
lives: GAME_CONFIG.MAX_LIVES,
|
|
13
17
|
balloons: [],
|
|
18
|
+
particles: [],
|
|
14
19
|
slicePath: [],
|
|
15
20
|
isSlicing: false,
|
|
16
21
|
// Actions
|
|
17
|
-
startGame:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
startGame: _gameDuration => {
|
|
23
|
+
// Always use fixed duration regardless of difficulty or passed duration
|
|
24
|
+
const duration = 60;
|
|
25
|
+
set(draft => {
|
|
26
|
+
draft.score = 0;
|
|
27
|
+
draft.timeLeft = duration;
|
|
28
|
+
draft.isPlaying = true;
|
|
29
|
+
draft.gameOver = false;
|
|
30
|
+
draft.combo = 0;
|
|
31
|
+
draft.lives = GAME_CONFIG.MAX_LIVES;
|
|
32
|
+
draft.balloons = [];
|
|
33
|
+
draft.slicePath = [];
|
|
34
|
+
draft.isSlicing = false;
|
|
29
35
|
});
|
|
30
36
|
},
|
|
31
37
|
stopGame: () => {
|
|
32
|
-
set({
|
|
33
|
-
score
|
|
34
|
-
timeLeft
|
|
35
|
-
isPlaying
|
|
36
|
-
gameOver
|
|
37
|
-
combo
|
|
38
|
-
lives
|
|
39
|
-
balloons
|
|
40
|
-
slicePath
|
|
41
|
-
isSlicing
|
|
38
|
+
set(draft => {
|
|
39
|
+
draft.score = 0;
|
|
40
|
+
draft.timeLeft = 60; // Fixed 60 seconds
|
|
41
|
+
draft.isPlaying = false;
|
|
42
|
+
draft.gameOver = false;
|
|
43
|
+
draft.combo = 0;
|
|
44
|
+
draft.lives = GAME_CONFIG.MAX_LIVES;
|
|
45
|
+
draft.balloons = [];
|
|
46
|
+
draft.slicePath = [];
|
|
47
|
+
draft.isSlicing = false;
|
|
42
48
|
});
|
|
43
49
|
},
|
|
44
50
|
resetGame: () => {
|
|
45
|
-
set({
|
|
46
|
-
score
|
|
47
|
-
timeLeft
|
|
48
|
-
isPlaying
|
|
49
|
-
gameOver
|
|
50
|
-
combo
|
|
51
|
-
lives
|
|
52
|
-
balloons
|
|
53
|
-
slicePath
|
|
54
|
-
isSlicing
|
|
51
|
+
set(draft => {
|
|
52
|
+
draft.score = 0;
|
|
53
|
+
draft.timeLeft = 60; // Fixed 60 seconds
|
|
54
|
+
draft.isPlaying = false;
|
|
55
|
+
draft.gameOver = false;
|
|
56
|
+
draft.combo = 0;
|
|
57
|
+
draft.lives = GAME_CONFIG.MAX_LIVES;
|
|
58
|
+
draft.balloons = [];
|
|
59
|
+
draft.slicePath = [];
|
|
60
|
+
draft.isSlicing = false;
|
|
55
61
|
});
|
|
56
62
|
},
|
|
57
63
|
popBalloon: balloonId => {
|
|
@@ -60,97 +66,118 @@ export const useBalloonBlasterStore = create((set, get) => ({
|
|
|
60
66
|
isPlaying
|
|
61
67
|
} = get();
|
|
62
68
|
if (!isPlaying) return;
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
|
|
70
|
+
// Optimized: Use for-loop instead of find for better performance
|
|
71
|
+
let balloonIndex = -1;
|
|
72
|
+
for (let i = 0; i < balloons.length; i++) {
|
|
73
|
+
if (balloons[i].id === balloonId) {
|
|
74
|
+
balloonIndex = i;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (balloonIndex === -1 || balloons[balloonIndex].isPopped) return;
|
|
65
79
|
|
|
66
80
|
// Simplified scoring: each balloon = 10 points (no combo multipliers)
|
|
67
81
|
const points = 10;
|
|
68
|
-
set(
|
|
69
|
-
score
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
isPopped
|
|
73
|
-
popTime
|
|
74
|
-
}
|
|
75
|
-
})
|
|
82
|
+
set(draft => {
|
|
83
|
+
draft.score = draft.score + points;
|
|
84
|
+
// Optimized: Direct array access instead of find
|
|
85
|
+
if (draft.balloons[balloonIndex]) {
|
|
86
|
+
draft.balloons[balloonIndex].isPopped = true;
|
|
87
|
+
draft.balloons[balloonIndex].popTime = Date.now();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
76
90
|
},
|
|
77
91
|
updateScore: points => {
|
|
78
|
-
set(
|
|
79
|
-
score
|
|
80
|
-
})
|
|
92
|
+
set(draft => {
|
|
93
|
+
draft.score = draft.score + points;
|
|
94
|
+
});
|
|
81
95
|
},
|
|
82
96
|
decrementTime: () => {
|
|
83
|
-
set(
|
|
84
|
-
const newTimeLeft =
|
|
97
|
+
set(draft => {
|
|
98
|
+
const newTimeLeft = draft.timeLeft - 1;
|
|
85
99
|
if (newTimeLeft <= 0) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
draft.timeLeft = 0;
|
|
101
|
+
draft.isPlaying = false;
|
|
102
|
+
draft.gameOver = true;
|
|
103
|
+
} else {
|
|
104
|
+
draft.timeLeft = newTimeLeft;
|
|
91
105
|
}
|
|
92
|
-
return {
|
|
93
|
-
timeLeft: newTimeLeft
|
|
94
|
-
};
|
|
95
106
|
});
|
|
96
107
|
},
|
|
97
108
|
addBalloon: balloon => {
|
|
98
|
-
set(
|
|
99
|
-
|
|
100
|
-
|
|
109
|
+
set(draft => {
|
|
110
|
+
// FORCE all balloons to spawn from bottom - override any wrong positions
|
|
111
|
+
const {
|
|
112
|
+
height
|
|
113
|
+
} = require('react-native').Dimensions.get('window');
|
|
114
|
+
const correctedBalloon = {
|
|
115
|
+
...balloon,
|
|
116
|
+
position: {
|
|
117
|
+
x: balloon.position.x,
|
|
118
|
+
y: height + 20 // Force bottom spawn regardless of input
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
draft.balloons.push(correctedBalloon);
|
|
122
|
+
});
|
|
101
123
|
},
|
|
102
124
|
removeBalloon: balloonId => {
|
|
103
|
-
set(
|
|
104
|
-
balloons
|
|
105
|
-
})
|
|
125
|
+
set(draft => {
|
|
126
|
+
draft.balloons = draft.balloons.filter(b => b.id !== balloonId);
|
|
127
|
+
});
|
|
106
128
|
},
|
|
107
129
|
updateBalloon: (balloonId, updates) => {
|
|
108
|
-
set(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
130
|
+
set(draft => {
|
|
131
|
+
// Optimized: Use for-loop instead of find for better performance
|
|
132
|
+
for (let i = 0; i < draft.balloons.length; i++) {
|
|
133
|
+
if (draft.balloons[i].id === balloonId) {
|
|
134
|
+
Object.assign(draft.balloons[i], updates);
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
setParticles: particles => {
|
|
141
|
+
set(draft => {
|
|
142
|
+
draft.particles = particles;
|
|
143
|
+
});
|
|
114
144
|
},
|
|
115
145
|
setSlicePath: path => {
|
|
116
|
-
set({
|
|
117
|
-
slicePath
|
|
146
|
+
set(draft => {
|
|
147
|
+
draft.slicePath = path;
|
|
118
148
|
});
|
|
119
149
|
},
|
|
120
150
|
setIsSlicing: isSlicing => {
|
|
121
|
-
set({
|
|
122
|
-
isSlicing
|
|
151
|
+
set(draft => {
|
|
152
|
+
draft.isSlicing = isSlicing;
|
|
123
153
|
});
|
|
124
154
|
},
|
|
125
155
|
incrementCombo: () => {
|
|
126
|
-
set(
|
|
127
|
-
combo
|
|
128
|
-
})
|
|
156
|
+
set(draft => {
|
|
157
|
+
draft.combo = draft.combo + 1;
|
|
158
|
+
});
|
|
129
159
|
},
|
|
130
160
|
resetCombo: () => {
|
|
131
|
-
set({
|
|
132
|
-
combo
|
|
161
|
+
set(draft => {
|
|
162
|
+
draft.combo = 0;
|
|
133
163
|
});
|
|
134
164
|
},
|
|
135
165
|
loseLife: () => {
|
|
136
|
-
set(
|
|
137
|
-
const newLives =
|
|
166
|
+
set(draft => {
|
|
167
|
+
const newLives = draft.lives - 1;
|
|
138
168
|
if (newLives <= 0) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
169
|
+
draft.lives = 0;
|
|
170
|
+
draft.isPlaying = false;
|
|
171
|
+
draft.gameOver = true;
|
|
172
|
+
} else {
|
|
173
|
+
draft.lives = newLives;
|
|
144
174
|
}
|
|
145
|
-
return {
|
|
146
|
-
lives: newLives
|
|
147
|
-
};
|
|
148
175
|
});
|
|
149
176
|
},
|
|
150
177
|
addLife: () => {
|
|
151
|
-
set(
|
|
152
|
-
lives
|
|
153
|
-
})
|
|
178
|
+
set(draft => {
|
|
179
|
+
draft.lives = Math.min(draft.lives + 1, GAME_CONFIG.MAX_LIVES); // Cap at max lives
|
|
180
|
+
});
|
|
154
181
|
}
|
|
155
|
-
}));
|
|
182
|
+
}))));
|
|
156
183
|
//# sourceMappingURL=BalloonBlasterStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["create","GAME_CONFIG","useBalloonBlasterStore","set","get","score","timeLeft","
|
|
1
|
+
{"version":3,"names":["create","subscribeWithSelector","GAME_CONFIG","immerMiddleware","useBalloonBlasterStore","set","get","score","timeLeft","isPlaying","gameOver","combo","lives","MAX_LIVES","balloons","particles","slicePath","isSlicing","startGame","_gameDuration","duration","draft","stopGame","resetGame","popBalloon","balloonId","balloonIndex","i","length","id","isPopped","points","popTime","Date","now","updateScore","decrementTime","newTimeLeft","addBalloon","balloon","height","require","Dimensions","correctedBalloon","position","x","y","push","removeBalloon","filter","b","updateBalloon","updates","Object","assign","setParticles","setSlicePath","path","setIsSlicing","incrementCombo","resetCombo","loseLife","newLives","addLife","Math","min"],"sourceRoot":"../../../../src","sources":["games/balloon-blaster/BalloonBlasterStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,qBAAqB,QAAQ,oBAAoB;AAE1D,SAASC,WAAW,QAAQ,4BAAyB;AACrD,SAASC,eAAe,QAAQ,gCAA6B;AAoC7D;AACA,OAAO,MAAMC,sBAAsB,GAAGJ,MAAM,CAAs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D,GAAG,CAAEgB,KAAU,IAAK;MAClBA,KAAK,CAACV,KAAK,GAAG,CAAC;IACjB,CAAC,CAAC;EACJ,CAAC;EAEDkD,QAAQ,EAAEA,CAAA,KAAM;IACdxD,GAAG,CAAEgB,KAAU,IAAK;MAClB,MAAMyC,QAAQ,GAAGzC,KAAK,CAACT,KAAK,GAAG,CAAC;MAChC,IAAIkD,QAAQ,IAAI,CAAC,EAAE;QACjBzC,KAAK,CAACT,KAAK,GAAG,CAAC;QACfS,KAAK,CAACZ,SAAS,GAAG,KAAK;QACvBY,KAAK,CAACX,QAAQ,GAAG,IAAI;MACvB,CAAC,MAAM;QACLW,KAAK,CAACT,KAAK,GAAGkD,QAAQ;MACxB;IACF,CAAC,CAAC;EACJ,CAAC;EAEDC,OAAO,EAAEA,CAAA,KAAM;IACb1D,GAAG,CAAEgB,KAAU,IAAK;MAClBA,KAAK,CAACT,KAAK,GAAGoD,IAAI,CAACC,GAAG,CAAC5C,KAAK,CAACT,KAAK,GAAG,CAAC,EAAEV,WAAW,CAACW,SAAS,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC;EACJ;AACF,CAAC,CAAC,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React, { useEffect } from 'react';
|
|
4
|
-
import { TouchableOpacity } from 'react-native';
|
|
5
|
-
import { Canvas,
|
|
3
|
+
import React, { useEffect, useMemo, useCallback } from 'react';
|
|
4
|
+
import { TouchableOpacity, Dimensions } from 'react-native';
|
|
5
|
+
import { Canvas, vec, Path, Skia, Oval, Circle } from '@shopify/react-native-skia';
|
|
6
6
|
import Animated, { useSharedValue, useAnimatedStyle, withSpring, withTiming } from 'react-native-reanimated';
|
|
7
7
|
import { GAME_CONFIG, ANIMATION_CONFIG } from "../BalloonBlasterService.js";
|
|
8
|
+
|
|
9
|
+
// Constants for better maintainability
|
|
8
10
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
|
|
11
|
+
const BALLOON_HEIGHT_MULTIPLIER = 1.2;
|
|
12
|
+
const STRING_LENGTH = 25;
|
|
13
|
+
const HIGHLIGHT_OPACITY = 0.5;
|
|
14
|
+
const BALLOON_OPACITY = 0.8;
|
|
15
|
+
const DANGER_CIRCLE_RADIUS = 8;
|
|
16
|
+
const GLOW_RADIUS_MULTIPLIER = 0.6;
|
|
17
|
+
const GLOW_OPACITY = 0.3;
|
|
18
|
+
|
|
19
|
+
// Types for better type safety
|
|
20
|
+
|
|
21
|
+
export const BalloonComponent = /*#__PURE__*/React.memo(({
|
|
10
22
|
balloon,
|
|
11
23
|
onPop
|
|
12
24
|
}) => {
|
|
25
|
+
// Get screen dimensions
|
|
26
|
+
const {
|
|
27
|
+
height
|
|
28
|
+
} = Dimensions.get('window');
|
|
29
|
+
|
|
30
|
+
// FORCE all balloons to start from bottom - override any wrong positions
|
|
31
|
+
const initialY = balloon.position.y > height ? balloon.position.y : height + 20;
|
|
32
|
+
|
|
13
33
|
// Animated values for smooth movement
|
|
14
34
|
const translateX = useSharedValue(balloon.position.x);
|
|
15
|
-
const translateY = useSharedValue(
|
|
35
|
+
const translateY = useSharedValue(initialY); // Force bottom start
|
|
16
36
|
const rotation = useSharedValue(balloon.rotation);
|
|
17
37
|
const scale = useSharedValue(balloon.isPopped ? 0 : 1);
|
|
18
38
|
const opacity = useSharedValue(balloon.isPopped ? 0 : 1);
|
|
@@ -56,27 +76,43 @@ export const BalloonComponent = ({
|
|
|
56
76
|
height: GAME_CONFIG.BALLOON_SIZE,
|
|
57
77
|
zIndex: balloon.isBomb ? 10 : 5
|
|
58
78
|
};
|
|
59
|
-
|
|
79
|
+
|
|
80
|
+
// Optimized color manipulation functions
|
|
81
|
+
const lightenColor = useCallback((color, amount) => {
|
|
82
|
+
const hex = color.replace('#', '');
|
|
83
|
+
const r = Math.min(255, parseInt(hex.substring(0, 2), 16) + Math.round(255 * amount));
|
|
84
|
+
const g = Math.min(255, parseInt(hex.substring(2, 4), 16) + Math.round(255 * amount));
|
|
85
|
+
const b = Math.min(255, parseInt(hex.substring(4, 6), 16) + Math.round(255 * amount));
|
|
86
|
+
return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
|
|
87
|
+
}, []);
|
|
88
|
+
const darkenColor = useCallback((color, amount) => {
|
|
89
|
+
const hex = color.replace('#', '');
|
|
90
|
+
const r = Math.max(0, parseInt(hex.substring(0, 2), 16) - Math.round(255 * amount));
|
|
91
|
+
const g = Math.max(0, parseInt(hex.substring(2, 4), 16) - Math.round(255 * amount));
|
|
92
|
+
const b = Math.max(0, parseInt(hex.substring(4, 6), 16) - Math.round(255 * amount));
|
|
93
|
+
return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
|
|
94
|
+
}, []);
|
|
95
|
+
|
|
96
|
+
// Optimized balloon color calculation with proper memoization
|
|
97
|
+
const colors = useMemo(() => {
|
|
60
98
|
if (balloon.isBomb) {
|
|
61
|
-
// Black bomb balloons with danger symbol
|
|
62
99
|
return {
|
|
63
100
|
primary: '#1a1a1a',
|
|
64
|
-
// Dark black
|
|
65
101
|
secondary: '#333333',
|
|
66
|
-
// Slightly lighter black
|
|
67
102
|
highlight: '#555555',
|
|
68
|
-
|
|
69
|
-
|
|
103
|
+
shadow: '#000000'
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (balloon.isBonus) {
|
|
107
|
+
return {
|
|
108
|
+
primary: '#FFD700',
|
|
109
|
+
secondary: '#FFEB3B',
|
|
110
|
+
highlight: '#FFF59D',
|
|
111
|
+
shadow: '#CC8800'
|
|
70
112
|
};
|
|
71
113
|
}
|
|
72
|
-
if (balloon.isBonus) return {
|
|
73
|
-
primary: '#FFD700',
|
|
74
|
-
secondary: '#FFEB3B',
|
|
75
|
-
highlight: '#FFF59D',
|
|
76
|
-
shadow: '#CC8800'
|
|
77
|
-
};
|
|
78
114
|
|
|
79
|
-
//
|
|
115
|
+
// Regular balloon colors with optimized calculation
|
|
80
116
|
const baseColor = balloon.type.color || '#FF0080';
|
|
81
117
|
return {
|
|
82
118
|
primary: baseColor,
|
|
@@ -84,144 +120,118 @@ export const BalloonComponent = ({
|
|
|
84
120
|
highlight: lightenColor(baseColor, 0.5),
|
|
85
121
|
shadow: darkenColor(baseColor, 0.3)
|
|
86
122
|
};
|
|
87
|
-
};
|
|
123
|
+
}, [balloon.isBomb, balloon.isBonus, balloon.type.color, lightenColor, darkenColor]);
|
|
88
124
|
|
|
89
|
-
//
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
const balloonWidth = GAME_CONFIG.BALLOON_SIZE;
|
|
106
|
-
const balloonHeight = GAME_CONFIG.BALLOON_SIZE * 1.2; // Make it oval - taller than wide
|
|
107
|
-
const stringLength = 25; // Length of balloon string
|
|
108
|
-
const totalHeight = balloonHeight + stringLength; // Total height including string
|
|
109
|
-
const center = vec(balloonWidth / 2, balloonHeight / 2);
|
|
110
|
-
|
|
111
|
-
// Generate a unique curved string path for each balloon
|
|
112
|
-
const generateCurvedStringPath = () => {
|
|
125
|
+
// Memoized dimensions for better performance
|
|
126
|
+
const dimensions = useMemo(() => {
|
|
127
|
+
const balloonWidth = GAME_CONFIG.BALLOON_SIZE;
|
|
128
|
+
const balloonHeight = GAME_CONFIG.BALLOON_SIZE * BALLOON_HEIGHT_MULTIPLIER;
|
|
129
|
+
const totalHeight = balloonHeight + STRING_LENGTH;
|
|
130
|
+
const center = vec(balloonWidth / 2, balloonHeight / 2);
|
|
131
|
+
return {
|
|
132
|
+
balloonWidth,
|
|
133
|
+
balloonHeight,
|
|
134
|
+
totalHeight,
|
|
135
|
+
center
|
|
136
|
+
};
|
|
137
|
+
}, []);
|
|
138
|
+
|
|
139
|
+
// Optimized curved string path generation with better memoization
|
|
140
|
+
const curvedStringPath = useMemo(() => {
|
|
113
141
|
const path = Skia.Path.Make();
|
|
114
|
-
const startX = center.x;
|
|
115
|
-
const startY = balloonHeight - 2;
|
|
142
|
+
const startX = dimensions.center.x;
|
|
143
|
+
const startY = dimensions.balloonHeight - 2;
|
|
116
144
|
|
|
117
|
-
//
|
|
145
|
+
// Optimized seed generation for consistent random curves
|
|
118
146
|
const seed = balloon.id.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
119
147
|
const random = index => (seed + index * 17) % 100 / 100;
|
|
120
148
|
path.moveTo(startX, startY);
|
|
121
149
|
|
|
122
|
-
//
|
|
123
|
-
const segments =
|
|
124
|
-
const segmentHeight =
|
|
150
|
+
// Optimized string generation with minimal segments
|
|
151
|
+
const segments = 2;
|
|
152
|
+
const segmentHeight = STRING_LENGTH / segments;
|
|
125
153
|
for (let i = 1; i <= segments; i++) {
|
|
126
154
|
const y = startY + segmentHeight * i;
|
|
127
|
-
const waveAmplitude =
|
|
128
|
-
const waveOffset = (random(i + 10) - 0.5) * waveAmplitude
|
|
155
|
+
const waveAmplitude = 2 + random(i) * 2;
|
|
156
|
+
const waveOffset = (random(i + 10) - 0.5) * waveAmplitude;
|
|
129
157
|
const x = startX + waveOffset;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const controlY1 = y - segmentHeight * 0.3;
|
|
134
|
-
const controlX2 = x + (random(i + 30) - 0.5) * waveAmplitude * 0.5;
|
|
135
|
-
const controlY2 = y - segmentHeight * 0.1;
|
|
136
|
-
path.cubicTo(controlX1, controlY1, controlX2, controlY2, x, y);
|
|
158
|
+
const controlX1 = startX + (random(i + 20) - 0.5) * waveAmplitude * 0.5;
|
|
159
|
+
const controlY1 = y - segmentHeight * 0.5;
|
|
160
|
+
path.quadTo(controlX1, controlY1, x, y);
|
|
137
161
|
}
|
|
138
162
|
return path;
|
|
139
|
-
};
|
|
163
|
+
}, [balloon.id, dimensions.center.x, dimensions.balloonHeight]);
|
|
164
|
+
|
|
165
|
+
// Memoized tap handler for better performance
|
|
166
|
+
const handleTap = useCallback(() => {
|
|
167
|
+
onPop?.(balloon.id);
|
|
168
|
+
}, [onPop, balloon.id]);
|
|
140
169
|
return /*#__PURE__*/_jsx(Animated.View, {
|
|
141
170
|
style: [containerStyle, animatedStyle],
|
|
142
171
|
children: /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
143
|
-
onPress:
|
|
144
|
-
console.log('Balloon tapped:', balloon.id);
|
|
145
|
-
onPop?.(balloon.id);
|
|
146
|
-
},
|
|
172
|
+
onPress: handleTap,
|
|
147
173
|
activeOpacity: 0.8,
|
|
148
174
|
style: {
|
|
149
|
-
width: balloonWidth,
|
|
150
|
-
height: totalHeight
|
|
175
|
+
width: dimensions.balloonWidth,
|
|
176
|
+
height: dimensions.totalHeight
|
|
151
177
|
},
|
|
152
178
|
children: /*#__PURE__*/_jsxs(Canvas, {
|
|
153
179
|
style: {
|
|
154
|
-
width: balloonWidth,
|
|
155
|
-
height: totalHeight
|
|
180
|
+
width: dimensions.balloonWidth,
|
|
181
|
+
height: dimensions.totalHeight
|
|
156
182
|
},
|
|
157
183
|
pointerEvents: "none",
|
|
158
|
-
children: [
|
|
159
|
-
x: 2,
|
|
160
|
-
y: 2,
|
|
161
|
-
width: balloonWidth - 4,
|
|
162
|
-
height: balloonHeight - 4,
|
|
163
|
-
color: colors.shadow,
|
|
164
|
-
opacity: 0.2
|
|
165
|
-
}), /*#__PURE__*/_jsx(Oval, {
|
|
184
|
+
children: [/*#__PURE__*/_jsx(Oval, {
|
|
166
185
|
x: 0,
|
|
167
186
|
y: 0,
|
|
168
|
-
width: balloonWidth,
|
|
169
|
-
height: balloonHeight,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
start: vec(0, 0),
|
|
173
|
-
end: vec(balloonWidth, balloonHeight),
|
|
174
|
-
colors: [colors.highlight, colors.primary, colors.shadow]
|
|
175
|
-
})
|
|
187
|
+
width: dimensions.balloonWidth,
|
|
188
|
+
height: dimensions.balloonHeight,
|
|
189
|
+
color: colors.primary,
|
|
190
|
+
opacity: BALLOON_OPACITY
|
|
176
191
|
}), /*#__PURE__*/_jsx(Oval, {
|
|
177
|
-
x: balloonWidth * 0.
|
|
178
|
-
y: balloonHeight * 0.
|
|
179
|
-
width: balloonWidth * 0.
|
|
180
|
-
height: balloonHeight * 0.
|
|
192
|
+
x: dimensions.balloonWidth * 0.2,
|
|
193
|
+
y: dimensions.balloonHeight * 0.15,
|
|
194
|
+
width: dimensions.balloonWidth * 0.3,
|
|
195
|
+
height: dimensions.balloonHeight * 0.2,
|
|
181
196
|
color: colors.highlight,
|
|
182
|
-
opacity:
|
|
183
|
-
}), /*#__PURE__*/_jsx(Oval, {
|
|
184
|
-
x: balloonWidth * 0.2,
|
|
185
|
-
y: balloonHeight * 0.15,
|
|
186
|
-
width: balloonWidth * 0.2,
|
|
187
|
-
height: balloonHeight * 0.15,
|
|
188
|
-
color: "#FFFFFF",
|
|
189
|
-
opacity: 0.6
|
|
197
|
+
opacity: HIGHLIGHT_OPACITY
|
|
190
198
|
}), balloon.isBomb && /*#__PURE__*/_jsxs(_Fragment, {
|
|
191
|
-
children: [/*#__PURE__*/_jsx(
|
|
192
|
-
|
|
199
|
+
children: [/*#__PURE__*/_jsx(Circle, {
|
|
200
|
+
cx: dimensions.center.x,
|
|
201
|
+
cy: dimensions.center.y,
|
|
202
|
+
r: DANGER_CIRCLE_RADIUS,
|
|
193
203
|
color: "#FF0000",
|
|
194
204
|
opacity: 0.9
|
|
195
205
|
}), /*#__PURE__*/_jsx(Path, {
|
|
196
|
-
path: Skia.Path.Make().moveTo(center.x, center.y -
|
|
206
|
+
path: Skia.Path.Make().moveTo(dimensions.center.x, dimensions.center.y - 4).lineTo(dimensions.center.x, dimensions.center.y + 1),
|
|
197
207
|
color: "#FFFFFF",
|
|
198
208
|
style: "stroke",
|
|
199
209
|
strokeWidth: 2,
|
|
200
210
|
strokeCap: "round"
|
|
201
211
|
}), /*#__PURE__*/_jsx(Circle, {
|
|
202
|
-
cx: center.x,
|
|
203
|
-
cy: center.y +
|
|
204
|
-
r: 1
|
|
212
|
+
cx: dimensions.center.x,
|
|
213
|
+
cy: dimensions.center.y + 3,
|
|
214
|
+
r: 1,
|
|
205
215
|
color: "#FFFFFF"
|
|
206
216
|
})]
|
|
207
217
|
}), !balloon.isBonus && /*#__PURE__*/_jsx(Path, {
|
|
208
|
-
path:
|
|
209
|
-
color: "#8B4513"
|
|
210
|
-
,
|
|
218
|
+
path: curvedStringPath,
|
|
219
|
+
color: "#8B4513",
|
|
211
220
|
style: "stroke",
|
|
212
221
|
strokeWidth: 1.5,
|
|
213
|
-
strokeCap: "round"
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
width: balloonWidth + 10,
|
|
219
|
-
height: balloonHeight + 10,
|
|
222
|
+
strokeCap: "round"
|
|
223
|
+
}), balloon.isBonus && /*#__PURE__*/_jsx(Circle, {
|
|
224
|
+
cx: dimensions.center.x,
|
|
225
|
+
cy: dimensions.center.y,
|
|
226
|
+
r: dimensions.balloonWidth * GLOW_RADIUS_MULTIPLIER,
|
|
220
227
|
color: "#FFD700",
|
|
221
|
-
opacity:
|
|
228
|
+
opacity: GLOW_OPACITY
|
|
222
229
|
})]
|
|
223
230
|
})
|
|
224
231
|
})
|
|
225
232
|
});
|
|
226
|
-
}
|
|
233
|
+
}, (prevProps, nextProps) => {
|
|
234
|
+
// Custom comparison for React.memo - only re-render if essential props change
|
|
235
|
+
return prevProps.balloon.id === nextProps.balloon.id && prevProps.balloon.position.x === nextProps.balloon.position.x && prevProps.balloon.position.y === nextProps.balloon.position.y && prevProps.balloon.rotation === nextProps.balloon.rotation && prevProps.balloon.isPopped === nextProps.balloon.isPopped && prevProps.balloon.isBomb === nextProps.balloon.isBomb && prevProps.balloon.isBonus === nextProps.balloon.isBonus;
|
|
236
|
+
});
|
|
227
237
|
//# sourceMappingURL=BalloonComponent.js.map
|