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.
Files changed (419) hide show
  1. package/README.md +101 -30
  2. package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -167
  3. package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
  4. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +1 -182
  5. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -1
  6. package/lib/module/games/balloon-blaster/BalloonBlasterService.js +1 -318
  7. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +1 -183
  8. package/lib/module/games/balloon-blaster/components/BalloonComponent.js +1 -237
  9. package/lib/module/games/balloon-blaster/components/GameArea.js +1 -156
  10. package/lib/module/games/balloon-blaster/components/GameBackground.js +1 -476
  11. package/lib/module/games/balloon-blaster/components/ScoreBoard.js +1 -112
  12. package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
  13. package/lib/module/games/balloon-blaster/components/index.js +1 -7
  14. package/lib/module/games/bike-racing/BikeRacing.js +1 -0
  15. package/lib/module/games/bike-racing/BikeRacing.js.map +1 -0
  16. package/lib/module/games/bike-racing/BikeRacingConstants.js +1 -0
  17. package/lib/module/games/bike-racing/BikeRacingConstants.js.map +1 -0
  18. package/lib/module/games/bike-racing/BikeRacingService.js +1 -0
  19. package/lib/module/games/bike-racing/BikeRacingService.js.map +1 -0
  20. package/lib/module/games/bike-racing/BikeRacingStore.js +1 -0
  21. package/lib/module/games/bike-racing/BikeRacingStore.js.map +1 -0
  22. package/lib/module/games/bike-racing/components/BikeComponent.js +1 -0
  23. package/lib/module/games/bike-racing/components/BikeComponent.js.map +1 -0
  24. package/lib/module/games/bike-racing/components/GameBackground.js +1 -0
  25. package/lib/module/games/bike-racing/components/GameBackground.js.map +1 -0
  26. package/lib/module/games/bike-racing/components/ScoreBoard.js +1 -0
  27. package/lib/module/games/bike-racing/components/ScoreBoard.js.map +1 -0
  28. package/lib/module/games/bike-racing/components/index.js +1 -0
  29. package/lib/module/games/bike-racing/components/index.js.map +1 -0
  30. package/lib/module/games/bike-racing/index.js +1 -0
  31. package/lib/module/games/bike-racing/index.js.map +1 -0
  32. package/lib/module/games/block-blast/BlockBlast.js +1 -0
  33. package/lib/module/games/block-blast/BlockBlast.js.map +1 -0
  34. package/lib/module/games/block-blast/BlockBlastConstants.js +1 -0
  35. package/lib/module/games/block-blast/BlockBlastConstants.js.map +1 -0
  36. package/lib/module/games/block-blast/BlockBlastService.js +1 -0
  37. package/lib/module/games/block-blast/BlockBlastService.js.map +1 -0
  38. package/lib/module/games/block-blast/BlockBlastStore.js +1 -0
  39. package/lib/module/games/block-blast/BlockBlastStore.js.map +1 -0
  40. package/lib/module/games/block-blast/components/BlockPieceComponent.js +1 -0
  41. package/lib/module/games/block-blast/components/BlockPieceComponent.js.map +1 -0
  42. package/lib/module/games/block-blast/components/GameArea.js +1 -0
  43. package/lib/module/games/block-blast/components/GameArea.js.map +1 -0
  44. package/lib/module/games/block-blast/components/GameBackground.js +1 -0
  45. package/lib/module/games/block-blast/components/GameBackground.js.map +1 -0
  46. package/lib/module/games/block-blast/components/GridComponent.js +1 -0
  47. package/lib/module/games/block-blast/components/GridComponent.js.map +1 -0
  48. package/lib/module/games/block-blast/components/ScoreBoard.js +1 -0
  49. package/lib/module/games/block-blast/components/ScoreBoard.js.map +1 -0
  50. package/lib/module/games/block-blast/components/index.js +1 -0
  51. package/lib/module/games/block-blast/components/index.js.map +1 -0
  52. package/lib/module/games/block-blast/index.js +1 -0
  53. package/lib/module/games/block-blast/index.js.map +1 -0
  54. package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -0
  55. package/lib/module/games/bubble-shooter/BubbleShooter.js.map +1 -0
  56. package/lib/module/games/bubble-shooter/BubbleShooterConstants.js +1 -0
  57. package/lib/module/games/bubble-shooter/BubbleShooterConstants.js.map +1 -0
  58. package/lib/module/games/bubble-shooter/BubbleShooterService.js +1 -0
  59. package/lib/module/games/bubble-shooter/BubbleShooterService.js.map +1 -0
  60. package/lib/module/games/bubble-shooter/BubbleShooterStore.js +1 -0
  61. package/lib/module/games/bubble-shooter/BubbleShooterStore.js.map +1 -0
  62. package/lib/module/games/bubble-shooter/components/GameArea.js +1 -0
  63. package/lib/module/games/bubble-shooter/components/GameArea.js.map +1 -0
  64. package/lib/module/games/bubble-shooter/components/GameBackground.js +1 -0
  65. package/lib/module/games/bubble-shooter/components/GameBackground.js.map +1 -0
  66. package/lib/module/games/bubble-shooter/components/ScoreBoard.js +1 -0
  67. package/lib/module/games/bubble-shooter/components/ScoreBoard.js.map +1 -0
  68. package/lib/module/games/bubble-shooter/components/index.js +1 -0
  69. package/lib/module/games/bubble-shooter/components/index.js.map +1 -0
  70. package/lib/module/games/bubble-shooter/index.js +1 -0
  71. package/lib/module/games/bubble-shooter/index.js.map +1 -0
  72. package/lib/module/games/candy-crush/CandyCrush.js +1 -131
  73. package/lib/module/games/candy-crush/CandyCrush.js.map +1 -1
  74. package/lib/module/games/candy-crush/CandyCrushConstants.js +1 -125
  75. package/lib/module/games/candy-crush/CandyCrushConstants.js.map +1 -1
  76. package/lib/module/games/candy-crush/CandyCrushService.js +1 -370
  77. package/lib/module/games/candy-crush/CandyCrushStore.js +1 -303
  78. package/lib/module/games/candy-crush/components/CandyItem.js +1 -191
  79. package/lib/module/games/candy-crush/components/GameBackground.js +1 -85
  80. package/lib/module/games/candy-crush/components/GameGrid.js +1 -314
  81. package/lib/module/games/candy-crush/components/ScoreBoard.js +1 -79
  82. package/lib/module/games/candy-crush/components/index.js +1 -7
  83. package/lib/module/games/candy-crush/index.js +1 -6
  84. package/lib/module/games/car-racing/CarRacing.js +1 -0
  85. package/lib/module/games/car-racing/CarRacing.js.map +1 -0
  86. package/lib/module/games/car-racing/CarRacingConstants.js +1 -0
  87. package/lib/module/games/car-racing/CarRacingConstants.js.map +1 -0
  88. package/lib/module/games/car-racing/CarRacingService.js +1 -0
  89. package/lib/module/games/car-racing/CarRacingService.js.map +1 -0
  90. package/lib/module/games/car-racing/CarRacingStore.js +1 -0
  91. package/lib/module/games/car-racing/CarRacingStore.js.map +1 -0
  92. package/lib/module/games/car-racing/components/CarComponent.js +1 -0
  93. package/lib/module/games/car-racing/components/CarComponent.js.map +1 -0
  94. package/lib/module/games/car-racing/components/GameBackground.js +1 -0
  95. package/lib/module/games/car-racing/components/GameBackground.js.map +1 -0
  96. package/lib/module/games/car-racing/components/ScoreBoard.js +1 -0
  97. package/lib/module/games/car-racing/components/ScoreBoard.js.map +1 -0
  98. package/lib/module/games/car-racing/components/index.js +1 -0
  99. package/lib/module/games/car-racing/components/index.js.map +1 -0
  100. package/lib/module/games/colors-sort/ColorsSort.js +1 -143
  101. package/lib/module/games/colors-sort/ColorsSort.js.map +1 -1
  102. package/lib/module/games/colors-sort/ColorsSortConstants.js +1 -72
  103. package/lib/module/games/colors-sort/ColorsSortConstants.js.map +1 -1
  104. package/lib/module/games/colors-sort/ColorsSortService.js +1 -255
  105. package/lib/module/games/colors-sort/ColorsSortStore.js +1 -257
  106. package/lib/module/games/colors-sort/ColorsSortStore.js.map +1 -1
  107. package/lib/module/games/colors-sort/components/ColorContainer.js +1 -140
  108. package/lib/module/games/colors-sort/components/GameBackground.js +1 -135
  109. package/lib/module/games/colors-sort/components/ScoreBoard.js +1 -70
  110. package/lib/module/games/colors-sort/components/index.js +1 -6
  111. package/lib/module/games/dino-jump/DinoJump.js +1 -209
  112. package/lib/module/games/dino-jump/DinoJump.js.map +1 -1
  113. package/lib/module/games/dino-jump/DinoJumpConstants.js +1 -189
  114. package/lib/module/games/dino-jump/DinoJumpConstants.js.map +1 -1
  115. package/lib/module/games/dino-jump/DinoJumpService.js +1 -270
  116. package/lib/module/games/dino-jump/DinoJumpStore.js +1 -381
  117. package/lib/module/games/dino-jump/components/DinoSprite.js +1 -418
  118. package/lib/module/games/dino-jump/components/DinoSprite.js.map +1 -1
  119. package/lib/module/games/dino-jump/components/GameArea.js +1 -68
  120. package/lib/module/games/dino-jump/components/GameBackground.js +1 -444
  121. package/lib/module/games/dino-jump/components/ObstacleSprite.js +1 -306
  122. package/lib/module/games/dino-jump/components/ScoreBoard.js +1 -105
  123. package/lib/module/games/dino-jump/components/ScoreBoard.js.map +1 -1
  124. package/lib/module/games/dino-jump/components/StarSprite.js +1 -45
  125. package/lib/module/games/dino-jump/components/index.js +1 -9
  126. package/lib/module/games/flappy-bird/FlappyBird.js +1 -126
  127. package/lib/module/games/flappy-bird/FlappyBird.js.map +1 -1
  128. package/lib/module/games/flappy-bird/FlappyBirdConstants.js +1 -90
  129. package/lib/module/games/flappy-bird/FlappyBirdConstants.js.map +1 -1
  130. package/lib/module/games/flappy-bird/FlappyBirdStore.js +1 -300
  131. package/lib/module/games/flappy-bird/components/Bird.js +1 -87
  132. package/lib/module/games/flappy-bird/components/GameArea.js +1 -87
  133. package/lib/module/games/flappy-bird/components/GameBackground.js +1 -79
  134. package/lib/module/games/flappy-bird/components/Pipes.js +1 -172
  135. package/lib/module/games/flappy-bird/components/ScoreBoard.js +1 -73
  136. package/lib/module/games/flappy-bird/components/index.js +1 -8
  137. package/lib/module/games/fruit-merger/FruitMerger.js +1 -120
  138. package/lib/module/games/fruit-merger/FruitMerger.js.map +1 -1
  139. package/lib/module/games/fruit-merger/FruitMergerConstants.js +1 -119
  140. package/lib/module/games/fruit-merger/FruitMergerConstants.js.map +1 -1
  141. package/lib/module/games/fruit-merger/FruitMergerService.js +1 -13
  142. package/lib/module/games/fruit-merger/FruitMergerStore.js +1 -315
  143. package/lib/module/games/fruit-merger/components/FruitItem.js +1 -102
  144. package/lib/module/games/fruit-merger/components/GameArea.js +1 -103
  145. package/lib/module/games/fruit-merger/components/GameBackground.js +1 -498
  146. package/lib/module/games/fruit-merger/components/ScoreBoard.js +1 -58
  147. package/lib/module/games/fruit-merger/components/index.js +1 -7
  148. package/lib/module/games/fruit-ninja/FruitNinja.js +1 -134
  149. package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -1
  150. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +1 -148
  151. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -1
  152. package/lib/module/games/fruit-ninja/FruitNinjaService.js +1 -311
  153. package/lib/module/games/fruit-ninja/FruitNinjaStore.js +1 -191
  154. package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -1
  155. package/lib/module/games/fruit-ninja/components/FruitComponent.js +1 -99
  156. package/lib/module/games/fruit-ninja/components/GameArea.js +1 -215
  157. package/lib/module/games/fruit-ninja/components/GameBackground.js +1 -1267
  158. package/lib/module/games/fruit-ninja/components/ScoreBoard.js +1 -92
  159. package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -1
  160. package/lib/module/games/fruit-ninja/components/index.js +1 -7
  161. package/lib/module/games/game-2048/Game2048.js +1 -149
  162. package/lib/module/games/game-2048/Game2048.js.map +1 -1
  163. package/lib/module/games/game-2048/Game2048Constants.js +1 -263
  164. package/lib/module/games/game-2048/Game2048Constants.js.map +1 -1
  165. package/lib/module/games/game-2048/Game2048Service.js +1 -457
  166. package/lib/module/games/game-2048/Game2048Store.js +1 -236
  167. package/lib/module/games/game-2048/components/GameBackground.js +1 -247
  168. package/lib/module/games/game-2048/components/GameGrid.js +1 -139
  169. package/lib/module/games/game-2048/components/GameTile.js +1 -72
  170. package/lib/module/games/game-2048/components/ScoreBoard.js +1 -52
  171. package/lib/module/games/game-2048/components/index.js +1 -7
  172. package/lib/module/games/maze-runner/MazeRunner.js +1 -267
  173. package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
  174. package/lib/module/games/maze-runner/MazeRunnerConstants.js +1 -100
  175. package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -1
  176. package/lib/module/games/maze-runner/MazeRunnerService.js +1 -586
  177. package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +1 -150
  178. package/lib/module/games/maze-runner/components/EnhancedGameArea.js +1 -370
  179. package/lib/module/games/maze-runner/components/GameBackground.js +1 -175
  180. package/lib/module/games/maze-runner/components/ScoreBoard.js +1 -61
  181. package/lib/module/games/maze-runner/components/SkiaPipeComponent.js +1 -209
  182. package/lib/module/games/maze-runner/components/StaticGameBackground.js +1 -169
  183. package/lib/module/games/maze-runner/components/WallComponent.js +1 -91
  184. package/lib/module/games/maze-runner/components/index.js +1 -8
  185. package/lib/module/games/perfect-circle/PerfectCircle.js +1 -0
  186. package/lib/module/games/perfect-circle/PerfectCircle.js.map +1 -0
  187. package/lib/module/games/perfect-circle/PerfectCircleConstants.js +1 -0
  188. package/lib/module/games/perfect-circle/PerfectCircleConstants.js.map +1 -0
  189. package/lib/module/games/perfect-circle/PerfectCircleService.js +1 -0
  190. package/lib/module/games/perfect-circle/PerfectCircleService.js.map +1 -0
  191. package/lib/module/games/perfect-circle/PerfectCircleStore.js +1 -0
  192. package/lib/module/games/perfect-circle/PerfectCircleStore.js.map +1 -0
  193. package/lib/module/games/perfect-circle/components/DrawingCanvas.js +1 -0
  194. package/lib/module/games/perfect-circle/components/DrawingCanvas.js.map +1 -0
  195. package/lib/module/games/perfect-circle/components/GameBackground.js +1 -0
  196. package/lib/module/games/perfect-circle/components/GameBackground.js.map +1 -0
  197. package/lib/module/games/perfect-circle/components/ScoreBoard.js +1 -0
  198. package/lib/module/games/perfect-circle/components/ScoreBoard.js.map +1 -0
  199. package/lib/module/games/perfect-circle/index.js +1 -0
  200. package/lib/module/games/perfect-circle/index.js.map +1 -0
  201. package/lib/module/games/popit-fidget/PopitFidget.js +1 -285
  202. package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -1
  203. package/lib/module/games/popit-fidget/PopitFidgetConstants.js +1 -113
  204. package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -1
  205. package/lib/module/games/popit-fidget/PopitFidgetService.js +1 -132
  206. package/lib/module/games/popit-fidget/PopitFidgetStore.js +1 -125
  207. package/lib/module/games/popit-fidget/components/BubbleComponent.js +1 -198
  208. package/lib/module/games/popit-fidget/components/FidgetGrid.js +1 -165
  209. package/lib/module/games/popit-fidget/components/GameBackground.js +1 -177
  210. package/lib/module/games/popit-fidget/components/ScoreBoard.js +1 -61
  211. package/lib/module/games/popit-fidget/components/index.js +1 -7
  212. package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -159
  213. package/lib/module/games/sliding-numbers/SlidingNumbers.js.map +1 -1
  214. package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +1 -207
  215. package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js.map +1 -1
  216. package/lib/module/games/sliding-numbers/SlidingNumbersService.js +1 -248
  217. package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +1 -274
  218. package/lib/module/games/sliding-numbers/components/GameBackground.js +1 -259
  219. package/lib/module/games/sliding-numbers/components/NumbersGrid.js +1 -174
  220. package/lib/module/games/sliding-numbers/components/NumbersTile.js +1 -116
  221. package/lib/module/games/sliding-numbers/components/ScoreBoard.js +1 -64
  222. package/lib/module/games/sliding-numbers/components/index.js +1 -7
  223. package/lib/module/games/snake/Snake.js +1 -189
  224. package/lib/module/games/snake/Snake.js.map +1 -1
  225. package/lib/module/games/snake/SnakeConstants.js +1 -138
  226. package/lib/module/games/snake/SnakeConstants.js.map +1 -1
  227. package/lib/module/games/snake/SnakeService.js +1 -148
  228. package/lib/module/games/snake/SnakeStore.js +1 -182
  229. package/lib/module/games/snake/SnakeStore.js.map +1 -1
  230. package/lib/module/games/snake/components/GameBackground.js +1 -221
  231. package/lib/module/games/snake/components/GameGrid.js +1 -153
  232. package/lib/module/games/snake/components/ScoreBoard.js +1 -51
  233. package/lib/module/games/snake/components/ScoreBoard.js.map +1 -1
  234. package/lib/module/games/snake/components/index.js +1 -6
  235. package/lib/module/games/snake/index.js +1 -6
  236. package/lib/module/games/space-fighter/SpaceFighter.js +1 -165
  237. package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -1
  238. package/lib/module/games/space-fighter/SpaceFighterConstants.js +1 -108
  239. package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -1
  240. package/lib/module/games/space-fighter/SpaceFighterService.js +1 -326
  241. package/lib/module/games/space-fighter/SpaceFighterStore.js +1 -209
  242. package/lib/module/games/space-fighter/components/AsteroidComponent.js +1 -113
  243. package/lib/module/games/space-fighter/components/GameArea.js +1 -289
  244. package/lib/module/games/space-fighter/components/GameBackground.js +1 -239
  245. package/lib/module/games/space-fighter/components/ScoreBoard.js +1 -136
  246. package/lib/module/games/space-fighter/components/Spacecraft3D.js +1 -202
  247. package/lib/module/games/space-fighter/components/SpacecraftPath.js +1 -52
  248. package/lib/module/games/space-fighter/components/index.js +1 -9
  249. package/lib/module/games/whack-a-mole/WhackAMole.js +1 -270
  250. package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -1
  251. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +1 -115
  252. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -1
  253. package/lib/module/games/whack-a-mole/WhackAMoleService.js +1 -120
  254. package/lib/module/games/whack-a-mole/WhackAMoleStore.js +1 -172
  255. package/lib/module/games/whack-a-mole/components/GameBackground.js +1 -477
  256. package/lib/module/games/whack-a-mole/components/GameGrid.js +1 -97
  257. package/lib/module/games/whack-a-mole/components/GameHole.js +1 -196
  258. package/lib/module/games/whack-a-mole/components/MoleCharacter.js +1 -241
  259. package/lib/module/games/whack-a-mole/components/ScoreBoard.js +1 -67
  260. package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -1
  261. package/lib/module/games/whack-a-mole/components/index.js +1 -8
  262. package/lib/module/helpers/AnimationFrame.js +1 -120
  263. package/lib/module/helpers/AnimationTracker.js +1 -89
  264. package/lib/module/helpers/ErrorHandler.js +1 -269
  265. package/lib/module/helpers/GameControlButton.js +1 -219
  266. package/lib/module/helpers/GameOverModal.js +1 -144
  267. package/lib/module/helpers/GameOverModal.js.map +1 -1
  268. package/lib/module/helpers/GameSettingsModal.js +1 -287
  269. package/lib/module/helpers/GameSettingsModal.js.map +1 -1
  270. package/lib/module/helpers/ParticleBlast.js +1 -134
  271. package/lib/module/helpers/ScoreBoardContainer.js +1 -34
  272. package/lib/module/helpers/ScoreBoardContainer.js.map +1 -1
  273. package/lib/module/helpers/index.js +1 -12
  274. package/lib/module/index.js +1 -22
  275. package/lib/module/index.js.map +1 -1
  276. package/lib/module/services/GamesConstants.js +1 -178
  277. package/lib/module/services/GamesConstants.js.map +1 -1
  278. package/lib/module/services/GamesService.js +1 -112
  279. package/lib/module/services/GamesService.js.map +1 -1
  280. package/lib/module/services/HapticsService.js +1 -77
  281. package/lib/module/services/ScoringService.js +1 -0
  282. package/lib/module/services/ScoringService.js.map +1 -0
  283. package/lib/module/services/SoundsService.js +1 -302
  284. package/lib/module/services/SoundsService.js.map +1 -1
  285. package/lib/module/services/UtilsService.js +1 -32
  286. package/lib/module/services/UtilsService.js.map +1 -1
  287. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
  288. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +1 -1
  289. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
  290. package/lib/typescript/src/games/bike-racing/BikeRacing.d.ts +4 -0
  291. package/lib/typescript/src/games/bike-racing/BikeRacing.d.ts.map +1 -0
  292. package/lib/typescript/src/games/bike-racing/BikeRacingConstants.d.ts +76 -0
  293. package/lib/typescript/src/games/bike-racing/BikeRacingConstants.d.ts.map +1 -0
  294. package/lib/typescript/src/games/bike-racing/BikeRacingService.d.ts +22 -0
  295. package/lib/typescript/src/games/bike-racing/BikeRacingService.d.ts.map +1 -0
  296. package/lib/typescript/src/games/bike-racing/BikeRacingStore.d.ts +72 -0
  297. package/lib/typescript/src/games/bike-racing/BikeRacingStore.d.ts.map +1 -0
  298. package/lib/typescript/src/games/bike-racing/components/BikeComponent.d.ts +12 -0
  299. package/lib/typescript/src/games/bike-racing/components/BikeComponent.d.ts.map +1 -0
  300. package/lib/typescript/src/games/bike-racing/components/GameBackground.d.ts +9 -0
  301. package/lib/typescript/src/games/bike-racing/components/GameBackground.d.ts.map +1 -0
  302. package/lib/typescript/src/games/bike-racing/components/ScoreBoard.d.ts +7 -0
  303. package/lib/typescript/src/games/bike-racing/components/ScoreBoard.d.ts.map +1 -0
  304. package/lib/typescript/src/games/bike-racing/components/index.d.ts +4 -0
  305. package/lib/typescript/src/games/bike-racing/components/index.d.ts.map +1 -0
  306. package/lib/typescript/src/games/bike-racing/index.d.ts +5 -0
  307. package/lib/typescript/src/games/bike-racing/index.d.ts.map +1 -0
  308. package/lib/typescript/src/games/block-blast/BlockBlast.d.ts +4 -0
  309. package/lib/typescript/src/games/block-blast/BlockBlast.d.ts.map +1 -0
  310. package/lib/typescript/src/games/block-blast/BlockBlastConstants.d.ts +82 -0
  311. package/lib/typescript/src/games/block-blast/BlockBlastConstants.d.ts.map +1 -0
  312. package/lib/typescript/src/games/block-blast/BlockBlastService.d.ts +17 -0
  313. package/lib/typescript/src/games/block-blast/BlockBlastService.d.ts.map +1 -0
  314. package/lib/typescript/src/games/block-blast/BlockBlastStore.d.ts +62 -0
  315. package/lib/typescript/src/games/block-blast/BlockBlastStore.d.ts.map +1 -0
  316. package/lib/typescript/src/games/block-blast/components/BlockPieceComponent.d.ts +14 -0
  317. package/lib/typescript/src/games/block-blast/components/BlockPieceComponent.d.ts.map +1 -0
  318. package/lib/typescript/src/games/block-blast/components/GameArea.d.ts +12 -0
  319. package/lib/typescript/src/games/block-blast/components/GameArea.d.ts.map +1 -0
  320. package/lib/typescript/src/games/block-blast/components/GameBackground.d.ts +7 -0
  321. package/lib/typescript/src/games/block-blast/components/GameBackground.d.ts.map +1 -0
  322. package/lib/typescript/src/games/block-blast/components/GridComponent.d.ts +17 -0
  323. package/lib/typescript/src/games/block-blast/components/GridComponent.d.ts.map +1 -0
  324. package/lib/typescript/src/games/block-blast/components/ScoreBoard.d.ts +7 -0
  325. package/lib/typescript/src/games/block-blast/components/ScoreBoard.d.ts.map +1 -0
  326. package/lib/typescript/src/games/block-blast/components/index.d.ts +6 -0
  327. package/lib/typescript/src/games/block-blast/components/index.d.ts.map +1 -0
  328. package/lib/typescript/src/games/block-blast/index.d.ts +5 -0
  329. package/lib/typescript/src/games/block-blast/index.d.ts.map +1 -0
  330. package/lib/typescript/src/games/bubble-shooter/BubbleShooter.d.ts +4 -0
  331. package/lib/typescript/src/games/bubble-shooter/BubbleShooter.d.ts.map +1 -0
  332. package/lib/typescript/src/games/bubble-shooter/BubbleShooterConstants.d.ts +61 -0
  333. package/lib/typescript/src/games/bubble-shooter/BubbleShooterConstants.d.ts.map +1 -0
  334. package/lib/typescript/src/games/bubble-shooter/BubbleShooterService.d.ts +26 -0
  335. package/lib/typescript/src/games/bubble-shooter/BubbleShooterService.d.ts.map +1 -0
  336. package/lib/typescript/src/games/bubble-shooter/BubbleShooterStore.d.ts +62 -0
  337. package/lib/typescript/src/games/bubble-shooter/BubbleShooterStore.d.ts.map +1 -0
  338. package/lib/typescript/src/games/bubble-shooter/components/GameArea.d.ts +9 -0
  339. package/lib/typescript/src/games/bubble-shooter/components/GameArea.d.ts.map +1 -0
  340. package/lib/typescript/src/games/bubble-shooter/components/GameBackground.d.ts +8 -0
  341. package/lib/typescript/src/games/bubble-shooter/components/GameBackground.d.ts.map +1 -0
  342. package/lib/typescript/src/games/bubble-shooter/components/ScoreBoard.d.ts +7 -0
  343. package/lib/typescript/src/games/bubble-shooter/components/ScoreBoard.d.ts.map +1 -0
  344. package/lib/typescript/src/games/bubble-shooter/components/index.d.ts +4 -0
  345. package/lib/typescript/src/games/bubble-shooter/components/index.d.ts.map +1 -0
  346. package/lib/typescript/src/games/bubble-shooter/index.d.ts +3 -0
  347. package/lib/typescript/src/games/bubble-shooter/index.d.ts.map +1 -0
  348. package/lib/typescript/src/games/candy-crush/CandyCrush.d.ts.map +1 -1
  349. package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts +7 -7
  350. package/lib/typescript/src/games/car-racing/CarRacing.d.ts +4 -0
  351. package/lib/typescript/src/games/car-racing/CarRacing.d.ts.map +1 -0
  352. package/lib/typescript/src/games/car-racing/CarRacingConstants.d.ts +76 -0
  353. package/lib/typescript/src/games/car-racing/CarRacingConstants.d.ts.map +1 -0
  354. package/lib/typescript/src/games/car-racing/CarRacingService.d.ts +22 -0
  355. package/lib/typescript/src/games/car-racing/CarRacingService.d.ts.map +1 -0
  356. package/lib/typescript/src/games/car-racing/CarRacingStore.d.ts +72 -0
  357. package/lib/typescript/src/games/car-racing/CarRacingStore.d.ts.map +1 -0
  358. package/lib/typescript/src/games/car-racing/components/CarComponent.d.ts +13 -0
  359. package/lib/typescript/src/games/car-racing/components/CarComponent.d.ts.map +1 -0
  360. package/lib/typescript/src/games/car-racing/components/GameBackground.d.ts +9 -0
  361. package/lib/typescript/src/games/car-racing/components/GameBackground.d.ts.map +1 -0
  362. package/lib/typescript/src/games/car-racing/components/ScoreBoard.d.ts +7 -0
  363. package/lib/typescript/src/games/car-racing/components/ScoreBoard.d.ts.map +1 -0
  364. package/lib/typescript/src/games/car-racing/components/index.d.ts +4 -0
  365. package/lib/typescript/src/games/car-racing/components/index.d.ts.map +1 -0
  366. package/lib/typescript/src/games/colors-sort/ColorsSort.d.ts.map +1 -1
  367. package/lib/typescript/src/games/colors-sort/ColorsSortStore.d.ts.map +1 -1
  368. package/lib/typescript/src/games/dino-jump/DinoJump.d.ts.map +1 -1
  369. package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts.map +1 -1
  370. package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts.map +1 -1
  371. package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts.map +1 -1
  372. package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts.map +1 -1
  373. package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts.map +1 -1
  374. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -1
  375. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -1
  376. package/lib/typescript/src/games/game-2048/Game2048.d.ts.map +1 -1
  377. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
  378. package/lib/typescript/src/games/perfect-circle/PerfectCircle.d.ts +4 -0
  379. package/lib/typescript/src/games/perfect-circle/PerfectCircle.d.ts.map +1 -0
  380. package/lib/typescript/src/games/perfect-circle/PerfectCircleConstants.d.ts +81 -0
  381. package/lib/typescript/src/games/perfect-circle/PerfectCircleConstants.d.ts.map +1 -0
  382. package/lib/typescript/src/games/perfect-circle/PerfectCircleService.d.ts +14 -0
  383. package/lib/typescript/src/games/perfect-circle/PerfectCircleService.d.ts.map +1 -0
  384. package/lib/typescript/src/games/perfect-circle/PerfectCircleStore.d.ts +40 -0
  385. package/lib/typescript/src/games/perfect-circle/PerfectCircleStore.d.ts.map +1 -0
  386. package/lib/typescript/src/games/perfect-circle/components/DrawingCanvas.d.ts +9 -0
  387. package/lib/typescript/src/games/perfect-circle/components/DrawingCanvas.d.ts.map +1 -0
  388. package/lib/typescript/src/games/perfect-circle/components/GameBackground.d.ts +8 -0
  389. package/lib/typescript/src/games/perfect-circle/components/GameBackground.d.ts.map +1 -0
  390. package/lib/typescript/src/games/perfect-circle/components/ScoreBoard.d.ts +7 -0
  391. package/lib/typescript/src/games/perfect-circle/components/ScoreBoard.d.ts.map +1 -0
  392. package/lib/typescript/src/games/perfect-circle/index.d.ts +3 -0
  393. package/lib/typescript/src/games/perfect-circle/index.d.ts.map +1 -0
  394. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -1
  395. package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts.map +1 -1
  396. package/lib/typescript/src/games/snake/Snake.d.ts.map +1 -1
  397. package/lib/typescript/src/games/snake/SnakeStore.d.ts +4 -0
  398. package/lib/typescript/src/games/snake/SnakeStore.d.ts.map +1 -1
  399. package/lib/typescript/src/games/snake/components/ScoreBoard.d.ts.map +1 -1
  400. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -1
  401. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -1
  402. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +1 -1
  403. package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -1
  404. package/lib/typescript/src/helpers/GameOverModal.d.ts +3 -0
  405. package/lib/typescript/src/helpers/GameOverModal.d.ts.map +1 -1
  406. package/lib/typescript/src/helpers/ScoreBoardContainer.d.ts.map +1 -1
  407. package/lib/typescript/src/index.d.ts +6 -1
  408. package/lib/typescript/src/index.d.ts.map +1 -1
  409. package/lib/typescript/src/services/GamesConstants.d.ts +57 -7
  410. package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
  411. package/lib/typescript/src/services/GamesService.d.ts +2 -1
  412. package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
  413. package/lib/typescript/src/services/ScoringService.d.ts +2 -0
  414. package/lib/typescript/src/services/ScoringService.d.ts.map +1 -0
  415. package/lib/typescript/src/services/SoundsService.d.ts +88 -0
  416. package/lib/typescript/src/services/SoundsService.d.ts.map +1 -1
  417. package/lib/typescript/src/services/UtilsService.d.ts +12 -1
  418. package/lib/typescript/src/services/UtilsService.d.ts.map +1 -1
  419. 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":";;AAAA,SAASA,UAAU,QAAQ,cAAc;A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BC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,IAAI,EAAE;AACR,CAAU;;AAEV;AACA,OAAO,MAAMC,cAAc,GAAG;EAC5BC,YAAY,EAAE,cAAc;EAC5BC,YAAY,EAAE,cAAc;EAC5BC,IAAI,EAAE;AACR,CAAU;;AAEV;AACA,OAAO,MAAMC,eAAkC,GAAG;EAChDC,eAAe,EAAE,SAAS;EAAE;EAC5BC,qBAAqB,EAAE,wBAAwB;EAAE;EACjDC,eAAe,EAAE,SAAS;EAC1BC,sBAAsB,EAAE,wBAAwB;EAAE;EAClDC,iBAAiB,EAAE,SAAS;EAC5BC,mBAAmB,EAAE,SAAS;EAAE;EAChCC,qBAAqB,EAAE,0BAA0B;EACjDC,uBAAuB,EAAE,SAAS;EAClCC,yBAAyB,EAAE,SAAS;EACpCC,qBAAqB,EAAE,wBAAwB;EAC/CC,oBAAoB,EAAE,SAAS;EAC/BC,gBAAgB,EAAE,SAAS;EAC3BC,aAAa,EAAE,SAAS,CAAE;AAC5B,CAAC;;AAED;AACA,OAAO,MAAMC,iCAAiC,GAAG;EAC/C7E,IAAI,EAAE,mDAAmD;EACzDC,MAAM,EAAE,uDAAuD;EAC/DC,IAAI,EAAE;AACR,CAAU","ignoreList":[]}
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":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAGzC;AACA,MAAM;EAAEC,KAAK;EAAEC;AAAO,CAAC,GAAGF,UAAU,CAACG,GAAG,CAAC,QAAQ,CAAC;;AAElD;AACA,OAAO,MAAMC,mBAAmB,GAAG;EACjC;EACAC,OAAO,EAAE,GAAG;EACZC,SAAS,EAAE,CAAC,EAAE;EAAE;EAChBC,SAAS,EAAE;IACTC,IAAI,EAAE,CAAC;IAAK;IACZC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE;EACR,CAAC;EACD;EACAC,SAAS,EAAE;IACTH,IAAI,EAAE,CAAC;IAAK;IACZC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE;EACR,CAAC;EACDE,eAAe,EAAE;IACfJ,IAAI,EAAE,CAAC;IACPC,MAAM,EAAE,GAAG;IACXC,IAAI,EAAE;EACR,CAAC;EAC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B,EAAE,0BAA0B;EAAE;EACvDC,qBAAqB,EAAE,wBAAwB;EAC/CC,oBAAoB,EAAE,SAAS;EAAE;EACjCC,gBAAgB,EAAE,SAAS;EAC3BC,aAAa,EAAE,0BAA0B,CAAE;AAC7C,CAAC;;AAED;AACA,OAAO,MAAMC,iCAAiC,GAAG;EAC/C7E,IAAI,EAAE,mDAAmD;EACzDC,MAAM,EAAE,uDAAuD;EAC/DC,IAAI,EAAE;AACR,CAAU","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();}}