react-native-games 1.1.0 → 1.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/README.md +101 -30
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -167
- package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +1 -182
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js +1 -318
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +1 -183
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js +1 -237
- package/lib/module/games/balloon-blaster/components/GameArea.js +1 -156
- package/lib/module/games/balloon-blaster/components/GameBackground.js +1 -476
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js +1 -112
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/index.js +1 -7
- package/lib/module/games/bike-racing/BikeRacing.js +1 -0
- package/lib/module/games/bike-racing/BikeRacing.js.map +1 -0
- package/lib/module/games/bike-racing/BikeRacingConstants.js +1 -0
- package/lib/module/games/bike-racing/BikeRacingConstants.js.map +1 -0
- package/lib/module/games/bike-racing/BikeRacingService.js +1 -0
- package/lib/module/games/bike-racing/BikeRacingService.js.map +1 -0
- package/lib/module/games/bike-racing/BikeRacingStore.js +1 -0
- package/lib/module/games/bike-racing/BikeRacingStore.js.map +1 -0
- package/lib/module/games/bike-racing/components/BikeComponent.js +1 -0
- package/lib/module/games/bike-racing/components/BikeComponent.js.map +1 -0
- package/lib/module/games/bike-racing/components/GameBackground.js +1 -0
- package/lib/module/games/bike-racing/components/GameBackground.js.map +1 -0
- package/lib/module/games/bike-racing/components/ScoreBoard.js +1 -0
- package/lib/module/games/bike-racing/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/bike-racing/components/index.js +1 -0
- package/lib/module/games/bike-racing/components/index.js.map +1 -0
- package/lib/module/games/bike-racing/index.js +1 -0
- package/lib/module/games/bike-racing/index.js.map +1 -0
- package/lib/module/games/block-blast/BlockBlast.js +1 -0
- package/lib/module/games/block-blast/BlockBlast.js.map +1 -0
- package/lib/module/games/block-blast/BlockBlastConstants.js +1 -0
- package/lib/module/games/block-blast/BlockBlastConstants.js.map +1 -0
- package/lib/module/games/block-blast/BlockBlastService.js +1 -0
- package/lib/module/games/block-blast/BlockBlastService.js.map +1 -0
- package/lib/module/games/block-blast/BlockBlastStore.js +1 -0
- package/lib/module/games/block-blast/BlockBlastStore.js.map +1 -0
- package/lib/module/games/block-blast/components/BlockPieceComponent.js +1 -0
- package/lib/module/games/block-blast/components/BlockPieceComponent.js.map +1 -0
- package/lib/module/games/block-blast/components/GameArea.js +1 -0
- package/lib/module/games/block-blast/components/GameArea.js.map +1 -0
- package/lib/module/games/block-blast/components/GameBackground.js +1 -0
- package/lib/module/games/block-blast/components/GameBackground.js.map +1 -0
- package/lib/module/games/block-blast/components/GridComponent.js +1 -0
- package/lib/module/games/block-blast/components/GridComponent.js.map +1 -0
- package/lib/module/games/block-blast/components/ScoreBoard.js +1 -0
- package/lib/module/games/block-blast/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/block-blast/components/index.js +1 -0
- package/lib/module/games/block-blast/components/index.js.map +1 -0
- package/lib/module/games/block-blast/index.js +1 -0
- package/lib/module/games/block-blast/index.js.map +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooter.js.map +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterConstants.js +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterConstants.js.map +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterService.js +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterService.js.map +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterStore.js +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterStore.js.map +1 -0
- package/lib/module/games/bubble-shooter/components/GameArea.js +1 -0
- package/lib/module/games/bubble-shooter/components/GameArea.js.map +1 -0
- package/lib/module/games/bubble-shooter/components/GameBackground.js +1 -0
- package/lib/module/games/bubble-shooter/components/GameBackground.js.map +1 -0
- package/lib/module/games/bubble-shooter/components/ScoreBoard.js +1 -0
- package/lib/module/games/bubble-shooter/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/bubble-shooter/components/index.js +1 -0
- package/lib/module/games/bubble-shooter/components/index.js.map +1 -0
- package/lib/module/games/bubble-shooter/index.js +1 -0
- package/lib/module/games/bubble-shooter/index.js.map +1 -0
- package/lib/module/games/candy-crush/CandyCrush.js +1 -131
- package/lib/module/games/candy-crush/CandyCrush.js.map +1 -1
- package/lib/module/games/candy-crush/CandyCrushConstants.js +1 -125
- package/lib/module/games/candy-crush/CandyCrushConstants.js.map +1 -1
- package/lib/module/games/candy-crush/CandyCrushService.js +1 -370
- package/lib/module/games/candy-crush/CandyCrushStore.js +1 -303
- package/lib/module/games/candy-crush/components/CandyItem.js +1 -191
- package/lib/module/games/candy-crush/components/GameBackground.js +1 -85
- package/lib/module/games/candy-crush/components/GameGrid.js +1 -314
- package/lib/module/games/candy-crush/components/ScoreBoard.js +1 -79
- package/lib/module/games/candy-crush/components/index.js +1 -7
- package/lib/module/games/candy-crush/index.js +1 -6
- package/lib/module/games/car-racing/CarRacing.js +1 -0
- package/lib/module/games/car-racing/CarRacing.js.map +1 -0
- package/lib/module/games/car-racing/CarRacingConstants.js +1 -0
- package/lib/module/games/car-racing/CarRacingConstants.js.map +1 -0
- package/lib/module/games/car-racing/CarRacingService.js +1 -0
- package/lib/module/games/car-racing/CarRacingService.js.map +1 -0
- package/lib/module/games/car-racing/CarRacingStore.js +1 -0
- package/lib/module/games/car-racing/CarRacingStore.js.map +1 -0
- package/lib/module/games/car-racing/components/CarComponent.js +1 -0
- package/lib/module/games/car-racing/components/CarComponent.js.map +1 -0
- package/lib/module/games/car-racing/components/GameBackground.js +1 -0
- package/lib/module/games/car-racing/components/GameBackground.js.map +1 -0
- package/lib/module/games/car-racing/components/ScoreBoard.js +1 -0
- package/lib/module/games/car-racing/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/car-racing/components/index.js +1 -0
- package/lib/module/games/car-racing/components/index.js.map +1 -0
- package/lib/module/games/colors-sort/ColorsSort.js +1 -143
- package/lib/module/games/colors-sort/ColorsSort.js.map +1 -1
- package/lib/module/games/colors-sort/ColorsSortConstants.js +1 -72
- package/lib/module/games/colors-sort/ColorsSortConstants.js.map +1 -1
- package/lib/module/games/colors-sort/ColorsSortService.js +1 -255
- package/lib/module/games/colors-sort/ColorsSortStore.js +1 -257
- package/lib/module/games/colors-sort/ColorsSortStore.js.map +1 -1
- package/lib/module/games/colors-sort/components/ColorContainer.js +1 -140
- package/lib/module/games/colors-sort/components/GameBackground.js +1 -135
- package/lib/module/games/colors-sort/components/ScoreBoard.js +1 -70
- package/lib/module/games/colors-sort/components/index.js +1 -6
- package/lib/module/games/dino-jump/DinoJump.js +1 -209
- package/lib/module/games/dino-jump/DinoJump.js.map +1 -1
- package/lib/module/games/dino-jump/DinoJumpConstants.js +1 -189
- package/lib/module/games/dino-jump/DinoJumpConstants.js.map +1 -1
- package/lib/module/games/dino-jump/DinoJumpService.js +1 -270
- package/lib/module/games/dino-jump/DinoJumpStore.js +1 -381
- package/lib/module/games/dino-jump/components/DinoSprite.js +1 -418
- package/lib/module/games/dino-jump/components/DinoSprite.js.map +1 -1
- package/lib/module/games/dino-jump/components/GameArea.js +1 -68
- package/lib/module/games/dino-jump/components/GameBackground.js +1 -444
- package/lib/module/games/dino-jump/components/ObstacleSprite.js +1 -306
- package/lib/module/games/dino-jump/components/ScoreBoard.js +1 -105
- package/lib/module/games/dino-jump/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/dino-jump/components/StarSprite.js +1 -45
- package/lib/module/games/dino-jump/components/index.js +1 -9
- package/lib/module/games/flappy-bird/FlappyBird.js +1 -126
- package/lib/module/games/flappy-bird/FlappyBird.js.map +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js +1 -90
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js.map +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdStore.js +1 -300
- package/lib/module/games/flappy-bird/components/Bird.js +1 -87
- package/lib/module/games/flappy-bird/components/GameArea.js +1 -87
- package/lib/module/games/flappy-bird/components/GameBackground.js +1 -79
- package/lib/module/games/flappy-bird/components/Pipes.js +1 -172
- package/lib/module/games/flappy-bird/components/ScoreBoard.js +1 -73
- package/lib/module/games/flappy-bird/components/index.js +1 -8
- package/lib/module/games/fruit-merger/FruitMerger.js +1 -120
- package/lib/module/games/fruit-merger/FruitMerger.js.map +1 -1
- package/lib/module/games/fruit-merger/FruitMergerConstants.js +1 -119
- package/lib/module/games/fruit-merger/FruitMergerConstants.js.map +1 -1
- package/lib/module/games/fruit-merger/FruitMergerService.js +1 -13
- package/lib/module/games/fruit-merger/FruitMergerStore.js +1 -315
- package/lib/module/games/fruit-merger/components/FruitItem.js +1 -102
- package/lib/module/games/fruit-merger/components/GameArea.js +1 -103
- package/lib/module/games/fruit-merger/components/GameBackground.js +1 -498
- package/lib/module/games/fruit-merger/components/ScoreBoard.js +1 -58
- package/lib/module/games/fruit-merger/components/index.js +1 -7
- package/lib/module/games/fruit-ninja/FruitNinja.js +1 -134
- package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +1 -148
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaService.js +1 -311
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js +1 -191
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -1
- package/lib/module/games/fruit-ninja/components/FruitComponent.js +1 -99
- package/lib/module/games/fruit-ninja/components/GameArea.js +1 -215
- package/lib/module/games/fruit-ninja/components/GameBackground.js +1 -1267
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js +1 -92
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/fruit-ninja/components/index.js +1 -7
- package/lib/module/games/game-2048/Game2048.js +1 -149
- package/lib/module/games/game-2048/Game2048.js.map +1 -1
- package/lib/module/games/game-2048/Game2048Constants.js +1 -263
- package/lib/module/games/game-2048/Game2048Constants.js.map +1 -1
- package/lib/module/games/game-2048/Game2048Service.js +1 -457
- package/lib/module/games/game-2048/Game2048Store.js +1 -236
- package/lib/module/games/game-2048/components/GameBackground.js +1 -247
- package/lib/module/games/game-2048/components/GameGrid.js +1 -139
- package/lib/module/games/game-2048/components/GameTile.js +1 -72
- package/lib/module/games/game-2048/components/ScoreBoard.js +1 -52
- package/lib/module/games/game-2048/components/index.js +1 -7
- package/lib/module/games/maze-runner/MazeRunner.js +1 -267
- package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerConstants.js +1 -100
- package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerService.js +1 -586
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +1 -150
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js +1 -370
- package/lib/module/games/maze-runner/components/GameBackground.js +1 -175
- package/lib/module/games/maze-runner/components/ScoreBoard.js +1 -61
- package/lib/module/games/maze-runner/components/SkiaPipeComponent.js +1 -209
- package/lib/module/games/maze-runner/components/StaticGameBackground.js +1 -169
- package/lib/module/games/maze-runner/components/WallComponent.js +1 -91
- package/lib/module/games/maze-runner/components/index.js +1 -8
- package/lib/module/games/perfect-circle/PerfectCircle.js +1 -0
- package/lib/module/games/perfect-circle/PerfectCircle.js.map +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleConstants.js +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleConstants.js.map +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleService.js +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleService.js.map +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleStore.js +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleStore.js.map +1 -0
- package/lib/module/games/perfect-circle/components/DrawingCanvas.js +1 -0
- package/lib/module/games/perfect-circle/components/DrawingCanvas.js.map +1 -0
- package/lib/module/games/perfect-circle/components/GameBackground.js +1 -0
- package/lib/module/games/perfect-circle/components/GameBackground.js.map +1 -0
- package/lib/module/games/perfect-circle/components/ScoreBoard.js +1 -0
- package/lib/module/games/perfect-circle/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/perfect-circle/index.js +1 -0
- package/lib/module/games/perfect-circle/index.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidget.js +1 -285
- package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js +1 -113
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetService.js +1 -132
- package/lib/module/games/popit-fidget/PopitFidgetStore.js +1 -125
- package/lib/module/games/popit-fidget/components/BubbleComponent.js +1 -198
- package/lib/module/games/popit-fidget/components/FidgetGrid.js +1 -165
- package/lib/module/games/popit-fidget/components/GameBackground.js +1 -177
- package/lib/module/games/popit-fidget/components/ScoreBoard.js +1 -61
- package/lib/module/games/popit-fidget/components/index.js +1 -7
- package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -159
- package/lib/module/games/sliding-numbers/SlidingNumbers.js.map +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +1 -207
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js.map +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersService.js +1 -248
- package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +1 -274
- package/lib/module/games/sliding-numbers/components/GameBackground.js +1 -259
- package/lib/module/games/sliding-numbers/components/NumbersGrid.js +1 -174
- package/lib/module/games/sliding-numbers/components/NumbersTile.js +1 -116
- package/lib/module/games/sliding-numbers/components/ScoreBoard.js +1 -64
- package/lib/module/games/sliding-numbers/components/index.js +1 -7
- package/lib/module/games/snake/Snake.js +1 -189
- package/lib/module/games/snake/Snake.js.map +1 -1
- package/lib/module/games/snake/SnakeConstants.js +1 -138
- package/lib/module/games/snake/SnakeConstants.js.map +1 -1
- package/lib/module/games/snake/SnakeService.js +1 -148
- package/lib/module/games/snake/SnakeStore.js +1 -182
- package/lib/module/games/snake/SnakeStore.js.map +1 -1
- package/lib/module/games/snake/components/GameBackground.js +1 -221
- package/lib/module/games/snake/components/GameGrid.js +1 -153
- package/lib/module/games/snake/components/ScoreBoard.js +1 -51
- package/lib/module/games/snake/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/snake/components/index.js +1 -6
- package/lib/module/games/snake/index.js +1 -6
- package/lib/module/games/space-fighter/SpaceFighter.js +1 -165
- package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -1
- package/lib/module/games/space-fighter/SpaceFighterConstants.js +1 -108
- package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -1
- package/lib/module/games/space-fighter/SpaceFighterService.js +1 -326
- package/lib/module/games/space-fighter/SpaceFighterStore.js +1 -209
- package/lib/module/games/space-fighter/components/AsteroidComponent.js +1 -113
- package/lib/module/games/space-fighter/components/GameArea.js +1 -289
- package/lib/module/games/space-fighter/components/GameBackground.js +1 -239
- package/lib/module/games/space-fighter/components/ScoreBoard.js +1 -136
- package/lib/module/games/space-fighter/components/Spacecraft3D.js +1 -202
- package/lib/module/games/space-fighter/components/SpacecraftPath.js +1 -52
- package/lib/module/games/space-fighter/components/index.js +1 -9
- package/lib/module/games/whack-a-mole/WhackAMole.js +1 -270
- package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +1 -115
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleService.js +1 -120
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js +1 -172
- package/lib/module/games/whack-a-mole/components/GameBackground.js +1 -477
- package/lib/module/games/whack-a-mole/components/GameGrid.js +1 -97
- package/lib/module/games/whack-a-mole/components/GameHole.js +1 -196
- package/lib/module/games/whack-a-mole/components/MoleCharacter.js +1 -241
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js +1 -67
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/whack-a-mole/components/index.js +1 -8
- package/lib/module/helpers/AnimationFrame.js +1 -120
- package/lib/module/helpers/AnimationTracker.js +1 -89
- package/lib/module/helpers/ErrorHandler.js +1 -269
- package/lib/module/helpers/GameControlButton.js +1 -219
- package/lib/module/helpers/GameOverModal.js +1 -144
- package/lib/module/helpers/GameOverModal.js.map +1 -1
- package/lib/module/helpers/GameSettingsModal.js +1 -287
- package/lib/module/helpers/GameSettingsModal.js.map +1 -1
- package/lib/module/helpers/ParticleBlast.js +1 -134
- package/lib/module/helpers/ScoreBoardContainer.js +1 -34
- package/lib/module/helpers/ScoreBoardContainer.js.map +1 -1
- package/lib/module/helpers/index.js +1 -12
- package/lib/module/index.js +1 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/GamesConstants.js +1 -178
- package/lib/module/services/GamesConstants.js.map +1 -1
- package/lib/module/services/GamesService.js +1 -112
- package/lib/module/services/GamesService.js.map +1 -1
- package/lib/module/services/HapticsService.js +1 -77
- package/lib/module/services/ScoringService.js +1 -0
- package/lib/module/services/ScoringService.js.map +1 -0
- package/lib/module/services/SoundsService.js +1 -302
- package/lib/module/services/SoundsService.js.map +1 -1
- package/lib/module/services/UtilsService.js +1 -32
- package/lib/module/services/UtilsService.js.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/bike-racing/BikeRacing.d.ts +4 -0
- package/lib/typescript/src/games/bike-racing/BikeRacing.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingConstants.d.ts +76 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingService.d.ts +22 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingService.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingStore.d.ts +72 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingStore.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/components/BikeComponent.d.ts +12 -0
- package/lib/typescript/src/games/bike-racing/components/BikeComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/components/GameBackground.d.ts +9 -0
- package/lib/typescript/src/games/bike-racing/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/bike-racing/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/components/index.d.ts +4 -0
- package/lib/typescript/src/games/bike-racing/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/index.d.ts +5 -0
- package/lib/typescript/src/games/bike-racing/index.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/BlockBlast.d.ts +4 -0
- package/lib/typescript/src/games/block-blast/BlockBlast.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/BlockBlastConstants.d.ts +82 -0
- package/lib/typescript/src/games/block-blast/BlockBlastConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/BlockBlastService.d.ts +17 -0
- package/lib/typescript/src/games/block-blast/BlockBlastService.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/BlockBlastStore.d.ts +62 -0
- package/lib/typescript/src/games/block-blast/BlockBlastStore.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/BlockPieceComponent.d.ts +14 -0
- package/lib/typescript/src/games/block-blast/components/BlockPieceComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/GameArea.d.ts +12 -0
- package/lib/typescript/src/games/block-blast/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/block-blast/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/GridComponent.d.ts +17 -0
- package/lib/typescript/src/games/block-blast/components/GridComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/block-blast/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/index.d.ts +6 -0
- package/lib/typescript/src/games/block-blast/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/index.d.ts +5 -0
- package/lib/typescript/src/games/block-blast/index.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooter.d.ts +4 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooter.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterConstants.d.ts +61 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterService.d.ts +26 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterService.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterStore.d.ts +62 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterStore.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/components/GameArea.d.ts +9 -0
- package/lib/typescript/src/games/bubble-shooter/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/components/GameBackground.d.ts +8 -0
- package/lib/typescript/src/games/bubble-shooter/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/bubble-shooter/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/components/index.d.ts +4 -0
- package/lib/typescript/src/games/bubble-shooter/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/index.d.ts +3 -0
- package/lib/typescript/src/games/bubble-shooter/index.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/CandyCrush.d.ts.map +1 -1
- package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts +7 -7
- package/lib/typescript/src/games/car-racing/CarRacing.d.ts +4 -0
- package/lib/typescript/src/games/car-racing/CarRacing.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/CarRacingConstants.d.ts +76 -0
- package/lib/typescript/src/games/car-racing/CarRacingConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/CarRacingService.d.ts +22 -0
- package/lib/typescript/src/games/car-racing/CarRacingService.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/CarRacingStore.d.ts +72 -0
- package/lib/typescript/src/games/car-racing/CarRacingStore.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/components/CarComponent.d.ts +13 -0
- package/lib/typescript/src/games/car-racing/components/CarComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/components/GameBackground.d.ts +9 -0
- package/lib/typescript/src/games/car-racing/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/car-racing/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/components/index.d.ts +4 -0
- package/lib/typescript/src/games/car-racing/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/ColorsSort.d.ts.map +1 -1
- package/lib/typescript/src/games/colors-sort/ColorsSortStore.d.ts.map +1 -1
- package/lib/typescript/src/games/dino-jump/DinoJump.d.ts.map +1 -1
- package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts.map +1 -1
- package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts.map +1 -1
- package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/game-2048/Game2048.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
- package/lib/typescript/src/games/perfect-circle/PerfectCircle.d.ts +4 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircle.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleConstants.d.ts +81 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleService.d.ts +14 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleService.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleStore.d.ts +40 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleStore.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/components/DrawingCanvas.d.ts +9 -0
- package/lib/typescript/src/games/perfect-circle/components/DrawingCanvas.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/components/GameBackground.d.ts +8 -0
- package/lib/typescript/src/games/perfect-circle/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/perfect-circle/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/index.d.ts +3 -0
- package/lib/typescript/src/games/perfect-circle/index.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -1
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts.map +1 -1
- package/lib/typescript/src/games/snake/Snake.d.ts.map +1 -1
- package/lib/typescript/src/games/snake/SnakeStore.d.ts +4 -0
- package/lib/typescript/src/games/snake/SnakeStore.d.ts.map +1 -1
- package/lib/typescript/src/games/snake/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +1 -1
- package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/helpers/GameOverModal.d.ts +3 -0
- package/lib/typescript/src/helpers/GameOverModal.d.ts.map +1 -1
- package/lib/typescript/src/helpers/ScoreBoardContainer.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesConstants.d.ts +57 -7
- package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesService.d.ts +2 -1
- package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
- package/lib/typescript/src/services/ScoringService.d.ts +2 -0
- package/lib/typescript/src/services/ScoringService.d.ts.map +1 -0
- package/lib/typescript/src/services/SoundsService.d.ts +88 -0
- package/lib/typescript/src/services/SoundsService.d.ts.map +1 -1
- package/lib/typescript/src/services/UtilsService.d.ts +12 -1
- package/lib/typescript/src/services/UtilsService.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,189 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Dimensions } from 'react-native';
|
|
4
|
-
// Memoize screen dimensions for better performance
|
|
5
|
-
const {
|
|
6
|
-
width,
|
|
7
|
-
height
|
|
8
|
-
} = Dimensions.get('window');
|
|
9
|
-
|
|
10
|
-
// Dinosaur Jump Game Constants
|
|
11
|
-
export const DINO_JUMP_CONSTANTS = {
|
|
12
|
-
// Chrome dino physics - more realistic
|
|
13
|
-
gravity: 1.0,
|
|
14
|
-
jumpForce: -20,
|
|
15
|
-
// Higher jump for better obstacle clearance
|
|
16
|
-
gameSpeed: {
|
|
17
|
-
easy: 4,
|
|
18
|
-
// Chrome dino starts slower
|
|
19
|
-
medium: 6,
|
|
20
|
-
hard: 8
|
|
21
|
-
},
|
|
22
|
-
// Chrome dino scoring - distance based
|
|
23
|
-
baseScore: {
|
|
24
|
-
easy: 1,
|
|
25
|
-
// 1 point per frame
|
|
26
|
-
medium: 1,
|
|
27
|
-
hard: 1
|
|
28
|
-
},
|
|
29
|
-
scoreMultiplier: {
|
|
30
|
-
easy: 1,
|
|
31
|
-
medium: 1.5,
|
|
32
|
-
hard: 2
|
|
33
|
-
},
|
|
34
|
-
// Speed increase over time (Chrome dino gets faster)
|
|
35
|
-
speedIncreaseRate: 0.001,
|
|
36
|
-
maxSpeed: 12,
|
|
37
|
-
// Time limits per difficulty (in seconds)
|
|
38
|
-
timeLimit: {
|
|
39
|
-
easy: 120,
|
|
40
|
-
// 2 minutes
|
|
41
|
-
medium: 180,
|
|
42
|
-
// 3 minutes
|
|
43
|
-
hard: 300 // 5 minutes
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
export const DINO_JUMP_GAME_CONFIG = {
|
|
47
|
-
// Screen dimensions
|
|
48
|
-
SCREEN_WIDTH: width,
|
|
49
|
-
SCREEN_HEIGHT: height,
|
|
50
|
-
GROUND_HEIGHT: 150,
|
|
51
|
-
// Default ground height (used when offset > 0)
|
|
52
|
-
|
|
53
|
-
// Dinosaur properties
|
|
54
|
-
DINOSAUR_WIDTH: 55,
|
|
55
|
-
DINOSAUR_HEIGHT: 58,
|
|
56
|
-
DINOSAUR_X: 80,
|
|
57
|
-
// Fixed X position
|
|
58
|
-
|
|
59
|
-
// Obstacle properties
|
|
60
|
-
OBSTACLE_WIDTH: 20,
|
|
61
|
-
OBSTACLE_HEIGHT: 40,
|
|
62
|
-
OBSTACLE_SPAWN_DISTANCE: 600,
|
|
63
|
-
// Distance between obstacles
|
|
64
|
-
|
|
65
|
-
// Game timing
|
|
66
|
-
GAME_DURATION: 120,
|
|
67
|
-
// 5 minutes in seconds
|
|
68
|
-
PHYSICS_FRAME_RATE: 60,
|
|
69
|
-
// 60 FPS
|
|
70
|
-
OBSTACLE_SPAWN_INTERVAL: 2000,
|
|
71
|
-
// 2 seconds
|
|
72
|
-
|
|
73
|
-
// Animation
|
|
74
|
-
JUMP_DURATION: 600,
|
|
75
|
-
// milliseconds
|
|
76
|
-
GROUND_SCROLL_SPEED: 4 // pixels per frame
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// Helper function to get dynamic ground height based on offset
|
|
80
|
-
export const getGroundHeight = (offset = 0) => {
|
|
81
|
-
return offset > 0 ? 150 : 250;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// Helper function to get ground Y position
|
|
85
|
-
export const getGroundY = (offset = 0) => {
|
|
86
|
-
return height - getGroundHeight(offset);
|
|
87
|
-
};
|
|
88
|
-
export const DINO_JUMP_ANIMATION_CONFIG = {
|
|
89
|
-
DINO_JUMP: {
|
|
90
|
-
damping: 15,
|
|
91
|
-
stiffness: 300,
|
|
92
|
-
mass: 1
|
|
93
|
-
},
|
|
94
|
-
OBSTACLE_MOVE: {
|
|
95
|
-
duration: 3000 // 3 seconds to cross screen
|
|
96
|
-
},
|
|
97
|
-
COLLISION_FEEDBACK: {
|
|
98
|
-
duration: 200,
|
|
99
|
-
intensity: 0.1
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
export const DINO_JUMP_COLORS = {
|
|
103
|
-
// Background colors - vibrant and colorful
|
|
104
|
-
SKY_TOP: '#FF9A9E',
|
|
105
|
-
// Soft pink gradient
|
|
106
|
-
SKY_BOTTOM: '#FECFEF',
|
|
107
|
-
// Light pink
|
|
108
|
-
GROUND: '#FFD93D',
|
|
109
|
-
// Bright sunny yellow
|
|
110
|
-
GROUND_LINE: '#FF6B6B',
|
|
111
|
-
// Coral red
|
|
112
|
-
|
|
113
|
-
// Dinosaur colors - bright and fun
|
|
114
|
-
DINOSAUR_PRIMARY: '#4ECDC4',
|
|
115
|
-
// Bright teal
|
|
116
|
-
DINOSAUR_SECONDARY: '#45B7D1',
|
|
117
|
-
// Sky blue
|
|
118
|
-
DINOSAUR_OUTLINE: '#2C3E50',
|
|
119
|
-
// Dark blue-gray
|
|
120
|
-
|
|
121
|
-
// Obstacle colors (cactus) - vibrant greens
|
|
122
|
-
OBSTACLE_PRIMARY: '#2ECC71',
|
|
123
|
-
// Emerald green
|
|
124
|
-
OBSTACLE_SECONDARY: '#27AE60',
|
|
125
|
-
// Darker emerald
|
|
126
|
-
OBSTACLE_OUTLINE: '#1E8449',
|
|
127
|
-
// Forest green
|
|
128
|
-
|
|
129
|
-
// UI colors - bright and engaging
|
|
130
|
-
SCORE_TEXT: '#2C3E50',
|
|
131
|
-
// Dark blue-gray
|
|
132
|
-
GAME_OVER_OVERLAY: 'rgba(231, 76, 60, 0.8)',
|
|
133
|
-
// Red overlay
|
|
134
|
-
BUTTON_PRIMARY: '#E74C3C',
|
|
135
|
-
// Bright red
|
|
136
|
-
BUTTON_SECONDARY: '#C0392B',
|
|
137
|
-
// Dark red
|
|
138
|
-
TEXT_PRIMARY: '#FFFFFF',
|
|
139
|
-
TEXT_SECONDARY: '#ECF0F1',
|
|
140
|
-
// Light gray
|
|
141
|
-
|
|
142
|
-
// Cloud colors - soft and dreamy
|
|
143
|
-
CLOUD_COLOR: '#FFFFFF',
|
|
144
|
-
CLOUD_SHADOW: 'rgba(52, 152, 219, 0.2)' // Blue shadow
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// Dinosaur states for animation
|
|
148
|
-
export const DINOSAUR_STATES = {
|
|
149
|
-
RUNNING: 'running',
|
|
150
|
-
JUMPING: 'jumping',
|
|
151
|
-
DUCKING: 'ducking',
|
|
152
|
-
DEAD: 'dead'
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// Obstacle types
|
|
156
|
-
export const OBSTACLE_TYPES = {
|
|
157
|
-
CACTUS_SMALL: 'cactus_small',
|
|
158
|
-
CACTUS_LARGE: 'cactus_large',
|
|
159
|
-
BIRD: 'bird'
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// Dinosaur Jump Game Theme - Desert/Orange theme
|
|
163
|
-
export const DINO_JUMP_THEME = {
|
|
164
|
-
backgroundColor: '#F0E68C',
|
|
165
|
-
// Khaki background like desert
|
|
166
|
-
headerBackgroundColor: 'rgba(255, 99, 71, 0.9)',
|
|
167
|
-
// Tomato header
|
|
168
|
-
headerTextColor: '#ffffff',
|
|
169
|
-
sectionBackgroundColor: 'rgba(255, 99, 71, 0.4)',
|
|
170
|
-
// Light tomato sections
|
|
171
|
-
sectionTitleColor: '#ffffff',
|
|
172
|
-
buttonSelectedColor: '#FF6347',
|
|
173
|
-
// Tomato for selected
|
|
174
|
-
buttonUnselectedColor: 'rgba(255, 255, 255, 0.3)',
|
|
175
|
-
buttonSelectedTextColor: '#ffffff',
|
|
176
|
-
buttonUnselectedTextColor: '#1f2937',
|
|
177
|
-
switchTrackColorFalse: 'rgba(255, 99, 71, 0.5)',
|
|
178
|
-
switchTrackColorTrue: '#FF6347',
|
|
179
|
-
switchThumbColor: '#ffffff',
|
|
180
|
-
infoTextColor: '#1f2937' // Dark text for readability
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// Dinosaur Jump Difficulty Descriptions
|
|
184
|
-
export const DINO_JUMP_DIFFICULTY_DESCRIPTIONS = {
|
|
185
|
-
easy: 'Slow speed, easy obstacles, perfect for beginners',
|
|
186
|
-
medium: 'Medium speed, moderate challenge with mixed obstacles',
|
|
187
|
-
hard: 'Fast speed, frequent obstacles, expert level challenge'
|
|
188
|
-
};
|
|
189
|
-
//# sourceMappingURL=DinoJumpConstants.js.map
|
|
1
|
+
"use strict";import{Dimensions}from 'react-native';const{width,height}= Dimensions.get('window');export const DINO_JUMP_CONSTANTS ={gravity:1.0,jumpForce:-20,gameSpeed:{easy:4,medium:6,hard:8},baseScore:{easy:1,medium:1,hard:1},scoreMultiplier:{easy:1,medium:1.5,hard:2},speedIncreaseRate:0.001,maxSpeed:12,timeLimit:{easy:120,medium:180,hard:300}};export const DINO_JUMP_GAME_CONFIG ={SCREEN_WIDTH:width,SCREEN_HEIGHT:height,GROUND_HEIGHT:150,DINOSAUR_WIDTH:55,DINOSAUR_HEIGHT:58,DINOSAUR_X:80,OBSTACLE_WIDTH:20,OBSTACLE_HEIGHT:40,OBSTACLE_SPAWN_DISTANCE:600,GAME_DURATION:120,PHYSICS_FRAME_RATE:60,OBSTACLE_SPAWN_INTERVAL:2000,JUMP_DURATION:600,GROUND_SCROLL_SPEED:4};export const getGroundHeight =(offset = 0)=>{return offset > 0 ? 150:250;};export const getGroundY =(offset = 0)=>{return height - getGroundHeight(offset);};export const DINO_JUMP_ANIMATION_CONFIG ={DINO_JUMP:{damping:15,stiffness:300,mass:1},OBSTACLE_MOVE:{duration:3000},COLLISION_FEEDBACK:{duration:200,intensity:0.1}};export const DINO_JUMP_COLORS ={SKY_TOP:'#FF9A9E',SKY_BOTTOM:'#FECFEF',GROUND:'#FFD93D',GROUND_LINE:'#FF6B6B',DINOSAUR_PRIMARY:'#4ECDC4',DINOSAUR_SECONDARY:'#45B7D1',DINOSAUR_OUTLINE:'#2C3E50',OBSTACLE_PRIMARY:'#2ECC71',OBSTACLE_SECONDARY:'#27AE60',OBSTACLE_OUTLINE:'#1E8449',SCORE_TEXT:'#2C3E50',GAME_OVER_OVERLAY:'rgba(231,76,60,0.8)',BUTTON_PRIMARY:'#E74C3C',BUTTON_SECONDARY:'#C0392B',TEXT_PRIMARY:'#FFFFFF',TEXT_SECONDARY:'#ECF0F1',CLOUD_COLOR:'#FFFFFF',CLOUD_SHADOW:'rgba(52,152,219,0.2)'};export const DINOSAUR_STATES ={RUNNING:'running',JUMPING:'jumping',DUCKING:'ducking',DEAD:'dead'};export const OBSTACLE_TYPES ={CACTUS_SMALL:'cactus_small',CACTUS_LARGE:'cactus_large',BIRD:'bird'};export const DINO_JUMP_THEME ={backgroundColor:'rgba(0,0,0,0.7)',headerBackgroundColor:'#FF6347',headerTextColor:'#ffffff',sectionBackgroundColor:'rgba(255,99,71,0.15)',sectionTitleColor:'#FF6347',buttonSelectedColor:'#FF6347',buttonUnselectedColor:'rgba(255,255,255,0.2)',buttonSelectedTextColor:'#ffffff',buttonUnselectedTextColor:'rgba(255,255,255,0.7)',switchTrackColorFalse:'rgba(255,99,71,0.3)',switchTrackColorTrue:'#FF6347',switchThumbColor:'#ffffff',infoTextColor:'rgba(255,255,255,0.9)'};export const DINO_JUMP_DIFFICULTY_DESCRIPTIONS ={easy:'Slow speed,easy obstacles,perfect for beginners',medium:'Medium speed,moderate challenge with mixed obstacles',hard:'Fast speed,frequent obstacles,expert level challenge'};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Dimensions","width","height","get","DINO_JUMP_CONSTANTS","gravity","jumpForce","gameSpeed","easy","medium","hard","baseScore","scoreMultiplier","speedIncreaseRate","maxSpeed","timeLimit","DINO_JUMP_GAME_CONFIG","SCREEN_WIDTH","SCREEN_HEIGHT","GROUND_HEIGHT","DINOSAUR_WIDTH","DINOSAUR_HEIGHT","DINOSAUR_X","OBSTACLE_WIDTH","OBSTACLE_HEIGHT","OBSTACLE_SPAWN_DISTANCE","GAME_DURATION","PHYSICS_FRAME_RATE","OBSTACLE_SPAWN_INTERVAL","JUMP_DURATION","GROUND_SCROLL_SPEED","getGroundHeight","offset","getGroundY","DINO_JUMP_ANIMATION_CONFIG","DINO_JUMP","damping","stiffness","mass","OBSTACLE_MOVE","duration","COLLISION_FEEDBACK","intensity","DINO_JUMP_COLORS","SKY_TOP","SKY_BOTTOM","GROUND","GROUND_LINE","DINOSAUR_PRIMARY","DINOSAUR_SECONDARY","DINOSAUR_OUTLINE","OBSTACLE_PRIMARY","OBSTACLE_SECONDARY","OBSTACLE_OUTLINE","SCORE_TEXT","GAME_OVER_OVERLAY","BUTTON_PRIMARY","BUTTON_SECONDARY","TEXT_PRIMARY","TEXT_SECONDARY","CLOUD_COLOR","CLOUD_SHADOW","DINOSAUR_STATES","RUNNING","JUMPING","DUCKING","DEAD","OBSTACLE_TYPES","CACTUS_SMALL","CACTUS_LARGE","BIRD","DINO_JUMP_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","DINO_JUMP_DIFFICULTY_DESCRIPTIONS"],"sourceRoot":"../../../../src","sources":["games/dino-jump/DinoJumpConstants.ts"],"mappings":"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
|
|
1
|
+
{"version":3,"names":["Dimensions","width","height","get","DINO_JUMP_CONSTANTS","gravity","jumpForce","gameSpeed","easy","medium","hard","baseScore","scoreMultiplier","speedIncreaseRate","maxSpeed","timeLimit","DINO_JUMP_GAME_CONFIG","SCREEN_WIDTH","SCREEN_HEIGHT","GROUND_HEIGHT","DINOSAUR_WIDTH","DINOSAUR_HEIGHT","DINOSAUR_X","OBSTACLE_WIDTH","OBSTACLE_HEIGHT","OBSTACLE_SPAWN_DISTANCE","GAME_DURATION","PHYSICS_FRAME_RATE","OBSTACLE_SPAWN_INTERVAL","JUMP_DURATION","GROUND_SCROLL_SPEED","getGroundHeight","offset","getGroundY","DINO_JUMP_ANIMATION_CONFIG","DINO_JUMP","damping","stiffness","mass","OBSTACLE_MOVE","duration","COLLISION_FEEDBACK","intensity","DINO_JUMP_COLORS","SKY_TOP","SKY_BOTTOM","GROUND","GROUND_LINE","DINOSAUR_PRIMARY","DINOSAUR_SECONDARY","DINOSAUR_OUTLINE","OBSTACLE_PRIMARY","OBSTACLE_SECONDARY","OBSTACLE_OUTLINE","SCORE_TEXT","GAME_OVER_OVERLAY","BUTTON_PRIMARY","BUTTON_SECONDARY","TEXT_PRIMARY","TEXT_SECONDARY","CLOUD_COLOR","CLOUD_SHADOW","DINOSAUR_STATES","RUNNING","JUMPING","DUCKING","DEAD","OBSTACLE_TYPES","CACTUS_SMALL","CACTUS_LARGE","BIRD","DINO_JUMP_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","DINO_JUMP_DIFFICULTY_DESCRIPTIONS"],"sourceRoot":"../../../../src","sources":["games/dino-jump/DinoJumpConstants.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,270 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { DINO_JUMP_CONSTANTS, DINO_JUMP_GAME_CONFIG, getGroundY } from "./DinoJumpConstants.js";
|
|
4
|
-
export class DinoJumpService {
|
|
5
|
-
gameTimer = null;
|
|
6
|
-
physicsAnimationId = null;
|
|
7
|
-
obstacleTimer = null;
|
|
8
|
-
cloudTimer = null;
|
|
9
|
-
starTimer = null;
|
|
10
|
-
lastFrameTime = 0;
|
|
11
|
-
obstacleId = 0;
|
|
12
|
-
cloudId = 0;
|
|
13
|
-
starId = 0;
|
|
14
|
-
isPhysicsRunning = false;
|
|
15
|
-
constructor() {
|
|
16
|
-
this.lastFrameTime = performance.now();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Get difficulty settings
|
|
20
|
-
getDifficultySettings(difficulty) {
|
|
21
|
-
return {
|
|
22
|
-
speed: DINO_JUMP_CONSTANTS.gameSpeed[difficulty],
|
|
23
|
-
baseScore: DINO_JUMP_CONSTANTS.baseScore[difficulty],
|
|
24
|
-
scoreMultiplier: DINO_JUMP_CONSTANTS.scoreMultiplier[difficulty],
|
|
25
|
-
obstacleSpawnRate: difficulty === 'easy' ? 3000 : difficulty === 'medium' ? 2000 : 1500
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Start game timer
|
|
30
|
-
startTimer(decrementTimeCallback) {
|
|
31
|
-
this.stopTimer();
|
|
32
|
-
this.gameTimer = setInterval(() => {
|
|
33
|
-
decrementTimeCallback();
|
|
34
|
-
}, 1000);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Stop game timer
|
|
38
|
-
stopTimer() {
|
|
39
|
-
if (this.gameTimer) {
|
|
40
|
-
clearInterval(this.gameTimer);
|
|
41
|
-
this.gameTimer = null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Start physics loop
|
|
46
|
-
startPhysicsLoop(updateDinosaur, updateObstacles, updateClouds, updateStars, updateGround, updateScore, updateSpeed, checkCollisions, stopGame) {
|
|
47
|
-
this.stopPhysicsLoop();
|
|
48
|
-
this.isPhysicsRunning = true;
|
|
49
|
-
this.lastFrameTime = performance.now();
|
|
50
|
-
const physicsLoop = currentTime => {
|
|
51
|
-
if (!this.isPhysicsRunning) return;
|
|
52
|
-
const deltaTime = Math.min((currentTime - this.lastFrameTime) / 1000, 0.016); // Cap at 60fps
|
|
53
|
-
this.lastFrameTime = currentTime;
|
|
54
|
-
try {
|
|
55
|
-
// Update game objects
|
|
56
|
-
updateDinosaur(deltaTime);
|
|
57
|
-
updateObstacles(deltaTime);
|
|
58
|
-
updateClouds(deltaTime);
|
|
59
|
-
updateStars(deltaTime);
|
|
60
|
-
updateGround(deltaTime);
|
|
61
|
-
|
|
62
|
-
// Update score (distance-based)
|
|
63
|
-
updateScore(1);
|
|
64
|
-
updateSpeed();
|
|
65
|
-
|
|
66
|
-
// Check for collisions (collision handler will stop game if lives reach 0)
|
|
67
|
-
checkCollisions();
|
|
68
|
-
|
|
69
|
-
// Continue loop using requestAnimationFrame for better performance
|
|
70
|
-
if (this.isPhysicsRunning) {
|
|
71
|
-
this.physicsAnimationId = requestAnimationFrame(physicsLoop);
|
|
72
|
-
}
|
|
73
|
-
} catch (error) {
|
|
74
|
-
console.error('Physics loop error:', error);
|
|
75
|
-
this.stopPhysicsLoop();
|
|
76
|
-
stopGame();
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
this.physicsAnimationId = requestAnimationFrame(physicsLoop);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Stop physics loop
|
|
83
|
-
stopPhysicsLoop() {
|
|
84
|
-
this.isPhysicsRunning = false;
|
|
85
|
-
if (this.physicsAnimationId) {
|
|
86
|
-
cancelAnimationFrame(this.physicsAnimationId);
|
|
87
|
-
this.physicsAnimationId = null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Start obstacle spawning
|
|
92
|
-
startObstacleSpawning(addObstacle, difficulty, getOffset) {
|
|
93
|
-
this.stopObstacleSpawning();
|
|
94
|
-
const settings = this.getDifficultySettings(difficulty);
|
|
95
|
-
const spawnObstacle = () => {
|
|
96
|
-
const offset = getOffset();
|
|
97
|
-
const obstacle = this.createRandomObstacle(offset);
|
|
98
|
-
addObstacle(obstacle);
|
|
99
|
-
|
|
100
|
-
// Schedule next obstacle
|
|
101
|
-
const nextSpawnTime = settings.obstacleSpawnRate + Math.random() * 1000; // Add randomness
|
|
102
|
-
this.obstacleTimer = setTimeout(spawnObstacle, nextSpawnTime);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// Start spawning after initial delay
|
|
106
|
-
this.obstacleTimer = setTimeout(spawnObstacle, 2000);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Stop obstacle spawning
|
|
110
|
-
stopObstacleSpawning() {
|
|
111
|
-
if (this.obstacleTimer) {
|
|
112
|
-
clearTimeout(this.obstacleTimer);
|
|
113
|
-
this.obstacleTimer = null;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Start cloud spawning
|
|
118
|
-
startCloudSpawning(addCloud) {
|
|
119
|
-
this.stopCloudSpawning();
|
|
120
|
-
const spawnCloud = () => {
|
|
121
|
-
const cloud = this.createRandomCloud();
|
|
122
|
-
addCloud(cloud);
|
|
123
|
-
|
|
124
|
-
// Schedule next cloud (clouds spawn less frequently)
|
|
125
|
-
const nextSpawnTime = 5000 + Math.random() * 5000; // 5-10 seconds
|
|
126
|
-
this.cloudTimer = setTimeout(spawnCloud, nextSpawnTime);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// Start spawning clouds
|
|
130
|
-
this.cloudTimer = setTimeout(spawnCloud, 3000);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Stop cloud spawning
|
|
134
|
-
stopCloudSpawning() {
|
|
135
|
-
if (this.cloudTimer) {
|
|
136
|
-
clearTimeout(this.cloudTimer);
|
|
137
|
-
this.cloudTimer = null;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Start star spawning
|
|
142
|
-
startStarSpawning(addStar, getOffset) {
|
|
143
|
-
this.stopStarSpawning();
|
|
144
|
-
const spawnStar = () => {
|
|
145
|
-
const offset = getOffset();
|
|
146
|
-
const star = this.createRandomStar(offset);
|
|
147
|
-
addStar(star);
|
|
148
|
-
|
|
149
|
-
// Schedule next star (stars spawn occasionally)
|
|
150
|
-
const nextSpawnTime = 8000 + Math.random() * 7000; // 8-15 seconds
|
|
151
|
-
this.starTimer = setTimeout(spawnStar, nextSpawnTime);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
// Start spawning stars after initial delay
|
|
155
|
-
this.starTimer = setTimeout(spawnStar, 10000);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// Stop star spawning
|
|
159
|
-
stopStarSpawning() {
|
|
160
|
-
if (this.starTimer) {
|
|
161
|
-
clearTimeout(this.starTimer);
|
|
162
|
-
this.starTimer = null;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Create random obstacle (needs offset parameter)
|
|
167
|
-
createRandomObstacle(offset = 0) {
|
|
168
|
-
const types = ['cactus_small', 'cactus_large'];
|
|
169
|
-
const type = types[Math.floor(Math.random() * types.length)];
|
|
170
|
-
let width, height, y;
|
|
171
|
-
const groundY = getGroundY(offset);
|
|
172
|
-
switch (type) {
|
|
173
|
-
case 'cactus_small':
|
|
174
|
-
width = 22;
|
|
175
|
-
height = 45;
|
|
176
|
-
y = groundY - height - 22; // Exactly on top of ground
|
|
177
|
-
break;
|
|
178
|
-
case 'cactus_large':
|
|
179
|
-
width = 32;
|
|
180
|
-
height = 65;
|
|
181
|
-
y = groundY - height - 22; // Exactly on top of ground
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
return {
|
|
185
|
-
id: `obstacle_${this.obstacleId++}`,
|
|
186
|
-
type,
|
|
187
|
-
x: DINO_JUMP_GAME_CONFIG.SCREEN_WIDTH + 50,
|
|
188
|
-
y,
|
|
189
|
-
width,
|
|
190
|
-
height,
|
|
191
|
-
speed: 5 // Base speed, will be modified by game speed
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// Create random cloud
|
|
196
|
-
createRandomCloud() {
|
|
197
|
-
return {
|
|
198
|
-
id: `cloud_${this.cloudId++}`,
|
|
199
|
-
x: DINO_JUMP_GAME_CONFIG.SCREEN_WIDTH + 50,
|
|
200
|
-
y: 50 + Math.random() * 80,
|
|
201
|
-
// Sky height
|
|
202
|
-
width: 46 + Math.random() * 30,
|
|
203
|
-
height: 14 + Math.random() * 10,
|
|
204
|
-
speed: 1 + Math.random() * 2 // Slow moving
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Create random star (mushroom) (needs offset parameter)
|
|
209
|
-
createRandomStar(offset = 0) {
|
|
210
|
-
const groundY = getGroundY(offset);
|
|
211
|
-
const width = 45;
|
|
212
|
-
const height = 45;
|
|
213
|
-
return {
|
|
214
|
-
id: `star_${this.starId++}`,
|
|
215
|
-
x: DINO_JUMP_GAME_CONFIG.SCREEN_WIDTH + 50,
|
|
216
|
-
y: groundY - height - 5,
|
|
217
|
-
// Same as obstacles - sits on ground
|
|
218
|
-
width,
|
|
219
|
-
height,
|
|
220
|
-
speed: 5 // Same speed as obstacles
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Format time for display
|
|
225
|
-
formatTime(timeInSeconds) {
|
|
226
|
-
const minutes = Math.floor(timeInSeconds / 60);
|
|
227
|
-
const seconds = timeInSeconds % 60;
|
|
228
|
-
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Calculate final score
|
|
232
|
-
calculateFinalScore(score, timeElapsed, difficulty) {
|
|
233
|
-
const settings = this.getDifficultySettings(difficulty);
|
|
234
|
-
const timeBonus = Math.max(0, 300 - timeElapsed) * settings.scoreMultiplier;
|
|
235
|
-
return score + timeBonus;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Check if new high score
|
|
239
|
-
isNewHighScore(currentScore, previousHighScore) {
|
|
240
|
-
return currentScore > previousHighScore;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// Generate random ground pattern for visual variety
|
|
244
|
-
generateGroundPattern() {
|
|
245
|
-
const pattern = [];
|
|
246
|
-
for (let i = 0; i < 20; i++) {
|
|
247
|
-
pattern.push(Math.random() * 3); // Random height variation
|
|
248
|
-
}
|
|
249
|
-
return pattern;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// Cleanup all timers and intervals
|
|
253
|
-
cleanup() {
|
|
254
|
-
this.stopTimer();
|
|
255
|
-
this.stopPhysicsLoop();
|
|
256
|
-
this.stopObstacleSpawning();
|
|
257
|
-
this.stopCloudSpawning();
|
|
258
|
-
this.stopStarSpawning();
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Reset service state
|
|
262
|
-
reset() {
|
|
263
|
-
this.cleanup();
|
|
264
|
-
this.obstacleId = 0;
|
|
265
|
-
this.cloudId = 0;
|
|
266
|
-
this.starId = 0;
|
|
267
|
-
this.lastFrameTime = performance.now();
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
//# sourceMappingURL=DinoJumpService.js.map
|
|
1
|
+
"use strict";import{DINO_JUMP_CONSTANTS,DINO_JUMP_GAME_CONFIG,getGroundY}from "./DinoJumpConstants.js";export class DinoJumpService{gameTimer = null;physicsAnimationId = null;obstacleTimer = null;cloudTimer = null;starTimer = null;lastFrameTime = 0;obstacleId = 0;cloudId = 0;starId = 0;isPhysicsRunning = false;constructor(){this.lastFrameTime = performance.now();}getDifficultySettings(difficulty){return{speed:DINO_JUMP_CONSTANTS.gameSpeed[difficulty],baseScore:DINO_JUMP_CONSTANTS.baseScore[difficulty],scoreMultiplier:DINO_JUMP_CONSTANTS.scoreMultiplier[difficulty],obstacleSpawnRate:difficulty === 'easy' ? 3000:difficulty === 'medium' ? 2000:1500};}startTimer(decrementTimeCallback){this.stopTimer();this.gameTimer = setInterval(()=>{decrementTimeCallback();},1000);}stopTimer(){if(this.gameTimer){clearInterval(this.gameTimer);this.gameTimer = null;}}startPhysicsLoop(updateDinosaur,updateObstacles,updateClouds,updateStars,updateGround,updateScore,updateSpeed,checkCollisions,stopGame){this.stopPhysicsLoop();this.isPhysicsRunning = true;this.lastFrameTime = performance.now();const physicsLoop = currentTime =>{if(!this.isPhysicsRunning)return;const deltaTime = Math.min((currentTime - this.lastFrameTime)/ 1000,0.016);this.lastFrameTime = currentTime;try{updateDinosaur(deltaTime);updateObstacles(deltaTime);updateClouds(deltaTime);updateStars(deltaTime);updateGround(deltaTime);updateScore(1);updateSpeed();checkCollisions();if(this.isPhysicsRunning){this.physicsAnimationId = requestAnimationFrame(physicsLoop);}}catch(error){console.error('Physics loop error:',error);this.stopPhysicsLoop();stopGame();}};this.physicsAnimationId = requestAnimationFrame(physicsLoop);}stopPhysicsLoop(){this.isPhysicsRunning = false;if(this.physicsAnimationId){cancelAnimationFrame(this.physicsAnimationId);this.physicsAnimationId = null;}}startObstacleSpawning(addObstacle,difficulty,getOffset){this.stopObstacleSpawning();const settings = this.getDifficultySettings(difficulty);const spawnObstacle =()=>{const offset = getOffset();const obstacle = this.createRandomObstacle(offset);addObstacle(obstacle);const nextSpawnTime = settings.obstacleSpawnRate + Math.random()* 1000;this.obstacleTimer = setTimeout(spawnObstacle,nextSpawnTime);};this.obstacleTimer = setTimeout(spawnObstacle,2000);}stopObstacleSpawning(){if(this.obstacleTimer){clearTimeout(this.obstacleTimer);this.obstacleTimer = null;}}startCloudSpawning(addCloud){this.stopCloudSpawning();const spawnCloud =()=>{const cloud = this.createRandomCloud();addCloud(cloud);const nextSpawnTime = 5000 + Math.random()* 5000;this.cloudTimer = setTimeout(spawnCloud,nextSpawnTime);};this.cloudTimer = setTimeout(spawnCloud,3000);}stopCloudSpawning(){if(this.cloudTimer){clearTimeout(this.cloudTimer);this.cloudTimer = null;}}startStarSpawning(addStar,getOffset){this.stopStarSpawning();const spawnStar =()=>{const offset = getOffset();const star = this.createRandomStar(offset);addStar(star);const nextSpawnTime = 8000 + Math.random()* 7000;this.starTimer = setTimeout(spawnStar,nextSpawnTime);};this.starTimer = setTimeout(spawnStar,10000);}stopStarSpawning(){if(this.starTimer){clearTimeout(this.starTimer);this.starTimer = null;}}createRandomObstacle(offset = 0){const types = ['cactus_small','cactus_large'];const type = types[Math.floor(Math.random()* types.length)];let width,height,y;const groundY = getGroundY(offset);switch(type){case 'cactus_small':width = 22;height = 45;y = groundY - height - 22;break;case 'cactus_large':width = 32;height = 65;y = groundY - height - 22;break;}return{id:`obstacle_${this.obstacleId++}`,type,x:DINO_JUMP_GAME_CONFIG.SCREEN_WIDTH + 50,y,width,height,speed:5};}createRandomCloud(){return{id:`cloud_${this.cloudId++}`,x:DINO_JUMP_GAME_CONFIG.SCREEN_WIDTH + 50,y:50 + Math.random()* 80,width:46 + Math.random()* 30,height:14 + Math.random()* 10,speed:1 + Math.random()* 2};}createRandomStar(offset = 0){const groundY = getGroundY(offset);const width = 45;const height = 45;return{id:`star_${this.starId++}`,x:DINO_JUMP_GAME_CONFIG.SCREEN_WIDTH + 50,y:groundY - height - 5,width,height,speed:5};}formatTime(timeInSeconds){const minutes = Math.floor(timeInSeconds / 60);const seconds = timeInSeconds % 60;return `${minutes}:${seconds.toString().padStart(2,'0')}`;}calculateFinalScore(score,timeElapsed,difficulty){const settings = this.getDifficultySettings(difficulty);const timeBonus = Math.max(0,300 - timeElapsed)* settings.scoreMultiplier;return score + timeBonus;}isNewHighScore(currentScore,previousHighScore){return currentScore > previousHighScore;}generateGroundPattern(){const pattern = [];for(let i = 0;i < 20;i++){pattern.push(Math.random()* 3);}return pattern;}cleanup(){this.stopTimer();this.stopPhysicsLoop();this.stopObstacleSpawning();this.stopCloudSpawning();this.stopStarSpawning();}reset(){this.cleanup();this.obstacleId = 0;this.cloudId = 0;this.starId = 0;this.lastFrameTime = performance.now();}}
|