react-native-games 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. package/README.md +134 -130
  2. package/lib/module/games/balloon-blaster/BalloonBlaster.js +116 -343
  3. package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
  4. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +182 -0
  5. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -0
  6. package/lib/module/games/balloon-blaster/BalloonBlasterService.js +123 -101
  7. package/lib/module/games/balloon-blaster/BalloonBlasterService.js.map +1 -1
  8. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +119 -92
  9. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js.map +1 -1
  10. package/lib/module/games/balloon-blaster/components/BalloonComponent.js +123 -113
  11. package/lib/module/games/balloon-blaster/components/BalloonComponent.js.map +1 -1
  12. package/lib/module/games/balloon-blaster/components/GameArea.js +137 -23
  13. package/lib/module/games/balloon-blaster/components/GameArea.js.map +1 -1
  14. package/lib/module/games/balloon-blaster/components/GameBackground.js +8 -83
  15. package/lib/module/games/balloon-blaster/components/GameBackground.js.map +1 -1
  16. package/lib/module/games/balloon-blaster/components/ScoreBoard.js +15 -22
  17. package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
  18. package/lib/module/games/balloon-blaster/components/index.js +0 -4
  19. package/lib/module/games/balloon-blaster/components/index.js.map +1 -1
  20. package/lib/module/games/fruit-ninja/FruitNinja.js +143 -0
  21. package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -0
  22. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +148 -0
  23. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -0
  24. package/lib/module/games/{fruit-slicer/FruitSlicerService.js → fruit-ninja/FruitNinjaService.js} +43 -21
  25. package/lib/module/games/fruit-ninja/FruitNinjaService.js.map +1 -0
  26. package/lib/module/games/fruit-ninja/FruitNinjaStore.js +191 -0
  27. package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -0
  28. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.js +1 -1
  29. package/lib/module/games/fruit-ninja/components/FruitComponent.js.map +1 -0
  30. package/lib/module/games/fruit-ninja/components/GameArea.js +215 -0
  31. package/lib/module/games/fruit-ninja/components/GameArea.js.map +1 -0
  32. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameBackground.js +250 -304
  33. package/lib/module/games/fruit-ninja/components/GameBackground.js.map +1 -0
  34. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/ScoreBoard.js +17 -47
  35. package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -0
  36. package/lib/module/games/fruit-ninja/components/index.js +7 -0
  37. package/lib/module/games/fruit-ninja/components/index.js.map +1 -0
  38. package/lib/module/games/maze-runner/MazeRunner.js +184 -169
  39. package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
  40. package/lib/module/games/maze-runner/MazeRunnerConstants.js +100 -0
  41. package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -0
  42. package/lib/module/games/maze-runner/MazeRunnerService.js +37 -14
  43. package/lib/module/games/maze-runner/MazeRunnerService.js.map +1 -1
  44. package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +5 -4
  45. package/lib/module/games/maze-runner/components/EnhancedBallComponent.js.map +1 -1
  46. package/lib/module/games/maze-runner/components/EnhancedGameArea.js +20 -15
  47. package/lib/module/games/maze-runner/components/EnhancedGameArea.js.map +1 -1
  48. package/lib/module/games/maze-runner/components/GameBackground.js +151 -192
  49. package/lib/module/games/maze-runner/components/GameBackground.js.map +1 -1
  50. package/lib/module/games/maze-runner/components/ScoreBoard.js +15 -25
  51. package/lib/module/games/maze-runner/components/ScoreBoard.js.map +1 -1
  52. package/lib/module/games/maze-runner/components/WallComponent.js +3 -2
  53. package/lib/module/games/maze-runner/components/WallComponent.js.map +1 -1
  54. package/lib/module/games/maze-runner/components/index.js +0 -2
  55. package/lib/module/games/maze-runner/components/index.js.map +1 -1
  56. package/lib/module/games/popit-fidget/PopitFidget.js +294 -0
  57. package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -0
  58. package/lib/module/games/popit-fidget/PopitFidgetConstants.js +113 -0
  59. package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -0
  60. package/lib/module/games/popit-fidget/PopitFidgetService.js +132 -0
  61. package/lib/module/games/popit-fidget/PopitFidgetService.js.map +1 -0
  62. package/lib/module/games/popit-fidget/PopitFidgetStore.js +163 -0
  63. package/lib/module/games/popit-fidget/PopitFidgetStore.js.map +1 -0
  64. package/lib/module/games/popit-fidget/components/BubbleComponent.js +198 -0
  65. package/lib/module/games/popit-fidget/components/BubbleComponent.js.map +1 -0
  66. package/lib/module/games/popit-fidget/components/FidgetGrid.js +165 -0
  67. package/lib/module/games/popit-fidget/components/FidgetGrid.js.map +1 -0
  68. package/lib/module/games/popit-fidget/components/GameBackground.js +177 -0
  69. package/lib/module/games/popit-fidget/components/GameBackground.js.map +1 -0
  70. package/lib/module/games/popit-fidget/components/ScoreBoard.js +75 -0
  71. package/lib/module/games/popit-fidget/components/ScoreBoard.js.map +1 -0
  72. package/lib/module/games/popit-fidget/components/index.js +7 -0
  73. package/lib/module/games/popit-fidget/components/index.js.map +1 -0
  74. package/lib/module/games/space-fighter/SpaceFighter.js +169 -0
  75. package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -0
  76. package/lib/module/games/space-fighter/SpaceFighterConstants.js +108 -0
  77. package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -0
  78. package/lib/module/games/{space-traveller/SpaceTravellerService.js → space-fighter/SpaceFighterService.js} +48 -21
  79. package/lib/module/games/space-fighter/SpaceFighterService.js.map +1 -0
  80. package/lib/module/games/space-fighter/SpaceFighterStore.js +195 -0
  81. package/lib/module/games/space-fighter/SpaceFighterStore.js.map +1 -0
  82. package/lib/module/games/{space-traveller → space-fighter}/components/AsteroidComponent.js +7 -5
  83. package/lib/module/games/space-fighter/components/AsteroidComponent.js.map +1 -0
  84. package/lib/module/games/space-fighter/components/GameArea.js +295 -0
  85. package/lib/module/games/space-fighter/components/GameArea.js.map +1 -0
  86. package/lib/module/games/{space-traveller → space-fighter}/components/GameBackground.js +10 -65
  87. package/lib/module/games/space-fighter/components/GameBackground.js.map +1 -0
  88. package/lib/module/games/{space-traveller → space-fighter}/components/ScoreBoard.js +20 -26
  89. package/lib/module/games/space-fighter/components/ScoreBoard.js.map +1 -0
  90. package/lib/module/games/{space-traveller → space-fighter}/components/Spacecraft3D.js +72 -111
  91. package/lib/module/games/space-fighter/components/Spacecraft3D.js.map +1 -0
  92. package/lib/module/games/space-fighter/components/SpacecraftPath.js +52 -0
  93. package/lib/module/games/space-fighter/components/SpacecraftPath.js.map +1 -0
  94. package/lib/module/games/{space-traveller → space-fighter}/components/index.js +0 -4
  95. package/lib/module/games/space-fighter/components/index.js.map +1 -0
  96. package/lib/module/games/whack-a-mole/WhackAMole.js +263 -0
  97. package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -0
  98. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +115 -0
  99. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -0
  100. package/lib/module/games/whack-a-mole/WhackAMoleService.js +120 -0
  101. package/lib/module/games/whack-a-mole/WhackAMoleService.js.map +1 -0
  102. package/lib/module/games/whack-a-mole/WhackAMoleStore.js +172 -0
  103. package/lib/module/games/whack-a-mole/WhackAMoleStore.js.map +1 -0
  104. package/lib/module/games/{cat-popper → whack-a-mole}/components/GameBackground.js +31 -91
  105. package/lib/module/games/whack-a-mole/components/GameBackground.js.map +1 -0
  106. package/lib/module/games/whack-a-mole/components/GameGrid.js +97 -0
  107. package/lib/module/games/whack-a-mole/components/GameGrid.js.map +1 -0
  108. package/lib/module/games/{cat-popper → whack-a-mole}/components/GameHole.js +67 -54
  109. package/lib/module/games/whack-a-mole/components/GameHole.js.map +1 -0
  110. package/lib/module/games/{cat-popper/components/CatCharacter.js → whack-a-mole/components/MoleCharacter.js} +75 -115
  111. package/lib/module/games/whack-a-mole/components/MoleCharacter.js.map +1 -0
  112. package/lib/module/games/{cat-popper → whack-a-mole}/components/ScoreBoard.js +13 -17
  113. package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -0
  114. package/lib/module/games/{cat-popper → whack-a-mole}/components/index.js +1 -3
  115. package/lib/module/games/whack-a-mole/components/index.js.map +1 -0
  116. package/lib/module/index.js +4 -3
  117. package/lib/module/index.js.map +1 -1
  118. package/lib/module/services/GamesConstants.js +41 -519
  119. package/lib/module/services/GamesConstants.js.map +1 -1
  120. package/lib/module/services/GamesService.js +35 -23
  121. package/lib/module/services/GamesService.js.map +1 -1
  122. package/lib/module/services/HapticsService.js +77 -0
  123. package/lib/module/services/HapticsService.js.map +1 -0
  124. package/lib/module/services/SoundsService.js +171 -0
  125. package/lib/module/services/SoundsService.js.map +1 -0
  126. package/lib/module/shared/helpers/AnimationFrame.js +120 -0
  127. package/lib/module/shared/helpers/AnimationFrame.js.map +1 -0
  128. package/lib/module/shared/helpers/AnimationTracker.js +89 -0
  129. package/lib/module/shared/helpers/AnimationTracker.js.map +1 -0
  130. package/lib/module/shared/helpers/ErrorHandler.js +269 -0
  131. package/lib/module/shared/helpers/ErrorHandler.js.map +1 -0
  132. package/lib/module/shared/helpers/GameControlButton.js +219 -0
  133. package/lib/module/shared/helpers/GameControlButton.js.map +1 -0
  134. package/lib/module/{games/balloon-blaster/components → shared/helpers}/GameOverModal.js +25 -17
  135. package/lib/module/shared/helpers/GameOverModal.js.map +1 -0
  136. package/lib/module/shared/helpers/GameSettingsModal.js +287 -0
  137. package/lib/module/shared/helpers/GameSettingsModal.js.map +1 -0
  138. package/lib/module/shared/helpers/ParticleBlast.js +133 -0
  139. package/lib/module/shared/helpers/ParticleBlast.js.map +1 -0
  140. package/lib/module/shared/helpers/ResponsiveScoreBoard.js +81 -0
  141. package/lib/module/shared/helpers/ResponsiveScoreBoard.js.map +1 -0
  142. package/lib/module/shared/helpers/index.js +12 -0
  143. package/lib/module/shared/helpers/index.js.map +1 -0
  144. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts +2 -14
  145. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
  146. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +144 -0
  147. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts.map +1 -0
  148. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts +1 -1
  149. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts.map +1 -1
  150. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts +12 -2
  151. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts.map +1 -1
  152. package/lib/typescript/src/games/balloon-blaster/components/BalloonComponent.d.ts.map +1 -1
  153. package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts +1 -15
  154. package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts.map +1 -1
  155. package/lib/typescript/src/games/balloon-blaster/components/GameBackground.d.ts.map +1 -1
  156. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts +1 -7
  157. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
  158. package/lib/typescript/src/games/balloon-blaster/components/index.d.ts +0 -4
  159. package/lib/typescript/src/games/balloon-blaster/components/index.d.ts.map +1 -1
  160. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts +4 -0
  161. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -0
  162. package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts +112 -0
  163. package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts.map +1 -0
  164. package/lib/typescript/src/games/{fruit-slicer/FruitSlicerService.d.ts → fruit-ninja/FruitNinjaService.d.ts} +13 -5
  165. package/lib/typescript/src/games/fruit-ninja/FruitNinjaService.d.ts.map +1 -0
  166. package/lib/typescript/src/games/{fruit-slicer/FruitSlicerStore.d.ts → fruit-ninja/FruitNinjaStore.d.ts} +13 -4
  167. package/lib/typescript/src/games/fruit-ninja/FruitNinjaStore.d.ts.map +1 -0
  168. package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.d.ts +1 -1
  169. package/lib/typescript/src/games/fruit-ninja/components/FruitComponent.d.ts.map +1 -0
  170. package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts +3 -0
  171. package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts.map +1 -0
  172. package/lib/typescript/src/games/fruit-ninja/components/GameBackground.d.ts.map +1 -0
  173. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts +3 -0
  174. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -0
  175. package/lib/typescript/src/games/fruit-ninja/components/index.d.ts +5 -0
  176. package/lib/typescript/src/games/fruit-ninja/components/index.d.ts.map +1 -0
  177. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts +2 -16
  178. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
  179. package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts +41 -0
  180. package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts.map +1 -0
  181. package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts +4 -2
  182. package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts.map +1 -1
  183. package/lib/typescript/src/games/maze-runner/components/EnhancedBallComponent.d.ts.map +1 -1
  184. package/lib/typescript/src/games/maze-runner/components/EnhancedGameArea.d.ts.map +1 -1
  185. package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts +2 -1
  186. package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts.map +1 -1
  187. package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts.map +1 -1
  188. package/lib/typescript/src/games/maze-runner/components/WallComponent.d.ts.map +1 -1
  189. package/lib/typescript/src/games/maze-runner/components/index.d.ts +0 -2
  190. package/lib/typescript/src/games/maze-runner/components/index.d.ts.map +1 -1
  191. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts +5 -0
  192. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -0
  193. package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts +45 -0
  194. package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts.map +1 -0
  195. package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts +33 -0
  196. package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts.map +1 -0
  197. package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts +36 -0
  198. package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts.map +1 -0
  199. package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts +12 -0
  200. package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts.map +1 -0
  201. package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts +12 -0
  202. package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts.map +1 -0
  203. package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts +9 -0
  204. package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts.map +1 -0
  205. package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts +8 -0
  206. package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts.map +1 -0
  207. package/lib/typescript/src/games/popit-fidget/components/index.d.ts +5 -0
  208. package/lib/typescript/src/games/popit-fidget/components/index.d.ts.map +1 -0
  209. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts +4 -0
  210. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -0
  211. package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts +71 -0
  212. package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts.map +1 -0
  213. package/lib/typescript/src/games/{space-traveller/SpaceTravellerService.d.ts → space-fighter/SpaceFighterService.d.ts} +7 -4
  214. package/lib/typescript/src/games/space-fighter/SpaceFighterService.d.ts.map +1 -0
  215. package/lib/typescript/src/games/{space-traveller/SpaceTravellerStore.d.ts → space-fighter/SpaceFighterStore.d.ts} +12 -4
  216. package/lib/typescript/src/games/space-fighter/SpaceFighterStore.d.ts.map +1 -0
  217. package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts +8 -0
  218. package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts.map +1 -0
  219. package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts +3 -0
  220. package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts.map +1 -0
  221. package/lib/typescript/src/games/space-fighter/components/GameBackground.d.ts.map +1 -0
  222. package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts +3 -0
  223. package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts.map +1 -0
  224. package/lib/typescript/src/games/{space-traveller → space-fighter}/components/Spacecraft3D.d.ts +1 -1
  225. package/lib/typescript/src/games/space-fighter/components/Spacecraft3D.d.ts.map +1 -0
  226. package/lib/typescript/src/games/space-fighter/components/SpacecraftPath.d.ts.map +1 -0
  227. package/lib/typescript/src/games/{space-traveller → space-fighter}/components/index.d.ts +0 -4
  228. package/lib/typescript/src/games/space-fighter/components/index.d.ts.map +1 -0
  229. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts +4 -0
  230. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -0
  231. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +79 -0
  232. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts.map +1 -0
  233. package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts +33 -0
  234. package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts.map +1 -0
  235. package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts +41 -0
  236. package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts.map +1 -0
  237. package/lib/typescript/src/games/whack-a-mole/components/GameBackground.d.ts.map +1 -0
  238. package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameGrid.d.ts +2 -2
  239. package/lib/typescript/src/games/whack-a-mole/components/GameGrid.d.ts.map +1 -0
  240. package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameHole.d.ts +3 -2
  241. package/lib/typescript/src/games/whack-a-mole/components/GameHole.d.ts.map +1 -0
  242. package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts +7 -0
  243. package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts.map +1 -0
  244. package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -0
  245. package/lib/typescript/src/games/whack-a-mole/components/index.d.ts +6 -0
  246. package/lib/typescript/src/games/whack-a-mole/components/index.d.ts.map +1 -0
  247. package/lib/typescript/src/index.d.ts +4 -3
  248. package/lib/typescript/src/index.d.ts.map +1 -1
  249. package/lib/typescript/src/services/GamesConstants.d.ts +61 -340
  250. package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
  251. package/lib/typescript/src/services/GamesService.d.ts +21 -3
  252. package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
  253. package/lib/typescript/src/services/HapticsService.d.ts +16 -0
  254. package/lib/typescript/src/services/HapticsService.d.ts.map +1 -0
  255. package/lib/typescript/src/services/SoundsService.d.ts +154 -0
  256. package/lib/typescript/src/services/SoundsService.d.ts.map +1 -0
  257. package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts +41 -0
  258. package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts.map +1 -0
  259. package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts +45 -0
  260. package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts.map +1 -0
  261. package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts +124 -0
  262. package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts.map +1 -0
  263. package/lib/typescript/src/shared/helpers/GameControlButton.d.ts +17 -0
  264. package/lib/typescript/src/shared/helpers/GameControlButton.d.ts.map +1 -0
  265. package/lib/typescript/src/{games/cat-popper/components → shared/helpers}/GameOverModal.d.ts +5 -0
  266. package/lib/typescript/src/shared/helpers/GameOverModal.d.ts.map +1 -0
  267. package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts +9 -0
  268. package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts.map +1 -0
  269. package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts +12 -0
  270. package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts.map +1 -0
  271. package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts +42 -0
  272. package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts.map +1 -0
  273. package/lib/typescript/src/shared/helpers/index.d.ts +13 -0
  274. package/lib/typescript/src/shared/helpers/index.d.ts.map +1 -0
  275. package/package.json +9 -6
  276. package/lib/module/games/balloon-blaster/components/GameControls.js +0 -229
  277. package/lib/module/games/balloon-blaster/components/GameControls.js.map +0 -1
  278. package/lib/module/games/balloon-blaster/components/GameOverModal.js.map +0 -1
  279. package/lib/module/games/balloon-blaster/components/ParticleSystem.js +0 -52
  280. package/lib/module/games/balloon-blaster/components/ParticleSystem.js.map +0 -1
  281. package/lib/module/games/balloon-blaster/components/SliceTrail.js +0 -58
  282. package/lib/module/games/balloon-blaster/components/SliceTrail.js.map +0 -1
  283. package/lib/module/games/cat-popper/CatPopper.js +0 -230
  284. package/lib/module/games/cat-popper/CatPopper.js.map +0 -1
  285. package/lib/module/games/cat-popper/CatPopperService.js +0 -100
  286. package/lib/module/games/cat-popper/CatPopperService.js.map +0 -1
  287. package/lib/module/games/cat-popper/CatPopperStore.js +0 -113
  288. package/lib/module/games/cat-popper/CatPopperStore.js.map +0 -1
  289. package/lib/module/games/cat-popper/components/CatCharacter.js.map +0 -1
  290. package/lib/module/games/cat-popper/components/GameBackground.js.map +0 -1
  291. package/lib/module/games/cat-popper/components/GameControls.js +0 -230
  292. package/lib/module/games/cat-popper/components/GameControls.js.map +0 -1
  293. package/lib/module/games/cat-popper/components/GameGrid.js +0 -66
  294. package/lib/module/games/cat-popper/components/GameGrid.js.map +0 -1
  295. package/lib/module/games/cat-popper/components/GameHole.js.map +0 -1
  296. package/lib/module/games/cat-popper/components/GameOverModal.js +0 -131
  297. package/lib/module/games/cat-popper/components/GameOverModal.js.map +0 -1
  298. package/lib/module/games/cat-popper/components/ScoreBoard.js.map +0 -1
  299. package/lib/module/games/cat-popper/components/index.js.map +0 -1
  300. package/lib/module/games/fruit-slicer/FruitSlicer.js +0 -411
  301. package/lib/module/games/fruit-slicer/FruitSlicer.js.map +0 -1
  302. package/lib/module/games/fruit-slicer/FruitSlicerService.js.map +0 -1
  303. package/lib/module/games/fruit-slicer/FruitSlicerStore.js +0 -156
  304. package/lib/module/games/fruit-slicer/FruitSlicerStore.js.map +0 -1
  305. package/lib/module/games/fruit-slicer/components/FruitComponent.js.map +0 -1
  306. package/lib/module/games/fruit-slicer/components/GameArea.js +0 -50
  307. package/lib/module/games/fruit-slicer/components/GameArea.js.map +0 -1
  308. package/lib/module/games/fruit-slicer/components/GameBackground.js.map +0 -1
  309. package/lib/module/games/fruit-slicer/components/GameControls.js +0 -230
  310. package/lib/module/games/fruit-slicer/components/GameControls.js.map +0 -1
  311. package/lib/module/games/fruit-slicer/components/GameOverModal.js +0 -189
  312. package/lib/module/games/fruit-slicer/components/GameOverModal.js.map +0 -1
  313. package/lib/module/games/fruit-slicer/components/ParticleSystem.js +0 -52
  314. package/lib/module/games/fruit-slicer/components/ParticleSystem.js.map +0 -1
  315. package/lib/module/games/fruit-slicer/components/ScoreBoard.js.map +0 -1
  316. package/lib/module/games/fruit-slicer/components/SliceTrail.js +0 -58
  317. package/lib/module/games/fruit-slicer/components/SliceTrail.js.map +0 -1
  318. package/lib/module/games/fruit-slicer/components/index.js +0 -11
  319. package/lib/module/games/fruit-slicer/components/index.js.map +0 -1
  320. package/lib/module/games/maze-runner/components/GameControls.js +0 -129
  321. package/lib/module/games/maze-runner/components/GameControls.js.map +0 -1
  322. package/lib/module/games/maze-runner/components/GameOverModal.js +0 -134
  323. package/lib/module/games/maze-runner/components/GameOverModal.js.map +0 -1
  324. package/lib/module/games/space-traveller/SpaceTraveller.js +0 -393
  325. package/lib/module/games/space-traveller/SpaceTraveller.js.map +0 -1
  326. package/lib/module/games/space-traveller/SpaceTravellerService.js.map +0 -1
  327. package/lib/module/games/space-traveller/SpaceTravellerStore.js +0 -139
  328. package/lib/module/games/space-traveller/SpaceTravellerStore.js.map +0 -1
  329. package/lib/module/games/space-traveller/components/AsteroidComponent.js.map +0 -1
  330. package/lib/module/games/space-traveller/components/GameArea.js +0 -75
  331. package/lib/module/games/space-traveller/components/GameArea.js.map +0 -1
  332. package/lib/module/games/space-traveller/components/GameBackground.js.map +0 -1
  333. package/lib/module/games/space-traveller/components/GameControls.js +0 -177
  334. package/lib/module/games/space-traveller/components/GameControls.js.map +0 -1
  335. package/lib/module/games/space-traveller/components/GameOverModal.js +0 -182
  336. package/lib/module/games/space-traveller/components/GameOverModal.js.map +0 -1
  337. package/lib/module/games/space-traveller/components/ParticleComponent.js +0 -34
  338. package/lib/module/games/space-traveller/components/ParticleComponent.js.map +0 -1
  339. package/lib/module/games/space-traveller/components/ScoreBoard.js.map +0 -1
  340. package/lib/module/games/space-traveller/components/SettingsModal.js +0 -222
  341. package/lib/module/games/space-traveller/components/SettingsModal.js.map +0 -1
  342. package/lib/module/games/space-traveller/components/Spacecraft3D.js.map +0 -1
  343. package/lib/module/games/space-traveller/components/SpacecraftPath.js +0 -37
  344. package/lib/module/games/space-traveller/components/SpacecraftPath.js.map +0 -1
  345. package/lib/module/games/space-traveller/components/index.js.map +0 -1
  346. package/lib/module/shared/settings/GameSettings.js +0 -295
  347. package/lib/module/shared/settings/GameSettings.js.map +0 -1
  348. package/lib/module/shared/settings/SettingsService.js +0 -119
  349. package/lib/module/shared/settings/SettingsService.js.map +0 -1
  350. package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts +0 -10
  351. package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts.map +0 -1
  352. package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts +0 -9
  353. package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts.map +0 -1
  354. package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts +0 -8
  355. package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts.map +0 -1
  356. package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts +0 -11
  357. package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts.map +0 -1
  358. package/lib/typescript/src/games/cat-popper/CatPopper.d.ts +0 -13
  359. package/lib/typescript/src/games/cat-popper/CatPopper.d.ts.map +0 -1
  360. package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts +0 -32
  361. package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts.map +0 -1
  362. package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts +0 -21
  363. package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts.map +0 -1
  364. package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts +0 -7
  365. package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts.map +0 -1
  366. package/lib/typescript/src/games/cat-popper/components/GameBackground.d.ts.map +0 -1
  367. package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts +0 -10
  368. package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts.map +0 -1
  369. package/lib/typescript/src/games/cat-popper/components/GameGrid.d.ts.map +0 -1
  370. package/lib/typescript/src/games/cat-popper/components/GameHole.d.ts.map +0 -1
  371. package/lib/typescript/src/games/cat-popper/components/GameOverModal.d.ts.map +0 -1
  372. package/lib/typescript/src/games/cat-popper/components/ScoreBoard.d.ts.map +0 -1
  373. package/lib/typescript/src/games/cat-popper/components/index.d.ts +0 -8
  374. package/lib/typescript/src/games/cat-popper/components/index.d.ts.map +0 -1
  375. package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts +0 -16
  376. package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts.map +0 -1
  377. package/lib/typescript/src/games/fruit-slicer/FruitSlicerService.d.ts.map +0 -1
  378. package/lib/typescript/src/games/fruit-slicer/FruitSlicerStore.d.ts.map +0 -1
  379. package/lib/typescript/src/games/fruit-slicer/components/FruitComponent.d.ts.map +0 -1
  380. package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts +0 -17
  381. package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts.map +0 -1
  382. package/lib/typescript/src/games/fruit-slicer/components/GameBackground.d.ts.map +0 -1
  383. package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts +0 -10
  384. package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts.map +0 -1
  385. package/lib/typescript/src/games/fruit-slicer/components/GameOverModal.d.ts +0 -9
  386. package/lib/typescript/src/games/fruit-slicer/components/GameOverModal.d.ts.map +0 -1
  387. package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts +0 -8
  388. package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts.map +0 -1
  389. package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts +0 -9
  390. package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts.map +0 -1
  391. package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts +0 -11
  392. package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts.map +0 -1
  393. package/lib/typescript/src/games/fruit-slicer/components/index.d.ts +0 -9
  394. package/lib/typescript/src/games/fruit-slicer/components/index.d.ts.map +0 -1
  395. package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts +0 -10
  396. package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts.map +0 -1
  397. package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts +0 -11
  398. package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts.map +0 -1
  399. package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts +0 -17
  400. package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts.map +0 -1
  401. package/lib/typescript/src/games/space-traveller/SpaceTravellerService.d.ts.map +0 -1
  402. package/lib/typescript/src/games/space-traveller/SpaceTravellerStore.d.ts.map +0 -1
  403. package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts +0 -9
  404. package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts.map +0 -1
  405. package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts +0 -17
  406. package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts.map +0 -1
  407. package/lib/typescript/src/games/space-traveller/components/GameBackground.d.ts.map +0 -1
  408. package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts +0 -10
  409. package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts.map +0 -1
  410. package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts +0 -9
  411. package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts.map +0 -1
  412. package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts +0 -8
  413. package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts.map +0 -1
  414. package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts +0 -8
  415. package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts.map +0 -1
  416. package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts +0 -9
  417. package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts.map +0 -1
  418. package/lib/typescript/src/games/space-traveller/components/Spacecraft3D.d.ts.map +0 -1
  419. package/lib/typescript/src/games/space-traveller/components/SpacecraftPath.d.ts.map +0 -1
  420. package/lib/typescript/src/games/space-traveller/components/index.d.ts.map +0 -1
  421. package/lib/typescript/src/shared/settings/GameSettings.d.ts +0 -36
  422. package/lib/typescript/src/shared/settings/GameSettings.d.ts.map +0 -1
  423. package/lib/typescript/src/shared/settings/SettingsService.d.ts +0 -32
  424. package/lib/typescript/src/shared/settings/SettingsService.d.ts.map +0 -1
  425. /package/lib/typescript/src/games/{cat-popper → fruit-ninja}/components/GameBackground.d.ts +0 -0
  426. /package/lib/typescript/src/games/{fruit-slicer → space-fighter}/components/GameBackground.d.ts +0 -0
  427. /package/lib/typescript/src/games/{space-traveller → space-fighter}/components/SpacecraftPath.d.ts +0 -0
  428. /package/lib/typescript/src/games/{space-traveller → whack-a-mole}/components/GameBackground.d.ts +0 -0
  429. /package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/ScoreBoard.d.ts +0 -0
@@ -1,57 +1,63 @@
1
1
  "use strict";
2
2
 
3
3
  import { create } from 'zustand';
4
+ import { subscribeWithSelector } from 'zustand/middleware';
4
5
  import { GAME_CONFIG } from "./BalloonBlasterService.js";
5
- export const useBalloonBlasterStore = create((set, get) => ({
6
+ import { immerMiddleware } from "../../services/GamesService.js";
7
+ // Optimized store with selective subscriptions for low-end devices
8
+ export const useBalloonBlasterStore = create()(subscribeWithSelector(immerMiddleware((set, get) => ({
6
9
  // Initial state
7
10
  score: 0,
8
- timeLeft: GAME_CONFIG.GAME_DURATION,
11
+ timeLeft: 60,
12
+ // Fixed 60 seconds regardless of difficulty
9
13
  isPlaying: false,
10
14
  gameOver: false,
11
15
  combo: 0,
12
16
  lives: GAME_CONFIG.MAX_LIVES,
13
17
  balloons: [],
18
+ particles: [],
14
19
  slicePath: [],
15
20
  isSlicing: false,
16
21
  // Actions
17
- startGame: gameDuration => {
18
- const duration = gameDuration || GAME_CONFIG.GAME_DURATION;
19
- set({
20
- score: 0,
21
- timeLeft: duration,
22
- isPlaying: true,
23
- gameOver: false,
24
- combo: 0,
25
- lives: GAME_CONFIG.MAX_LIVES,
26
- balloons: [],
27
- slicePath: [],
28
- isSlicing: false
22
+ startGame: _gameDuration => {
23
+ // Always use fixed duration regardless of difficulty or passed duration
24
+ const duration = 60;
25
+ set(draft => {
26
+ draft.score = 0;
27
+ draft.timeLeft = duration;
28
+ draft.isPlaying = true;
29
+ draft.gameOver = false;
30
+ draft.combo = 0;
31
+ draft.lives = GAME_CONFIG.MAX_LIVES;
32
+ draft.balloons = [];
33
+ draft.slicePath = [];
34
+ draft.isSlicing = false;
29
35
  });
30
36
  },
31
37
  stopGame: () => {
32
- set({
33
- score: 0,
34
- timeLeft: GAME_CONFIG.GAME_DURATION,
35
- isPlaying: false,
36
- gameOver: false,
37
- combo: 0,
38
- lives: GAME_CONFIG.MAX_LIVES,
39
- balloons: [],
40
- slicePath: [],
41
- isSlicing: false
38
+ set(draft => {
39
+ draft.score = 0;
40
+ draft.timeLeft = 60; // Fixed 60 seconds
41
+ draft.isPlaying = false;
42
+ draft.gameOver = false;
43
+ draft.combo = 0;
44
+ draft.lives = GAME_CONFIG.MAX_LIVES;
45
+ draft.balloons = [];
46
+ draft.slicePath = [];
47
+ draft.isSlicing = false;
42
48
  });
43
49
  },
44
50
  resetGame: () => {
45
- set({
46
- score: 0,
47
- timeLeft: GAME_CONFIG.GAME_DURATION,
48
- isPlaying: false,
49
- gameOver: false,
50
- combo: 0,
51
- lives: GAME_CONFIG.MAX_LIVES,
52
- balloons: [],
53
- slicePath: [],
54
- isSlicing: false
51
+ set(draft => {
52
+ draft.score = 0;
53
+ draft.timeLeft = 60; // Fixed 60 seconds
54
+ draft.isPlaying = false;
55
+ draft.gameOver = false;
56
+ draft.combo = 0;
57
+ draft.lives = GAME_CONFIG.MAX_LIVES;
58
+ draft.balloons = [];
59
+ draft.slicePath = [];
60
+ draft.isSlicing = false;
55
61
  });
56
62
  },
57
63
  popBalloon: balloonId => {
@@ -60,97 +66,118 @@ export const useBalloonBlasterStore = create((set, get) => ({
60
66
  isPlaying
61
67
  } = get();
62
68
  if (!isPlaying) return;
63
- const balloon = balloons.find(b => b.id === balloonId);
64
- if (!balloon || balloon.isPopped) return;
69
+
70
+ // Optimized: Use for-loop instead of find for better performance
71
+ let balloonIndex = -1;
72
+ for (let i = 0; i < balloons.length; i++) {
73
+ if (balloons[i].id === balloonId) {
74
+ balloonIndex = i;
75
+ break;
76
+ }
77
+ }
78
+ if (balloonIndex === -1 || balloons[balloonIndex].isPopped) return;
65
79
 
66
80
  // Simplified scoring: each balloon = 10 points (no combo multipliers)
67
81
  const points = 10;
68
- set(state => ({
69
- score: state.score + points,
70
- balloons: state.balloons.map(b => b.id === balloonId ? {
71
- ...b,
72
- isPopped: true,
73
- popTime: Date.now()
74
- } : b)
75
- }));
82
+ set(draft => {
83
+ draft.score = draft.score + points;
84
+ // Optimized: Direct array access instead of find
85
+ if (draft.balloons[balloonIndex]) {
86
+ draft.balloons[balloonIndex].isPopped = true;
87
+ draft.balloons[balloonIndex].popTime = Date.now();
88
+ }
89
+ });
76
90
  },
77
91
  updateScore: points => {
78
- set(state => ({
79
- score: state.score + points
80
- }));
92
+ set(draft => {
93
+ draft.score = draft.score + points;
94
+ });
81
95
  },
82
96
  decrementTime: () => {
83
- set(state => {
84
- const newTimeLeft = state.timeLeft - 1;
97
+ set(draft => {
98
+ const newTimeLeft = draft.timeLeft - 1;
85
99
  if (newTimeLeft <= 0) {
86
- return {
87
- timeLeft: 0,
88
- isPlaying: false,
89
- gameOver: true
90
- };
100
+ draft.timeLeft = 0;
101
+ draft.isPlaying = false;
102
+ draft.gameOver = true;
103
+ } else {
104
+ draft.timeLeft = newTimeLeft;
91
105
  }
92
- return {
93
- timeLeft: newTimeLeft
94
- };
95
106
  });
96
107
  },
97
108
  addBalloon: balloon => {
98
- set(state => ({
99
- balloons: [...state.balloons, balloon]
100
- }));
109
+ set(draft => {
110
+ // FORCE all balloons to spawn from bottom - override any wrong positions
111
+ const {
112
+ height
113
+ } = require('react-native').Dimensions.get('window');
114
+ const correctedBalloon = {
115
+ ...balloon,
116
+ position: {
117
+ x: balloon.position.x,
118
+ y: height + 20 // Force bottom spawn regardless of input
119
+ }
120
+ };
121
+ draft.balloons.push(correctedBalloon);
122
+ });
101
123
  },
102
124
  removeBalloon: balloonId => {
103
- set(state => ({
104
- balloons: state.balloons.filter(b => b.id !== balloonId)
105
- }));
125
+ set(draft => {
126
+ draft.balloons = draft.balloons.filter(b => b.id !== balloonId);
127
+ });
106
128
  },
107
129
  updateBalloon: (balloonId, updates) => {
108
- set(state => ({
109
- balloons: state.balloons.map(b => b.id === balloonId ? {
110
- ...b,
111
- ...updates
112
- } : b)
113
- }));
130
+ set(draft => {
131
+ // Optimized: Use for-loop instead of find for better performance
132
+ for (let i = 0; i < draft.balloons.length; i++) {
133
+ if (draft.balloons[i].id === balloonId) {
134
+ Object.assign(draft.balloons[i], updates);
135
+ break;
136
+ }
137
+ }
138
+ });
139
+ },
140
+ setParticles: particles => {
141
+ set(draft => {
142
+ draft.particles = particles;
143
+ });
114
144
  },
115
145
  setSlicePath: path => {
116
- set({
117
- slicePath: path
146
+ set(draft => {
147
+ draft.slicePath = path;
118
148
  });
119
149
  },
120
150
  setIsSlicing: isSlicing => {
121
- set({
122
- isSlicing
151
+ set(draft => {
152
+ draft.isSlicing = isSlicing;
123
153
  });
124
154
  },
125
155
  incrementCombo: () => {
126
- set(state => ({
127
- combo: state.combo + 1
128
- }));
156
+ set(draft => {
157
+ draft.combo = draft.combo + 1;
158
+ });
129
159
  },
130
160
  resetCombo: () => {
131
- set({
132
- combo: 0
161
+ set(draft => {
162
+ draft.combo = 0;
133
163
  });
134
164
  },
135
165
  loseLife: () => {
136
- set(state => {
137
- const newLives = state.lives - 1;
166
+ set(draft => {
167
+ const newLives = draft.lives - 1;
138
168
  if (newLives <= 0) {
139
- return {
140
- lives: 0,
141
- isPlaying: false,
142
- gameOver: true
143
- };
169
+ draft.lives = 0;
170
+ draft.isPlaying = false;
171
+ draft.gameOver = true;
172
+ } else {
173
+ draft.lives = newLives;
144
174
  }
145
- return {
146
- lives: newLives
147
- };
148
175
  });
149
176
  },
150
177
  addLife: () => {
151
- set(state => ({
152
- lives: Math.min(state.lives + 1, GAME_CONFIG.MAX_LIVES) // Cap at max lives
153
- }));
178
+ set(draft => {
179
+ draft.lives = Math.min(draft.lives + 1, GAME_CONFIG.MAX_LIVES); // Cap at max lives
180
+ });
154
181
  }
155
- }));
182
+ }))));
156
183
  //# sourceMappingURL=BalloonBlasterStore.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["create","GAME_CONFIG","useBalloonBlasterStore","set","get","score","timeLeft","GAME_DURATION","isPlaying","gameOver","combo","lives","MAX_LIVES","balloons","slicePath","isSlicing","startGame","gameDuration","duration","stopGame","resetGame","popBalloon","balloonId","balloon","find","b","id","isPopped","points","state","map","popTime","Date","now","updateScore","decrementTime","newTimeLeft","addBalloon","removeBalloon","filter","updateBalloon","updates","setSlicePath","path","setIsSlicing","incrementCombo","resetCombo","loseLife","newLives","addLife","Math","min"],"sourceRoot":"../../../../src","sources":["games/balloon-blaster/BalloonBlasterStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAEhC,SAASC,WAAW,QAAQ,4BAAyB;AAkCrD,OAAO,MAAMC,sBAAsB,GAAGF,MAAM,CAAsB,CAACG,GAAG,EAAEC,GAAG,MAAM;EAC/E;EACAC,KAAK,EAAE,CAAC;EACRC,QAAQ,EAAEL,WAAW,CAACM,aAAa;EACnCC,SAAS,EAAE,KAAK;EAChBC,QAAQ,EAAE,KAAK;EACfC,KAAK,EAAE,CAAC;EACRC,KAAK,EAAEV,WAAW,CAACW,SAAS;EAC5BC,QAAQ,EAAE,EAAE;EACZC,SAAS,EAAE,EAAE;EACbC,SAAS,EAAE,KAAK;EAEhB;EACAC,SAAS,EAAGC,YAAqB,IAAK;IACpC,MAAMC,QAAQ,GAAGD,YAAY,IAAIhB,WAAW,CAACM,aAAa;IAC1DJ,GAAG,CAAC;MACFE,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tB,KAAK,CAAClB,KAAK,GAAG,CAAC,EAAEV,WAAW,CAACW,SAAS,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;EACL;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["create","subscribeWithSelector","GAME_CONFIG","immerMiddleware","useBalloonBlasterStore","set","get","score","timeLeft","isPlaying","gameOver","combo","lives","MAX_LIVES","balloons","particles","slicePath","isSlicing","startGame","_gameDuration","duration","draft","stopGame","resetGame","popBalloon","balloonId","balloonIndex","i","length","id","isPopped","points","popTime","Date","now","updateScore","decrementTime","newTimeLeft","addBalloon","balloon","height","require","Dimensions","correctedBalloon","position","x","y","push","removeBalloon","filter","b","updateBalloon","updates","Object","assign","setParticles","setSlicePath","path","setIsSlicing","incrementCombo","resetCombo","loseLife","newLives","addLife","Math","min"],"sourceRoot":"../../../../src","sources":["games/balloon-blaster/BalloonBlasterStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,qBAAqB,QAAQ,oBAAoB;AAE1D,SAASC,WAAW,QAAQ,4BAAyB;AACrD,SAASC,eAAe,QAAQ,gCAA6B;AAoC7D;AACA,OAAO,MAAMC,sBAAsB,GAAGJ,MAAM,CAAsB,CAAC,CACjEC,qBAAqB,CACnBE,eAAe,CAAC,CAACE,GAAQ,EAAEC,GAAQ,MAAM;EAC3C;EACAC,KAAK,EAAE,CAAC;EACRC,QAAQ,EAAE,EAAE;EAAE;EACdC,SAAS,EAAE,KAAK;EAChBC,QAAQ,EAAE,KAAK;EACfC,KAAK,EAAE,CAAC;EACRC,KAAK,EAAEV,WAAW,CAACW,SAAS;EAC5BC,QAAQ,EAAE,EAAE;EACZC,SAAS,EAAE,EAAE;EACbC,SAAS,EAAE,EAAE;EACbC,SAAS,EAAE,KAAK;EAEhB;EACAC,SAAS,EAAGC,aAAsB,IAAK;IACrC;IACA,MAAMC,QAAQ,GAAG,EAAE;IACnBf,GAAG,CAAEgB,KAAU,IAAK;M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,CAAC;EAEDC,OAAO,EAAEA,CAAA,KAAM;IACb1D,GAAG,CAAEgB,KAAU,IAAK;MAClBA,KAAK,CAACT,KAAK,GAAGoD,IAAI,CAACC,GAAG,CAAC5C,KAAK,CAACT,KAAK,GAAG,CAAC,EAAEV,WAAW,CAACW,SAAS,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC;EACJ;AACF,CAAC,CAAC,CAAC,CAAC,CAAC","ignoreList":[]}
@@ -1,18 +1,38 @@
1
1
  "use strict";
2
2
 
3
- import React, { useEffect } from 'react';
4
- import { TouchableOpacity } from 'react-native';
5
- import { Canvas, LinearGradient, vec, Path, Skia, Oval, Circle } from '@shopify/react-native-skia';
3
+ import React, { useEffect, useMemo, useCallback } from 'react';
4
+ import { TouchableOpacity, Dimensions } from 'react-native';
5
+ import { Canvas, vec, Path, Skia, Oval, Circle } from '@shopify/react-native-skia';
6
6
  import Animated, { useSharedValue, useAnimatedStyle, withSpring, withTiming } from 'react-native-reanimated';
7
7
  import { GAME_CONFIG, ANIMATION_CONFIG } from "../BalloonBlasterService.js";
8
+
9
+ // Constants for better maintainability
8
10
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
9
- export const BalloonComponent = ({
11
+ const BALLOON_HEIGHT_MULTIPLIER = 1.2;
12
+ const STRING_LENGTH = 25;
13
+ const HIGHLIGHT_OPACITY = 0.5;
14
+ const BALLOON_OPACITY = 0.8;
15
+ const DANGER_CIRCLE_RADIUS = 8;
16
+ const GLOW_RADIUS_MULTIPLIER = 0.6;
17
+ const GLOW_OPACITY = 0.3;
18
+
19
+ // Types for better type safety
20
+
21
+ export const BalloonComponent = /*#__PURE__*/React.memo(({
10
22
  balloon,
11
23
  onPop
12
24
  }) => {
25
+ // Get screen dimensions
26
+ const {
27
+ height
28
+ } = Dimensions.get('window');
29
+
30
+ // FORCE all balloons to start from bottom - override any wrong positions
31
+ const initialY = balloon.position.y > height ? balloon.position.y : height + 20;
32
+
13
33
  // Animated values for smooth movement
14
34
  const translateX = useSharedValue(balloon.position.x);
15
- const translateY = useSharedValue(balloon.position.y);
35
+ const translateY = useSharedValue(initialY); // Force bottom start
16
36
  const rotation = useSharedValue(balloon.rotation);
17
37
  const scale = useSharedValue(balloon.isPopped ? 0 : 1);
18
38
  const opacity = useSharedValue(balloon.isPopped ? 0 : 1);
@@ -56,27 +76,43 @@ export const BalloonComponent = ({
56
76
  height: GAME_CONFIG.BALLOON_SIZE,
57
77
  zIndex: balloon.isBomb ? 10 : 5
58
78
  };
59
- const getBalloonColors = () => {
79
+
80
+ // Optimized color manipulation functions
81
+ const lightenColor = useCallback((color, amount) => {
82
+ const hex = color.replace('#', '');
83
+ const r = Math.min(255, parseInt(hex.substring(0, 2), 16) + Math.round(255 * amount));
84
+ const g = Math.min(255, parseInt(hex.substring(2, 4), 16) + Math.round(255 * amount));
85
+ const b = Math.min(255, parseInt(hex.substring(4, 6), 16) + Math.round(255 * amount));
86
+ return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
87
+ }, []);
88
+ const darkenColor = useCallback((color, amount) => {
89
+ const hex = color.replace('#', '');
90
+ const r = Math.max(0, parseInt(hex.substring(0, 2), 16) - Math.round(255 * amount));
91
+ const g = Math.max(0, parseInt(hex.substring(2, 4), 16) - Math.round(255 * amount));
92
+ const b = Math.max(0, parseInt(hex.substring(4, 6), 16) - Math.round(255 * amount));
93
+ return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
94
+ }, []);
95
+
96
+ // Optimized balloon color calculation with proper memoization
97
+ const colors = useMemo(() => {
60
98
  if (balloon.isBomb) {
61
- // Black bomb balloons with danger symbol
62
99
  return {
63
100
  primary: '#1a1a1a',
64
- // Dark black
65
101
  secondary: '#333333',
66
- // Slightly lighter black
67
102
  highlight: '#555555',
68
- // Gray highlight
69
- shadow: '#000000' // Pure black shadow (won't be used)
103
+ shadow: '#000000'
104
+ };
105
+ }
106
+ if (balloon.isBonus) {
107
+ return {
108
+ primary: '#FFD700',
109
+ secondary: '#FFEB3B',
110
+ highlight: '#FFF59D',
111
+ shadow: '#CC8800'
70
112
  };
71
113
  }
72
- if (balloon.isBonus) return {
73
- primary: '#FFD700',
74
- secondary: '#FFEB3B',
75
- highlight: '#FFF59D',
76
- shadow: '#CC8800'
77
- };
78
114
 
79
- // Use balloon's vibrant colors with enhanced gradients
115
+ // Regular balloon colors with optimized calculation
80
116
  const baseColor = balloon.type.color || '#FF0080';
81
117
  return {
82
118
  primary: baseColor,
@@ -84,144 +120,118 @@ export const BalloonComponent = ({
84
120
  highlight: lightenColor(baseColor, 0.5),
85
121
  shadow: darkenColor(baseColor, 0.3)
86
122
  };
87
- };
123
+ }, [balloon.isBomb, balloon.isBonus, balloon.type.color, lightenColor, darkenColor]);
88
124
 
89
- // Helper functions for color manipulation
90
- const lightenColor = (color, amount) => {
91
- const hex = color.replace('#', '');
92
- const r = Math.min(255, parseInt(hex.substr(0, 2), 16) + Math.round(255 * amount));
93
- const g = Math.min(255, parseInt(hex.substr(2, 2), 16) + Math.round(255 * amount));
94
- const b = Math.min(255, parseInt(hex.substr(4, 2), 16) + Math.round(255 * amount));
95
- return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
96
- };
97
- const darkenColor = (color, amount) => {
98
- const hex = color.replace('#', '');
99
- const r = Math.max(0, parseInt(hex.substr(0, 2), 16) - Math.round(255 * amount));
100
- const g = Math.max(0, parseInt(hex.substr(2, 2), 16) - Math.round(255 * amount));
101
- const b = Math.max(0, parseInt(hex.substr(4, 2), 16) - Math.round(255 * amount));
102
- return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
103
- };
104
- const colors = getBalloonColors();
105
- const balloonWidth = GAME_CONFIG.BALLOON_SIZE;
106
- const balloonHeight = GAME_CONFIG.BALLOON_SIZE * 1.2; // Make it oval - taller than wide
107
- const stringLength = 25; // Length of balloon string
108
- const totalHeight = balloonHeight + stringLength; // Total height including string
109
- const center = vec(balloonWidth / 2, balloonHeight / 2);
110
-
111
- // Generate a unique curved string path for each balloon
112
- const generateCurvedStringPath = () => {
125
+ // Memoized dimensions for better performance
126
+ const dimensions = useMemo(() => {
127
+ const balloonWidth = GAME_CONFIG.BALLOON_SIZE;
128
+ const balloonHeight = GAME_CONFIG.BALLOON_SIZE * BALLOON_HEIGHT_MULTIPLIER;
129
+ const totalHeight = balloonHeight + STRING_LENGTH;
130
+ const center = vec(balloonWidth / 2, balloonHeight / 2);
131
+ return {
132
+ balloonWidth,
133
+ balloonHeight,
134
+ totalHeight,
135
+ center
136
+ };
137
+ }, []);
138
+
139
+ // Optimized curved string path generation with better memoization
140
+ const curvedStringPath = useMemo(() => {
113
141
  const path = Skia.Path.Make();
114
- const startX = center.x;
115
- const startY = balloonHeight - 2;
142
+ const startX = dimensions.center.x;
143
+ const startY = dimensions.balloonHeight - 2;
116
144
 
117
- // Create a seed based on balloon ID for consistent random curves per balloon
145
+ // Optimized seed generation for consistent random curves
118
146
  const seed = balloon.id.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
119
147
  const random = index => (seed + index * 17) % 100 / 100;
120
148
  path.moveTo(startX, startY);
121
149
 
122
- // Create curved string with multiple control points
123
- const segments = 4; // Number of curve segments
124
- const segmentHeight = stringLength / segments;
150
+ // Optimized string generation with minimal segments
151
+ const segments = 2;
152
+ const segmentHeight = STRING_LENGTH / segments;
125
153
  for (let i = 1; i <= segments; i++) {
126
154
  const y = startY + segmentHeight * i;
127
- const waveAmplitude = 3 + random(i) * 4; // Random wave amplitude 3-7px
128
- const waveOffset = (random(i + 10) - 0.5) * waveAmplitude * 2; // Random offset
155
+ const waveAmplitude = 2 + random(i) * 2;
156
+ const waveOffset = (random(i + 10) - 0.5) * waveAmplitude;
129
157
  const x = startX + waveOffset;
130
-
131
- // Add some curve variation
132
- const controlX1 = startX + (random(i + 20) - 0.5) * waveAmplitude;
133
- const controlY1 = y - segmentHeight * 0.3;
134
- const controlX2 = x + (random(i + 30) - 0.5) * waveAmplitude * 0.5;
135
- const controlY2 = y - segmentHeight * 0.1;
136
- path.cubicTo(controlX1, controlY1, controlX2, controlY2, x, y);
158
+ const controlX1 = startX + (random(i + 20) - 0.5) * waveAmplitude * 0.5;
159
+ const controlY1 = y - segmentHeight * 0.5;
160
+ path.quadTo(controlX1, controlY1, x, y);
137
161
  }
138
162
  return path;
139
- };
163
+ }, [balloon.id, dimensions.center.x, dimensions.balloonHeight]);
164
+
165
+ // Memoized tap handler for better performance
166
+ const handleTap = useCallback(() => {
167
+ onPop?.(balloon.id);
168
+ }, [onPop, balloon.id]);
140
169
  return /*#__PURE__*/_jsx(Animated.View, {
141
170
  style: [containerStyle, animatedStyle],
142
171
  children: /*#__PURE__*/_jsx(TouchableOpacity, {
143
- onPress: () => {
144
- console.log('Balloon tapped:', balloon.id);
145
- onPop?.(balloon.id);
146
- },
172
+ onPress: handleTap,
147
173
  activeOpacity: 0.8,
148
174
  style: {
149
- width: balloonWidth,
150
- height: totalHeight
175
+ width: dimensions.balloonWidth,
176
+ height: dimensions.totalHeight
151
177
  },
152
178
  children: /*#__PURE__*/_jsxs(Canvas, {
153
179
  style: {
154
- width: balloonWidth,
155
- height: totalHeight
180
+ width: dimensions.balloonWidth,
181
+ height: dimensions.totalHeight
156
182
  },
157
183
  pointerEvents: "none",
158
- children: [!balloon.isBomb && /*#__PURE__*/_jsx(Oval, {
159
- x: 2,
160
- y: 2,
161
- width: balloonWidth - 4,
162
- height: balloonHeight - 4,
163
- color: colors.shadow,
164
- opacity: 0.2
165
- }), /*#__PURE__*/_jsx(Oval, {
184
+ children: [/*#__PURE__*/_jsx(Oval, {
166
185
  x: 0,
167
186
  y: 0,
168
- width: balloonWidth,
169
- height: balloonHeight,
170
- opacity: 0.7,
171
- children: /*#__PURE__*/_jsx(LinearGradient, {
172
- start: vec(0, 0),
173
- end: vec(balloonWidth, balloonHeight),
174
- colors: [colors.highlight, colors.primary, colors.shadow]
175
- })
187
+ width: dimensions.balloonWidth,
188
+ height: dimensions.balloonHeight,
189
+ color: colors.primary,
190
+ opacity: BALLOON_OPACITY
176
191
  }), /*#__PURE__*/_jsx(Oval, {
177
- x: balloonWidth * 0.15,
178
- y: balloonHeight * 0.1,
179
- width: balloonWidth * 0.4,
180
- height: balloonHeight * 0.3,
192
+ x: dimensions.balloonWidth * 0.2,
193
+ y: dimensions.balloonHeight * 0.15,
194
+ width: dimensions.balloonWidth * 0.3,
195
+ height: dimensions.balloonHeight * 0.2,
181
196
  color: colors.highlight,
182
- opacity: 0.4
183
- }), /*#__PURE__*/_jsx(Oval, {
184
- x: balloonWidth * 0.2,
185
- y: balloonHeight * 0.15,
186
- width: balloonWidth * 0.2,
187
- height: balloonHeight * 0.15,
188
- color: "#FFFFFF",
189
- opacity: 0.6
197
+ opacity: HIGHLIGHT_OPACITY
190
198
  }), balloon.isBomb && /*#__PURE__*/_jsxs(_Fragment, {
191
- children: [/*#__PURE__*/_jsx(Path, {
192
- path: Skia.Path.Make().moveTo(center.x, center.y - 10).lineTo(center.x - 8, center.y + 6).lineTo(center.x + 8, center.y + 6).close(),
199
+ children: [/*#__PURE__*/_jsx(Circle, {
200
+ cx: dimensions.center.x,
201
+ cy: dimensions.center.y,
202
+ r: DANGER_CIRCLE_RADIUS,
193
203
  color: "#FF0000",
194
204
  opacity: 0.9
195
205
  }), /*#__PURE__*/_jsx(Path, {
196
- path: Skia.Path.Make().moveTo(center.x, center.y - 6).lineTo(center.x, center.y + 1),
206
+ path: Skia.Path.Make().moveTo(dimensions.center.x, dimensions.center.y - 4).lineTo(dimensions.center.x, dimensions.center.y + 1),
197
207
  color: "#FFFFFF",
198
208
  style: "stroke",
199
209
  strokeWidth: 2,
200
210
  strokeCap: "round"
201
211
  }), /*#__PURE__*/_jsx(Circle, {
202
- cx: center.x,
203
- cy: center.y + 4,
204
- r: 1.5,
212
+ cx: dimensions.center.x,
213
+ cy: dimensions.center.y + 3,
214
+ r: 1,
205
215
  color: "#FFFFFF"
206
216
  })]
207
217
  }), !balloon.isBonus && /*#__PURE__*/_jsx(Path, {
208
- path: generateCurvedStringPath(),
209
- color: "#8B4513" // Regular brown string for all balloons including bombs
210
- ,
218
+ path: curvedStringPath,
219
+ color: "#8B4513",
211
220
  style: "stroke",
212
221
  strokeWidth: 1.5,
213
- strokeCap: "round",
214
- strokeJoin: "round"
215
- }), balloon.isBonus && /*#__PURE__*/_jsx(Oval, {
216
- x: -5,
217
- y: -5,
218
- width: balloonWidth + 10,
219
- height: balloonHeight + 10,
222
+ strokeCap: "round"
223
+ }), balloon.isBonus && /*#__PURE__*/_jsx(Circle, {
224
+ cx: dimensions.center.x,
225
+ cy: dimensions.center.y,
226
+ r: dimensions.balloonWidth * GLOW_RADIUS_MULTIPLIER,
220
227
  color: "#FFD700",
221
- opacity: 0.2
228
+ opacity: GLOW_OPACITY
222
229
  })]
223
230
  })
224
231
  })
225
232
  });
226
- };
233
+ }, (prevProps, nextProps) => {
234
+ // Custom comparison for React.memo - only re-render if essential props change
235
+ return prevProps.balloon.id === nextProps.balloon.id && prevProps.balloon.position.x === nextProps.balloon.position.x && prevProps.balloon.position.y === nextProps.balloon.position.y && prevProps.balloon.rotation === nextProps.balloon.rotation && prevProps.balloon.isPopped === nextProps.balloon.isPopped && prevProps.balloon.isBomb === nextProps.balloon.isBomb && prevProps.balloon.isBonus === nextProps.balloon.isBonus;
236
+ });
227
237
  //# sourceMappingURL=BalloonComponent.js.map