react-native-games 0.4.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 (275) hide show
  1. package/README.md +121 -130
  2. package/lib/module/games/balloon-blaster/BalloonBlaster.js +111 -423
  3. package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
  4. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +27 -28
  5. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -1
  6. package/lib/module/games/balloon-blaster/BalloonBlasterService.js +42 -117
  7. package/lib/module/games/balloon-blaster/BalloonBlasterService.js.map +1 -1
  8. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +12 -1
  9. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js.map +1 -1
  10. package/lib/module/games/balloon-blaster/components/BalloonComponent.js +102 -75
  11. package/lib/module/games/balloon-blaster/components/BalloonComponent.js.map +1 -1
  12. package/lib/module/games/balloon-blaster/components/GameArea.js +139 -30
  13. package/lib/module/games/balloon-blaster/components/GameArea.js.map +1 -1
  14. package/lib/module/games/balloon-blaster/components/ScoreBoard.js +7 -6
  15. package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
  16. package/lib/module/games/balloon-blaster/components/index.js +0 -3
  17. package/lib/module/games/balloon-blaster/components/index.js.map +1 -1
  18. package/lib/module/games/fruit-ninja/FruitNinja.js +94 -376
  19. package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -1
  20. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +19 -22
  21. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -1
  22. package/lib/module/games/fruit-ninja/FruitNinjaService.js +30 -9
  23. package/lib/module/games/fruit-ninja/FruitNinjaService.js.map +1 -1
  24. package/lib/module/games/fruit-ninja/FruitNinjaStore.js +29 -4
  25. package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -1
  26. package/lib/module/games/fruit-ninja/components/GameArea.js +194 -29
  27. package/lib/module/games/fruit-ninja/components/GameArea.js.map +1 -1
  28. package/lib/module/games/fruit-ninja/components/GameBackground.js +107 -190
  29. package/lib/module/games/fruit-ninja/components/GameBackground.js.map +1 -1
  30. package/lib/module/games/fruit-ninja/components/ScoreBoard.js +9 -30
  31. package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -1
  32. package/lib/module/games/fruit-ninja/components/index.js +0 -3
  33. package/lib/module/games/fruit-ninja/components/index.js.map +1 -1
  34. package/lib/module/games/maze-runner/MazeRunner.js +106 -109
  35. package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
  36. package/lib/module/games/maze-runner/MazeRunnerConstants.js +19 -24
  37. package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -1
  38. package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +5 -4
  39. package/lib/module/games/maze-runner/components/EnhancedBallComponent.js.map +1 -1
  40. package/lib/module/games/maze-runner/components/EnhancedGameArea.js +16 -7
  41. package/lib/module/games/maze-runner/components/EnhancedGameArea.js.map +1 -1
  42. package/lib/module/games/maze-runner/components/ScoreBoard.js +8 -3
  43. package/lib/module/games/maze-runner/components/ScoreBoard.js.map +1 -1
  44. package/lib/module/games/maze-runner/components/WallComponent.js +3 -2
  45. package/lib/module/games/maze-runner/components/WallComponent.js.map +1 -1
  46. package/lib/module/games/maze-runner/components/index.js +0 -1
  47. package/lib/module/games/maze-runner/components/index.js.map +1 -1
  48. package/lib/module/games/popit-fidget/PopitFidget.js +113 -112
  49. package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -1
  50. package/lib/module/games/popit-fidget/PopitFidgetConstants.js +20 -23
  51. package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -1
  52. package/lib/module/games/popit-fidget/PopitFidgetService.js +0 -59
  53. package/lib/module/games/popit-fidget/PopitFidgetService.js.map +1 -1
  54. package/lib/module/games/popit-fidget/PopitFidgetStore.js +0 -27
  55. package/lib/module/games/popit-fidget/PopitFidgetStore.js.map +1 -1
  56. package/lib/module/games/popit-fidget/components/BubbleComponent.js +24 -22
  57. package/lib/module/games/popit-fidget/components/BubbleComponent.js.map +1 -1
  58. package/lib/module/games/popit-fidget/components/GameBackground.js +4 -1
  59. package/lib/module/games/popit-fidget/components/GameBackground.js.map +1 -1
  60. package/lib/module/games/popit-fidget/components/ScoreBoard.js +9 -2
  61. package/lib/module/games/popit-fidget/components/ScoreBoard.js.map +1 -1
  62. package/lib/module/games/popit-fidget/components/index.js +0 -2
  63. package/lib/module/games/popit-fidget/components/index.js.map +1 -1
  64. package/lib/module/games/space-fighter/SpaceFighter.js +121 -369
  65. package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -1
  66. package/lib/module/games/space-fighter/SpaceFighterConstants.js +21 -23
  67. package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -1
  68. package/lib/module/games/space-fighter/SpaceFighterService.js +30 -11
  69. package/lib/module/games/space-fighter/SpaceFighterService.js.map +1 -1
  70. package/lib/module/games/space-fighter/SpaceFighterStore.js +54 -2
  71. package/lib/module/games/space-fighter/SpaceFighterStore.js.map +1 -1
  72. package/lib/module/games/space-fighter/components/AsteroidComponent.js +7 -5
  73. package/lib/module/games/space-fighter/components/AsteroidComponent.js.map +1 -1
  74. package/lib/module/games/space-fighter/components/GameArea.js +234 -14
  75. package/lib/module/games/space-fighter/components/GameArea.js.map +1 -1
  76. package/lib/module/games/space-fighter/components/GameBackground.js +10 -65
  77. package/lib/module/games/space-fighter/components/GameBackground.js.map +1 -1
  78. package/lib/module/games/space-fighter/components/ScoreBoard.js +9 -7
  79. package/lib/module/games/space-fighter/components/ScoreBoard.js.map +1 -1
  80. package/lib/module/games/space-fighter/components/Spacecraft3D.js +72 -111
  81. package/lib/module/games/space-fighter/components/Spacecraft3D.js.map +1 -1
  82. package/lib/module/games/space-fighter/components/SpacecraftPath.js +42 -27
  83. package/lib/module/games/space-fighter/components/SpacecraftPath.js.map +1 -1
  84. package/lib/module/games/space-fighter/components/index.js +0 -3
  85. package/lib/module/games/space-fighter/components/index.js.map +1 -1
  86. package/lib/module/games/whack-a-mole/WhackAMole.js +63 -73
  87. package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -1
  88. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +17 -19
  89. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -1
  90. package/lib/module/games/whack-a-mole/WhackAMoleStore.js +20 -7
  91. package/lib/module/games/whack-a-mole/WhackAMoleStore.js.map +1 -1
  92. package/lib/module/games/whack-a-mole/components/GameHole.js +2 -2
  93. package/lib/module/games/whack-a-mole/components/GameHole.js.map +1 -1
  94. package/lib/module/games/whack-a-mole/components/ScoreBoard.js +5 -1
  95. package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -1
  96. package/lib/module/games/whack-a-mole/components/index.js +0 -1
  97. package/lib/module/games/whack-a-mole/components/index.js.map +1 -1
  98. package/lib/module/services/GamesConstants.js +13 -21
  99. package/lib/module/services/GamesConstants.js.map +1 -1
  100. package/lib/module/services/GamesService.js +30 -26
  101. package/lib/module/services/GamesService.js.map +1 -1
  102. package/lib/module/services/SoundsService.js +21 -21
  103. package/lib/module/shared/helpers/AnimationFrame.js +120 -0
  104. package/lib/module/shared/helpers/AnimationFrame.js.map +1 -0
  105. package/lib/module/shared/helpers/AnimationTracker.js +89 -0
  106. package/lib/module/shared/helpers/AnimationTracker.js.map +1 -0
  107. package/lib/module/shared/helpers/ErrorHandler.js +269 -0
  108. package/lib/module/shared/helpers/ErrorHandler.js.map +1 -0
  109. package/lib/module/shared/helpers/GameControlButton.js +67 -58
  110. package/lib/module/shared/helpers/GameControlButton.js.map +1 -1
  111. package/lib/module/{games/whack-a-mole/components → shared/helpers}/GameOverModal.js +23 -13
  112. package/lib/module/shared/helpers/GameOverModal.js.map +1 -0
  113. package/lib/module/shared/helpers/GameSettingsModal.js +287 -0
  114. package/lib/module/shared/helpers/GameSettingsModal.js.map +1 -0
  115. package/lib/module/shared/helpers/ParticleBlast.js +133 -0
  116. package/lib/module/shared/helpers/ParticleBlast.js.map +1 -0
  117. package/lib/module/shared/helpers/index.js +7 -0
  118. package/lib/module/shared/helpers/index.js.map +1 -1
  119. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts +2 -14
  120. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
  121. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +8 -7
  122. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts.map +1 -1
  123. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts +0 -2
  124. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts.map +1 -1
  125. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts.map +1 -1
  126. package/lib/typescript/src/games/balloon-blaster/components/BalloonComponent.d.ts.map +1 -1
  127. package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts +1 -15
  128. package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts.map +1 -1
  129. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts +1 -7
  130. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
  131. package/lib/typescript/src/games/balloon-blaster/components/index.d.ts +0 -3
  132. package/lib/typescript/src/games/balloon-blaster/components/index.d.ts.map +1 -1
  133. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts +2 -14
  134. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -1
  135. package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts +5 -5
  136. package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts.map +1 -1
  137. package/lib/typescript/src/games/fruit-ninja/FruitNinjaService.d.ts +9 -1
  138. package/lib/typescript/src/games/fruit-ninja/FruitNinjaService.d.ts.map +1 -1
  139. package/lib/typescript/src/games/fruit-ninja/FruitNinjaStore.d.ts +1 -0
  140. package/lib/typescript/src/games/fruit-ninja/FruitNinjaStore.d.ts.map +1 -1
  141. package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts +1 -15
  142. package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts.map +1 -1
  143. package/lib/typescript/src/games/fruit-ninja/components/GameBackground.d.ts.map +1 -1
  144. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts +1 -7
  145. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -1
  146. package/lib/typescript/src/games/fruit-ninja/components/index.d.ts +0 -3
  147. package/lib/typescript/src/games/fruit-ninja/components/index.d.ts.map +1 -1
  148. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts +2 -8
  149. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
  150. package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts +4 -4
  151. package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts.map +1 -1
  152. package/lib/typescript/src/games/maze-runner/components/EnhancedBallComponent.d.ts.map +1 -1
  153. package/lib/typescript/src/games/maze-runner/components/EnhancedGameArea.d.ts.map +1 -1
  154. package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts.map +1 -1
  155. package/lib/typescript/src/games/maze-runner/components/WallComponent.d.ts.map +1 -1
  156. package/lib/typescript/src/games/maze-runner/components/index.d.ts +0 -1
  157. package/lib/typescript/src/games/maze-runner/components/index.d.ts.map +1 -1
  158. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts +2 -8
  159. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -1
  160. package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts +4 -4
  161. package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts.map +1 -1
  162. package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts +0 -21
  163. package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts.map +1 -1
  164. package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts +1 -5
  165. package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts.map +1 -1
  166. package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts.map +1 -1
  167. package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts +2 -2
  168. package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts.map +1 -1
  169. package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts +2 -2
  170. package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts.map +1 -1
  171. package/lib/typescript/src/games/popit-fidget/components/index.d.ts +0 -2
  172. package/lib/typescript/src/games/popit-fidget/components/index.d.ts.map +1 -1
  173. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts +3 -8
  174. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -1
  175. package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts +4 -4
  176. package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts.map +1 -1
  177. package/lib/typescript/src/games/space-fighter/SpaceFighterService.d.ts.map +1 -1
  178. package/lib/typescript/src/games/space-fighter/SpaceFighterStore.d.ts.map +1 -1
  179. package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts +0 -1
  180. package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts.map +1 -1
  181. package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts +1 -15
  182. package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts.map +1 -1
  183. package/lib/typescript/src/games/space-fighter/components/GameBackground.d.ts.map +1 -1
  184. package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts +1 -6
  185. package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts.map +1 -1
  186. package/lib/typescript/src/games/space-fighter/components/Spacecraft3D.d.ts.map +1 -1
  187. package/lib/typescript/src/games/space-fighter/components/SpacecraftPath.d.ts.map +1 -1
  188. package/lib/typescript/src/games/space-fighter/components/index.d.ts +0 -3
  189. package/lib/typescript/src/games/space-fighter/components/index.d.ts.map +1 -1
  190. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts +2 -11
  191. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -1
  192. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +2 -2
  193. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts.map +1 -1
  194. package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts.map +1 -1
  195. package/lib/typescript/src/games/whack-a-mole/components/index.d.ts +0 -1
  196. package/lib/typescript/src/games/whack-a-mole/components/index.d.ts.map +1 -1
  197. package/lib/typescript/src/services/GamesConstants.d.ts +47 -38
  198. package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
  199. package/lib/typescript/src/services/GamesService.d.ts +20 -3
  200. package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
  201. package/lib/typescript/src/services/SoundsService.d.ts +20 -20
  202. package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts +41 -0
  203. package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts.map +1 -0
  204. package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts +45 -0
  205. package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts.map +1 -0
  206. package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts +124 -0
  207. package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts.map +1 -0
  208. package/lib/typescript/src/shared/helpers/GameControlButton.d.ts.map +1 -1
  209. package/lib/typescript/src/{games/balloon-blaster/components → shared/helpers}/GameOverModal.d.ts +5 -0
  210. package/lib/typescript/src/shared/helpers/GameOverModal.d.ts.map +1 -0
  211. package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts +9 -0
  212. package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts.map +1 -0
  213. package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts +12 -0
  214. package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts.map +1 -0
  215. package/lib/typescript/src/shared/helpers/index.d.ts +9 -0
  216. package/lib/typescript/src/shared/helpers/index.d.ts.map +1 -1
  217. package/package.json +1 -1
  218. package/lib/module/games/balloon-blaster/components/GameOverModal.js +0 -133
  219. package/lib/module/games/balloon-blaster/components/GameOverModal.js.map +0 -1
  220. package/lib/module/games/balloon-blaster/components/ParticleSystem.js +0 -55
  221. package/lib/module/games/balloon-blaster/components/ParticleSystem.js.map +0 -1
  222. package/lib/module/games/balloon-blaster/components/SliceTrail.js +0 -58
  223. package/lib/module/games/balloon-blaster/components/SliceTrail.js.map +0 -1
  224. package/lib/module/games/fruit-ninja/components/GameOverModal.js +0 -189
  225. package/lib/module/games/fruit-ninja/components/GameOverModal.js.map +0 -1
  226. package/lib/module/games/fruit-ninja/components/ParticleSystem.js +0 -52
  227. package/lib/module/games/fruit-ninja/components/ParticleSystem.js.map +0 -1
  228. package/lib/module/games/fruit-ninja/components/SliceTrail.js +0 -58
  229. package/lib/module/games/fruit-ninja/components/SliceTrail.js.map +0 -1
  230. package/lib/module/games/maze-runner/components/GameOverModal.js +0 -134
  231. package/lib/module/games/maze-runner/components/GameOverModal.js.map +0 -1
  232. package/lib/module/games/popit-fidget/components/GameOverModal.js +0 -132
  233. package/lib/module/games/popit-fidget/components/GameOverModal.js.map +0 -1
  234. package/lib/module/games/popit-fidget/components/ParticleSystem.js +0 -89
  235. package/lib/module/games/popit-fidget/components/ParticleSystem.js.map +0 -1
  236. package/lib/module/games/space-fighter/components/GameOverModal.js +0 -182
  237. package/lib/module/games/space-fighter/components/GameOverModal.js.map +0 -1
  238. package/lib/module/games/space-fighter/components/ParticleComponent.js +0 -34
  239. package/lib/module/games/space-fighter/components/ParticleComponent.js.map +0 -1
  240. package/lib/module/games/space-fighter/components/SettingsModal.js +0 -222
  241. package/lib/module/games/space-fighter/components/SettingsModal.js.map +0 -1
  242. package/lib/module/games/whack-a-mole/components/GameOverModal.js.map +0 -1
  243. package/lib/module/shared/settings/GameSettings.js +0 -295
  244. package/lib/module/shared/settings/GameSettings.js.map +0 -1
  245. package/lib/module/shared/settings/SettingsService.js +0 -125
  246. package/lib/module/shared/settings/SettingsService.js.map +0 -1
  247. package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts.map +0 -1
  248. package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts +0 -8
  249. package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts.map +0 -1
  250. package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts +0 -11
  251. package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts.map +0 -1
  252. package/lib/typescript/src/games/fruit-ninja/components/GameOverModal.d.ts +0 -9
  253. package/lib/typescript/src/games/fruit-ninja/components/GameOverModal.d.ts.map +0 -1
  254. package/lib/typescript/src/games/fruit-ninja/components/ParticleSystem.d.ts +0 -8
  255. package/lib/typescript/src/games/fruit-ninja/components/ParticleSystem.d.ts.map +0 -1
  256. package/lib/typescript/src/games/fruit-ninja/components/SliceTrail.d.ts +0 -11
  257. package/lib/typescript/src/games/fruit-ninja/components/SliceTrail.d.ts.map +0 -1
  258. package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts +0 -11
  259. package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts.map +0 -1
  260. package/lib/typescript/src/games/popit-fidget/components/GameOverModal.d.ts +0 -9
  261. package/lib/typescript/src/games/popit-fidget/components/GameOverModal.d.ts.map +0 -1
  262. package/lib/typescript/src/games/popit-fidget/components/ParticleSystem.d.ts +0 -9
  263. package/lib/typescript/src/games/popit-fidget/components/ParticleSystem.d.ts.map +0 -1
  264. package/lib/typescript/src/games/space-fighter/components/GameOverModal.d.ts +0 -9
  265. package/lib/typescript/src/games/space-fighter/components/GameOverModal.d.ts.map +0 -1
  266. package/lib/typescript/src/games/space-fighter/components/ParticleComponent.d.ts +0 -8
  267. package/lib/typescript/src/games/space-fighter/components/ParticleComponent.d.ts.map +0 -1
  268. package/lib/typescript/src/games/space-fighter/components/SettingsModal.d.ts +0 -9
  269. package/lib/typescript/src/games/space-fighter/components/SettingsModal.d.ts.map +0 -1
  270. package/lib/typescript/src/games/whack-a-mole/components/GameOverModal.d.ts +0 -9
  271. package/lib/typescript/src/games/whack-a-mole/components/GameOverModal.d.ts.map +0 -1
  272. package/lib/typescript/src/shared/settings/GameSettings.d.ts +0 -36
  273. package/lib/typescript/src/shared/settings/GameSettings.d.ts.map +0 -1
  274. package/lib/typescript/src/shared/settings/SettingsService.d.ts +0 -33
  275. package/lib/typescript/src/shared/settings/SettingsService.d.ts.map +0 -1
package/README.md CHANGED
@@ -38,181 +38,171 @@ Follow the installation guides for each peer dependency:
38
38
  - **[react-native-gesture-handler](https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation)** - Gestures
39
39
  - **[expo-speech](https://docs.expo.dev/versions/latest/sdk/speech/)** - Text-to-speech functionality
40
40
  - **[expo-haptics](https://docs.expo.dev/versions/latest/sdk/haptics/)** - Haptic feedback
41
+ - **[react-native-worklets](https://github.com/margelo/react-native-worklets)** - JavaScript worklets for high-performance animations
41
42
 
42
43
  ## 🚀 Usage
43
44
 
44
- ### Basic Implementation
45
+ ### Simple Implementation
46
+
47
+ For basic usage without settings persistence:
45
48
 
46
49
  ```tsx
47
50
  import React, { useState } from 'react';
48
- import { View, StyleSheet } from 'react-native';
49
- import { WhackAMole, PopitFidget, FruitNinja, MazeRunner, SpaceFighter, BalloonBlaster } from 'react-native-games';
51
+ import { View } from 'react-native';
52
+ import { DEFAULT_GAME_SETTINGS, BalloonBlaster } from 'react-native-games';
50
53
 
51
54
  export default function GameScreen() {
52
- const [showSettings, setShowSettings] = useState(false);
55
+ const [settings, setSettings] = useState(DEFAULT_GAME_SETTINGS);
53
56
 
54
57
  return (
55
- <View style={styles.container}>
56
- {/* Whack A Mole Game - Classic whack-a-mole with cats */}
57
- <WhackAMole
58
- showSettingsModal={showSettings}
59
- onToggleSettingsModal={() => setShowSettings(!showSettings)}
60
- />
61
-
62
- {/* Or choose any other game */}
63
- {/* <PopitFidget /> */}
64
- {/* <FruitNinja /> */}
65
- {/* <MazeRunner /> */}
66
- {/* <SpaceFighter /> */}
67
- {/* <BalloonBlaster /> */}
58
+ <View style={{ flex: 1 }}>
59
+ <BalloonBlaster settings={settings} onSettingsChange={setSettings} />
68
60
  </View>
69
61
  );
70
62
  }
71
-
72
- const styles = StyleSheet.create({
73
- container: {
74
- flex: 1,
75
- backgroundColor: '#1a1a2e'
76
- }
77
- });
78
63
  ```
79
64
 
80
- ### Game-Specific Props & Default Settings
65
+ ### Advanced Implementation Example
66
+
67
+ All games use the same props pattern for consistency. Here's a complete example with settings persistence and navigation integration:
81
68
 
82
- #### Whack A Mole
83
69
  ```tsx
84
- <WhackAMole
85
- showSettingsModal={boolean} // Control settings modal visibility
86
- onToggleSettingsModal={() => void} // Settings modal toggle callback
87
- />
70
+ import { View, TouchableOpacity } from 'react-native';
71
+ import { useState, useLayoutEffect } from 'react';
72
+ import { useNavigation, useTheme } from '@react-navigation/native';
73
+ import { Ionicons } from '@expo/vector-icons';
74
+ import { DEFAULT_GAME_SETTINGS, GAME_IDS, type GameSettings, FruitNinja } from 'react-native-games';
75
+ import { StorageService } from '../services/StorageService';
76
+
77
+ export default function FruitNinjaScreen() {
78
+ const { colors } = useTheme();
79
+ const storedSettings = StorageService.get(GAME_IDS.FRUIT_NINJA);
80
+ const [settings, setSettings] = useState(storedSettings || DEFAULT_GAME_SETTINGS);
81
+ const navigation = useNavigation();
82
+
83
+ const handleSettingsChange = (newSettings: GameSettings) => {
84
+ setSettings(newSettings);
85
+ StorageService.set(GAME_IDS.FRUIT_NINJA, newSettings);
86
+ };
87
+
88
+ const handleToggleSettingsModal = () => {
89
+ setSettings({...settings, isVisible: !settings.isVisible});
90
+ };
91
+
92
+ useLayoutEffect(() => {
93
+ navigation.setOptions({
94
+ headerRight: () => (
95
+ <TouchableOpacity
96
+ onPress={handleToggleSettingsModal}
97
+ className="p-2"
98
+ >
99
+ <Ionicons name="settings-outline" size={24} color={colors.text} />
100
+ </TouchableOpacity>
101
+ ),
102
+ });
103
+ }, [navigation, handleToggleSettingsModal]);
88
104
 
89
- // Default Settings:
90
- // {
91
- // difficulty: 'medium', // Balanced challenge
92
- // soundEnabled: true, // Audio feedback enabled
93
- // hapticEnabled: true, // Haptic feedback enabled
94
- // gameDuration: 120 // Auto-set based on difficulty (Easy: 60s, Medium: 120s, Hard: 180s)
95
- // }
96
- // Available: difficulty ['easy','medium','hard']
97
- // Cat spawn intervals: easy 2000ms, medium 1500ms, hard 1000ms
98
- // Cat visible duration: easy 2500ms, medium 2000ms, hard 1500ms
99
- // Grid sizes: easy/medium 3x3, hard 4x4
105
+ return (
106
+ <View className="flex-1 bg-background">
107
+ <FruitNinja settings={settings} onSettingsChange={handleSettingsChange} />
108
+ </View>
109
+ );
110
+ }
100
111
  ```
101
112
 
102
- #### Popit Fidget
103
- ```tsx
104
- <PopitFidget
105
- showSettingsModal={boolean} // Control settings modal visibility
106
- onToggleSettingsModal={() => void} // Settings modal toggle callback
107
- />
113
+ ### Available Games
108
114
 
109
- // Default Settings:
110
- // {
111
- // difficulty: 'medium', // Balanced challenge
112
- // soundEnabled: true, // Audio feedback enabled
113
- // hapticEnabled: true, // Haptic feedback enabled
114
- // gameDuration: 120 // Auto-set based on difficulty (Easy: 60s, Medium: 120s, Hard: 180s)
115
- // }
116
- // Available: difficulty ['easy','medium','hard']
117
- // Relaxing bubble popping with satisfying sound effects
118
- // Different bubble shapes and colors for variety
119
- ```
115
+ All games use the same props interface:
120
116
 
121
- #### Fruit Ninja
122
117
  ```tsx
123
- <FruitNinja
124
- showSettingsModal={boolean} // Control settings modal visibility
125
- onToggleSettingsModal={() => void} // Settings modal toggle callback
118
+ // Import any game you want
119
+ import {
120
+ WhackAMole,
121
+ PopitFidget,
122
+ FruitNinja,
123
+ MazeRunner,
124
+ SpaceFighter,
125
+ BalloonBlaster
126
+ } from 'react-native-games';
127
+
128
+ // All games accept the same props:
129
+ <GameComponent
130
+ settings={settings}
131
+ onSettingsChange={handleSettingsChange}
126
132
  />
127
-
128
- // Default Settings:
129
- // {
130
- // difficulty: 'medium', // Balanced challenge
131
- // soundEnabled: true, // Audio feedback enabled
132
- // hapticEnabled: true, // Haptic feedback enabled
133
- // gameDuration: 120 // Auto-set based on difficulty (Easy: 60s, Medium: 120s, Hard: 180s)
134
- // }
135
- // Available: difficulty ['easy','medium','hard']
136
- // Balloons rise from bottom to top with physics-based movement
137
- // Spawn intervals and speeds adjust automatically with difficulty
138
133
  ```
139
134
 
140
- #### Space Fighter
141
- ```tsx
142
- <SpaceFighter
143
- showSettingsModal={boolean} // Control settings modal visibility
144
- onToggleSettingsModal={() => void} // Settings modal toggle callback
145
- />
135
+ ### Game Settings & Configuration
146
136
 
147
- // Default Settings:
148
- // {
149
- // difficulty: 'medium', // Balanced challenge
150
- // soundEnabled: true, // Audio feedback enabled
151
- // hapticEnabled: true, // Haptic feedback enabled
152
- // gameDuration: 120 // Auto-set based on difficulty (Easy: 60s, Medium: 120s, Hard: 180s)
153
- // }
154
- // Available: difficulty ['easy','medium','hard']
155
- // Spawn intervals: easy 2000ms, medium 1500ms, hard 1000ms
156
- ```
137
+ All games use the unified `GameSettings` interface:
157
138
 
158
- #### Maze Runner
159
139
  ```tsx
160
- <MazeRunner
161
- showSettingsModal={boolean} // Control settings modal visibility
162
- onToggleSettingsModal={() => void} // Settings modal toggle callback
163
- />
140
+ interface GameSettings {
141
+ isVisible: boolean; // Settings modal visibility
142
+ difficulty: 'easy' | 'medium' | 'hard';
143
+ enableSounds: boolean; // Audio feedback
144
+ enableHaptics: boolean; // Haptic feedback
145
+ }
164
146
 
165
- // Default Settings:
166
- // {
167
- // difficulty: 'medium', // Balanced challenge
168
- // soundEnabled: true, // Audio feedback enabled
169
- // hapticEnabled: true, // Haptic feedback enabled
170
- // gameDuration: 120, // Auto-set based on difficulty (Easy: 60s, Medium: 120s, Hard: 180s)
171
- // gridSize: 10, // 10x10 maze grid (auto-adjusts with difficulty)
172
- // showHints: false // No hints by default
173
- // }
174
- // Available: difficulty ['easy','medium','hard']
175
- // Grid sizes: easy 8x8, medium 10x10, hard 12x12 (auto-adjusts with difficulty)
176
- // Procedurally generated mazes with intelligent pathfinding
147
+ // Default settings for all games
148
+ const DEFAULT_GAME_SETTINGS = {
149
+ isVisible: false,
150
+ difficulty: 'medium',
151
+ enableSounds: true,
152
+ enableHaptics: true,
153
+ };
177
154
  ```
178
155
 
179
- #### Balloon Blaster
180
- ```tsx
181
- <BalloonBlaster
182
- showSettingsModal={boolean} // Control settings modal visibility
183
- onToggleSettingsModal={() => void} // Settings modal toggle callback
184
- />
156
+ #### Game-Specific Behaviors
185
157
 
186
- // Default Settings:
187
- // {
188
- // difficulty: 'medium', // Balanced challenge
189
- // soundEnabled: true, // Audio feedback enabled
190
- // hapticEnabled: true, // Haptic feedback enabled
191
- // gameDuration: 120, // Auto-set based on difficulty (Easy: 60s, Medium: 120s, Hard: 180s)
192
- // asteroidSpawnInterval: 3000, // 3 seconds between asteroid pairs
193
- // asteroidSpeed: 2 // Movement speed multiplier
194
- // }
195
- // Available: difficulty ['easy','medium','hard']
196
- // Horizontal drag controls with collision immunity system
197
- // Progressive difficulty with faster asteroids and shorter spawn intervals
198
- ```
158
+ **Whack A Mole**
159
+ - Cat spawn intervals: easy 2000ms, medium 1500ms, hard 1000ms
160
+ - Cat visible duration: easy 2500ms, medium 2000ms, hard 1500ms
161
+ - Grid sizes: easy/medium 3x3, hard 4x4
162
+
163
+ **Popit Fidget**
164
+ - Relaxing bubble popping with satisfying sound effects
165
+ - Different bubble shapes and colors for variety
166
+ - Difficulty affects bubble responsiveness and patterns
167
+
168
+ **Fruit Ninja**
169
+ - Fixed 60-second gameplay sessions
170
+ - Physics-based slicing with particle effects and combo system
171
+ - Difficulty affects fruit spawn rate and bomb frequency
172
+
173
+ **Space Fighter**
174
+ - Progressive difficulty with asteroid spawn intervals
175
+ - Horizontal drag controls with collision immunity system
176
+ - Difficulty affects asteroid speed and spawn frequency
177
+
178
+ **Maze Runner**
179
+ - Grid sizes: easy 8x8, medium 10x10, hard 12x12
180
+ - Procedurally generated mazes with intelligent pathfinding
181
+ - Difficulty affects maze complexity and time limits
182
+
183
+ **Balloon Blaster**
184
+ - Fixed 60-second gameplay sessions
185
+ - Balloon spawn interval: 1200ms, rise speed: 0.08
186
+ - Physics-based balloon movement with particle effects
199
187
 
200
188
  ### Game Settings
201
189
 
202
190
  Each game includes built-in settings screens with a unified, simplified interface:
203
191
 
204
- - **Difficulty Levels**: Easy (60s), Medium (120s), Hard (180s) - automatically sets game duration
192
+ - **Difficulty Levels**: Easy, Medium, Hard - each game has custom difficulty descriptions and behaviors
205
193
  - **Sound Effects**: Toggle audio feedback on/off
206
194
  - **Haptic Feedback**: Toggle vibration feedback on/off
207
195
 
208
- All games use a centralized settings system for consistency and ease of maintenance.
196
+ All games use a centralized settings system for consistency and ease of maintenance. Game durations and difficulty behaviors are customized per game for optimal gameplay experience.
209
197
 
210
198
  ## 🎨 Features
211
199
 
212
200
  ### 🚀 **High Performance**
213
201
  - Built with React Native Skia for 60fps gameplay
214
- - Optimized animations using Reanimated 3
215
- - Efficient rendering and memory management
202
+ - Optimized animations using Reanimated 3 with worklets
203
+ - Delta time physics loops for consistent performance
204
+ - React.memo optimizations and efficient state management
205
+ - Minimal re-renders with direct store subscriptions
216
206
 
217
207
  ### 🎵 **Rich Audio & Haptics**
218
208
  - Sound effects and speech synthesis
@@ -268,7 +258,8 @@ See the complete [LICENSE](LICENSE) file for detailed terms and definitions.
268
258
 
269
259
  - Built with [React Native Skia](https://shopify.github.io/react-native-skia/) for high-performance graphics
270
260
  - Powered by [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated/) for smooth animations
271
- - State management with [Zustand](https://github.com/pmndrs/zustand)
261
+ - Enhanced with [React Native Worklets](https://github.com/margelo/react-native-worklets) for high-performance JavaScript
262
+ - State management with [Zustand](https://github.com/pmndrs/zustand) and [Immer](https://github.com/immerjs/immer)
272
263
  - Created with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
273
264
 
274
265
  ## 📞 Support