@nayan-ui/games 1.20.0 → 1.21.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 (552) hide show
  1. package/lib/module/games/arrows/Arrows.js +1 -1
  2. package/lib/module/games/arrows/ArrowsScene.js +1 -1
  3. package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -1
  4. package/lib/module/games/balloon-blaster/BalloonBlasterScene.js +1 -1
  5. package/lib/module/games/bike-racing/BikeMeshes.js +1 -1
  6. package/lib/module/games/bike-racing/BikeRacing.js +1 -1
  7. package/lib/module/games/bike-racing/BikeRacingConstants.js +1 -1
  8. package/lib/module/games/bike-racing/BikeRacingScene.js +1 -1
  9. package/lib/module/games/block-blast/BlockBlast.js +1 -1
  10. package/lib/module/games/block-blast/BlockBlastScene.js +1 -1
  11. package/lib/module/games/block-breaker/BlockBreaker.js +1 -1
  12. package/lib/module/games/block-breaker/BlockBreakerScene.js +1 -1
  13. package/lib/module/games/bluk/Bluk.js +1 -1
  14. package/lib/module/games/bluk/BlukScene.js +1 -1
  15. package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -1
  16. package/lib/module/games/bubble-shooter/BubbleShooterScene.js +1 -1
  17. package/lib/module/games/candy-crush/CandyCrush.js +1 -1
  18. package/lib/module/games/candy-crush/CandyCrushScene.js +1 -1
  19. package/lib/module/games/car-racing/CarMeshes.js +1 -1
  20. package/lib/module/games/car-racing/CarRacing.js +1 -1
  21. package/lib/module/games/car-racing/CarRacingScene.js +1 -1
  22. package/lib/module/games/chameleon-run/ChameleonRun.js +1 -1
  23. package/lib/module/games/chameleon-run/ChameleonRunBackdrop.js +1 -1
  24. package/lib/module/games/chameleon-run/ChameleonRunMeshes.js +1 -1
  25. package/lib/module/games/checkers/Checkers.js +1 -1
  26. package/lib/module/games/checkers/CheckersScene.js +1 -1
  27. package/lib/module/games/color-switch/ColorSwitch.js +1 -1
  28. package/lib/module/games/color-switch/ColorSwitchScene.js +1 -1
  29. package/lib/module/games/colors-sort/ColorsSort.js +1 -1
  30. package/lib/module/games/colors-sort/ColorsSortScene.js +1 -1
  31. package/lib/module/games/connect-em-all/ConnectEmAll.js +1 -1
  32. package/lib/module/games/connect-em-all/ConnectEmAllScene.js +1 -1
  33. package/lib/module/games/crossy-road/CrossyRoad.js +1 -1
  34. package/lib/module/games/crossy-road/CrossyRoadMeshes.js +1 -1
  35. package/lib/module/games/crossy-road/CrossyRoadPerson.js +1 -1
  36. package/lib/module/games/dino-jump/DinoJump.js +1 -1
  37. package/lib/module/games/dino-jump/DinoJumpScene.js +1 -1
  38. package/lib/module/games/dots-and-boxes/DotsAndBoxes.js +1 -1
  39. package/lib/module/games/dots-and-boxes/DotsAndBoxesScene.js +1 -1
  40. package/lib/module/games/falling-sticks/FallingSticks.js +1 -1
  41. package/lib/module/games/falling-sticks/FallingSticksScene.js +1 -1
  42. package/lib/module/games/find-different-number/FindDifferentNumber.js +1 -1
  43. package/lib/module/games/find-different-number/FindDifferentNumberScene.js +1 -1
  44. package/lib/module/games/flappy-bird/FlappyBird.js +1 -1
  45. package/lib/module/games/flappy-bird/FlappyBirdScene.js +1 -1
  46. package/lib/module/games/fruit-merger/FruitMerger.js +1 -1
  47. package/lib/module/games/fruit-merger/FruitMergerScene.js +1 -1
  48. package/lib/module/games/fruit-ninja/FruitNinja.js +1 -1
  49. package/lib/module/games/fruit-ninja/FruitNinjaScene.js +1 -1
  50. package/lib/module/games/fruit-ninja/FruitNinjaWorld.js +1 -1
  51. package/lib/module/games/game-2048/Game2048.js +1 -1
  52. package/lib/module/games/game-2048/Game2048Scene.js +1 -1
  53. package/lib/module/games/knife-hit/KnifeHit.js +1 -1
  54. package/lib/module/games/knife-hit/KnifeHitScene.js +1 -1
  55. package/lib/module/games/ludo-king/LudoKing.js +1 -1
  56. package/lib/module/games/ludo-king/LudoKingScene.js +1 -1
  57. package/lib/module/games/maze-runner/MazeRunner.js +1 -1
  58. package/lib/module/games/maze-runner/MazeRunnerScene.js +1 -1
  59. package/lib/module/games/memory-match/MemoryMatch.js +1 -1
  60. package/lib/module/games/memory-match/MemoryMatchScene.js +1 -1
  61. package/lib/module/games/mine-sweeper/MineSweeper.js +1 -1
  62. package/lib/module/games/mine-sweeper/MineSweeperScene.js +1 -1
  63. package/lib/module/games/mob-control/MobControl.js +1 -1
  64. package/lib/module/games/mob-control/MobControlGame.js +1 -1
  65. package/lib/module/games/mob-control/MobControlMeshes.js +1 -1
  66. package/lib/module/games/mob-control/MobControlRenderer.js +1 -1
  67. package/lib/module/games/mob-control/MobControlRules.js +1 -1
  68. package/lib/module/games/mob-control/MobControlScene.js +1 -1
  69. package/lib/module/games/nuts-and-bolts/NutsAndBolts.js +1 -1
  70. package/lib/module/games/nuts-and-bolts/NutsAndBoltsScene.js +1 -1
  71. package/lib/module/games/pac-man/PacMan.js +1 -1
  72. package/lib/module/games/pac-man/PacManGame.js +1 -1
  73. package/lib/module/games/pac-man/PacManScene.js +1 -1
  74. package/lib/module/games/paper-io/PaperIo.js +1 -1
  75. package/lib/module/games/paper-io/PaperIoMeshes.js +1 -1
  76. package/lib/module/games/paper-io/PaperIoScene.js +1 -1
  77. package/lib/module/games/penguin-run/PenguinMeshes.js +1 -1
  78. package/lib/module/games/penguin-run/PenguinRun.js +1 -1
  79. package/lib/module/games/penguin-run/PenguinRunScene.js +1 -1
  80. package/lib/module/games/perfect-circle/PerfectCircle.js +1 -1
  81. package/lib/module/games/perfect-circle/PerfectCircleScene.js +1 -1
  82. package/lib/module/games/pipe-connect/PipeConnect.js +1 -1
  83. package/lib/module/games/pipe-connect/PipeConnectScene.js +1 -1
  84. package/lib/module/games/play-with-tua/PlayWithTua.js +1 -1
  85. package/lib/module/games/popit-fidget/PopitFidget.js +1 -1
  86. package/lib/module/games/popit-fidget/PopitFidgetScene.js +1 -1
  87. package/lib/module/games/reversi/Reversi.js +1 -1
  88. package/lib/module/games/reversi/ReversiScene.js +1 -1
  89. package/lib/module/games/search-grid/SearchGrid.js +1 -1
  90. package/lib/module/games/search-grid/SearchGridScene.js +1 -1
  91. package/lib/module/games/shared/BackdropCard.js +1 -1
  92. package/lib/module/games/shared/EngineBackdrop.js +1 -1
  93. package/lib/module/games/shared/EngineBlasts.js +1 -1
  94. package/lib/module/games/shared/EngineBlocks.js +1 -1
  95. package/lib/module/games/shared/EngineDice.js +1 -1
  96. package/lib/module/games/shared/EngineFruits.js +1 -1
  97. package/lib/module/games/shared/EngineGameLoader.js +1 -1
  98. package/lib/module/games/shared/EngineGameScreen.js +1 -1
  99. package/lib/module/games/shared/EngineGlyphs.js +1 -1
  100. package/lib/module/games/shared/EngineHud.js +1 -1
  101. package/lib/module/games/shared/EngineMeadow.js +1 -1
  102. package/lib/module/games/shared/EngineTouchSurface.js +1 -1
  103. package/lib/module/games/shared/GameActivity.js +1 -1
  104. package/lib/module/games/shared/GameLoading.js +1 -1
  105. package/lib/module/games/shared/GameLoadingTransition.js +1 -1
  106. package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -1
  107. package/lib/module/games/sliding-numbers/SlidingNumbersScene.js +1 -1
  108. package/lib/module/games/snake-3d/Snake3D.js +1 -1
  109. package/lib/module/games/snake-3d/Snake3DScene.js +1 -1
  110. package/lib/module/games/snakes-and-ladders/SnakesAndLadders.js +1 -1
  111. package/lib/module/games/snakes-and-ladders/SnakesAndLaddersScene.js +1 -1
  112. package/lib/module/games/space-fighter/SpaceFighter.js +1 -1
  113. package/lib/module/games/space-fighter/SpaceFighterScene.js +1 -1
  114. package/lib/module/games/spider-solitaire/SpiderSolitaire.js +1 -1
  115. package/lib/module/games/spider-solitaire/SpiderSolitaireScene.js +1 -1
  116. package/lib/module/games/stack-tower/StackTower.js +1 -1
  117. package/lib/module/games/stack-tower/StackTowerScene.js +1 -1
  118. package/lib/module/games/sudoku/Sudoku.js +1 -1
  119. package/lib/module/games/sudoku/SudokuScene.js +1 -1
  120. package/lib/module/games/tangram/Tangram.js +1 -1
  121. package/lib/module/games/tangram/TangramScene.js +1 -1
  122. package/lib/module/games/tank-1990/Tank1990.js +1 -1
  123. package/lib/module/games/tank-1990/Tank1990Scene.js +1 -1
  124. package/lib/module/games/tic-tac-toe/TicTacToe.js +1 -1
  125. package/lib/module/games/tic-tac-toe/TicTacToeScene.js +1 -1
  126. package/lib/module/games/tile-home/TileHome.js +1 -1
  127. package/lib/module/games/tile-home/TileHomeScene.js +1 -1
  128. package/lib/module/games/treasure-hunt/TreasureHunt.js +1 -1
  129. package/lib/module/games/treasure-hunt/TreasureHuntConstants.js +1 -1
  130. package/lib/module/games/treasure-hunt/TreasureHuntModel.js +1 -1
  131. package/lib/module/games/treasure-hunt/TreasureHuntScene.js +1 -1
  132. package/lib/module/games/whack-a-mole/WhackAMole.js +1 -1
  133. package/lib/module/games/whack-a-mole/WhackAMoleScene.js +1 -1
  134. package/lib/module/helpers/GameSettingsModal.js +1 -1
  135. package/lib/module/helpers/GameTheme.js +1 -1
  136. package/package.json +1 -2
  137. package/src/assets/fonts/Inter-SemiBold.ttf +0 -0
  138. package/src/assets/models/explorer/explorer.glb +0 -0
  139. package/src/assets/models/explorer/params.json +0 -51
  140. package/src/assets/models/explorer/source.json +0 -222
  141. package/src/assets/models/play-with-tua/play-with-tua.glb +0 -0
  142. package/src/assets/models/play-with-tua/sources.json +0 -141
  143. package/src/assets/sfx/balloon_pop.wav +0 -0
  144. package/src/assets/sfx/blocked.wav +0 -0
  145. package/src/assets/sfx/boing.wav +0 -0
  146. package/src/assets/sfx/bonus.wav +0 -0
  147. package/src/assets/sfx/boom.wav +0 -0
  148. package/src/assets/sfx/bump.wav +0 -0
  149. package/src/assets/sfx/cannon.wav +0 -0
  150. package/src/assets/sfx/capture.wav +0 -0
  151. package/src/assets/sfx/card_flip.wav +0 -0
  152. package/src/assets/sfx/card_place.wav +0 -0
  153. package/src/assets/sfx/catch.wav +0 -0
  154. package/src/assets/sfx/chime.wav +0 -0
  155. package/src/assets/sfx/chomp.wav +0 -0
  156. package/src/assets/sfx/chomp_alt.wav +0 -0
  157. package/src/assets/sfx/clack.wav +0 -0
  158. package/src/assets/sfx/clang.wav +0 -0
  159. package/src/assets/sfx/clash.wav +0 -0
  160. package/src/assets/sfx/click.wav +0 -0
  161. package/src/assets/sfx/coin.wav +0 -0
  162. package/src/assets/sfx/combo.wav +0 -0
  163. package/src/assets/sfx/crash.wav +0 -0
  164. package/src/assets/sfx/crunch.wav +0 -0
  165. package/src/assets/sfx/dance.wav +0 -0
  166. package/src/assets/sfx/deselect.wav +0 -0
  167. package/src/assets/sfx/dice_roll.wav +0 -0
  168. package/src/assets/sfx/die.wav +0 -0
  169. package/src/assets/sfx/draw.wav +0 -0
  170. package/src/assets/sfx/drop.wav +0 -0
  171. package/src/assets/sfx/eat.wav +0 -0
  172. package/src/assets/sfx/engine.wav +0 -0
  173. package/src/assets/sfx/error.wav +0 -0
  174. package/src/assets/sfx/flag.wav +0 -0
  175. package/src/assets/sfx/flap.wav +0 -0
  176. package/src/assets/sfx/flip_disc.wav +0 -0
  177. package/src/assets/sfx/footstep_run.wav +0 -0
  178. package/src/assets/sfx/footstep_walk.wav +0 -0
  179. package/src/assets/sfx/game_over.wav +0 -0
  180. package/src/assets/sfx/gate.wav +0 -0
  181. package/src/assets/sfx/hit.wav +0 -0
  182. package/src/assets/sfx/hop.wav +0 -0
  183. package/src/assets/sfx/hurt.wav +0 -0
  184. package/src/assets/sfx/invalid.wav +0 -0
  185. package/src/assets/sfx/jump.wav +0 -0
  186. package/src/assets/sfx/ladder.wav +0 -0
  187. package/src/assets/sfx/land.wav +0 -0
  188. package/src/assets/sfx/laugh.wav +0 -0
  189. package/src/assets/sfx/lose.wav +0 -0
  190. package/src/assets/sfx/merge.wav +0 -0
  191. package/src/assets/sfx/miss.wav +0 -0
  192. package/src/assets/sfx/nitro.wav +0 -0
  193. package/src/assets/sfx/pew.wav +0 -0
  194. package/src/assets/sfx/place.wav +0 -0
  195. package/src/assets/sfx/pling.wav +0 -0
  196. package/src/assets/sfx/point.wav +0 -0
  197. package/src/assets/sfx/pop.wav +0 -0
  198. package/src/assets/sfx/pop_soft.wav +0 -0
  199. package/src/assets/sfx/power_up.wav +0 -0
  200. package/src/assets/sfx/reveal.wav +0 -0
  201. package/src/assets/sfx/robot.wav +0 -0
  202. package/src/assets/sfx/rotate.wav +0 -0
  203. package/src/assets/sfx/run_steps.wav +0 -0
  204. package/src/assets/sfx/select.wav +0 -0
  205. package/src/assets/sfx/shuffle.wav +0 -0
  206. package/src/assets/sfx/six.wav +0 -0
  207. package/src/assets/sfx/slice.wav +0 -0
  208. package/src/assets/sfx/slide.wav +0 -0
  209. package/src/assets/sfx/snake.wav +0 -0
  210. package/src/assets/sfx/snap.wav +0 -0
  211. package/src/assets/sfx/splash.wav +0 -0
  212. package/src/assets/sfx/star.wav +0 -0
  213. package/src/assets/sfx/start.wav +0 -0
  214. package/src/assets/sfx/swoosh.wav +0 -0
  215. package/src/assets/sfx/tap.wav +0 -0
  216. package/src/assets/sfx/thud.wav +0 -0
  217. package/src/assets/sfx/thunk.wav +0 -0
  218. package/src/assets/sfx/tick.wav +0 -0
  219. package/src/assets/sfx/time_up.wav +0 -0
  220. package/src/assets/sfx/tock.wav +0 -0
  221. package/src/assets/sfx/walk_steps.wav +0 -0
  222. package/src/assets/sfx/warning.wav +0 -0
  223. package/src/assets/sfx/whack.wav +0 -0
  224. package/src/assets/sfx/whoosh.wav +0 -0
  225. package/src/assets/sfx/win.wav +0 -0
  226. package/src/assets/sfx/zap.wav +0 -0
  227. package/src/assets/textures/ad_bolt.png +0 -0
  228. package/src/assets/textures/ad_bubbles.png +0 -0
  229. package/src/assets/textures/ad_chevrons.png +0 -0
  230. package/src/assets/textures/asphalt.png +0 -0
  231. package/src/assets/textures/bark.jpg +0 -0
  232. package/src/assets/textures/explorer-atlas.png +0 -0
  233. package/src/assets/textures/facade.png +0 -0
  234. package/src/assets/textures/grass.png +0 -0
  235. package/src/assets/textures/leaves.png +0 -0
  236. package/src/assets/textures/limestone.jpg +0 -0
  237. package/src/assets/textures/meadow.jpg +0 -0
  238. package/src/assets/textures/nature-sources.json +0 -87
  239. package/src/assets/textures/pine.png +0 -0
  240. package/src/assets/textures/river.jpg +0 -0
  241. package/src/assets/textures/soft_glow.png +0 -0
  242. package/src/games/arrows/Arrows.tsx +0 -69
  243. package/src/games/arrows/ArrowsConstants.ts +0 -107
  244. package/src/games/arrows/ArrowsGame.ts +0 -735
  245. package/src/games/arrows/ArrowsScene.ts +0 -395
  246. package/src/games/balloon-blaster/BalloonBlaster.tsx +0 -75
  247. package/src/games/balloon-blaster/BalloonBlasterConstants.ts +0 -79
  248. package/src/games/balloon-blaster/BalloonBlasterGame.ts +0 -287
  249. package/src/games/balloon-blaster/BalloonBlasterPhysics.ts +0 -95
  250. package/src/games/balloon-blaster/BalloonBlasterScene.ts +0 -225
  251. package/src/games/bike-racing/BikeMeshes.ts +0 -273
  252. package/src/games/bike-racing/BikeRacing.tsx +0 -211
  253. package/src/games/bike-racing/BikeRacingConstants.ts +0 -103
  254. package/src/games/bike-racing/BikeRacingGame.ts +0 -557
  255. package/src/games/bike-racing/BikeRacingScene.ts +0 -119
  256. package/src/games/block-blast/BlockBlast.tsx +0 -73
  257. package/src/games/block-blast/BlockBlastConstants.ts +0 -179
  258. package/src/games/block-blast/BlockBlastGame.ts +0 -471
  259. package/src/games/block-blast/BlockBlastScene.ts +0 -156
  260. package/src/games/block-breaker/BlockBreaker.tsx +0 -79
  261. package/src/games/block-breaker/BlockBreakerConstants.ts +0 -139
  262. package/src/games/block-breaker/BlockBreakerGame.ts +0 -459
  263. package/src/games/block-breaker/BlockBreakerScene.ts +0 -257
  264. package/src/games/bluk/Bluk.tsx +0 -82
  265. package/src/games/bluk/BlukConstants.ts +0 -121
  266. package/src/games/bluk/BlukGame.ts +0 -323
  267. package/src/games/bluk/BlukRules.ts +0 -154
  268. package/src/games/bluk/BlukScene.ts +0 -514
  269. package/src/games/bubble-shooter/BubbleShooter.tsx +0 -76
  270. package/src/games/bubble-shooter/BubbleShooterConstants.ts +0 -103
  271. package/src/games/bubble-shooter/BubbleShooterGame.ts +0 -459
  272. package/src/games/bubble-shooter/BubbleShooterScene.ts +0 -158
  273. package/src/games/candy-crush/CandyCrush.tsx +0 -77
  274. package/src/games/candy-crush/CandyCrushConstants.ts +0 -94
  275. package/src/games/candy-crush/CandyCrushGame.ts +0 -477
  276. package/src/games/candy-crush/CandyCrushScene.ts +0 -209
  277. package/src/games/car-racing/CarMeshes.ts +0 -440
  278. package/src/games/car-racing/CarRacing.tsx +0 -211
  279. package/src/games/car-racing/CarRacingConstants.ts +0 -167
  280. package/src/games/car-racing/CarRacingFacade.ts +0 -40
  281. package/src/games/car-racing/CarRacingGame.ts +0 -539
  282. package/src/games/car-racing/CarRacingScene.ts +0 -1026
  283. package/src/games/car-racing/CarRacingScenery.ts +0 -265
  284. package/src/games/chameleon-run/ChameleonRun.tsx +0 -96
  285. package/src/games/chameleon-run/ChameleonRunBackdrop.ts +0 -186
  286. package/src/games/chameleon-run/ChameleonRunConstants.ts +0 -47
  287. package/src/games/chameleon-run/ChameleonRunGame.ts +0 -309
  288. package/src/games/chameleon-run/ChameleonRunMeshes.ts +0 -305
  289. package/src/games/chameleon-run/ChameleonRunRules.ts +0 -252
  290. package/src/games/chameleon-run/ChameleonRunScene.ts +0 -310
  291. package/src/games/checkers/Checkers.tsx +0 -83
  292. package/src/games/checkers/CheckersAI.ts +0 -255
  293. package/src/games/checkers/CheckersConstants.ts +0 -68
  294. package/src/games/checkers/CheckersGame.ts +0 -322
  295. package/src/games/checkers/CheckersRules.ts +0 -167
  296. package/src/games/checkers/CheckersScene.ts +0 -308
  297. package/src/games/color-switch/ColorSwitch.tsx +0 -75
  298. package/src/games/color-switch/ColorSwitchConstants.ts +0 -61
  299. package/src/games/color-switch/ColorSwitchGame.ts +0 -329
  300. package/src/games/color-switch/ColorSwitchScene.ts +0 -220
  301. package/src/games/colors-sort/ColorsSort.tsx +0 -82
  302. package/src/games/colors-sort/ColorsSortConstants.ts +0 -119
  303. package/src/games/colors-sort/ColorsSortGame.ts +0 -246
  304. package/src/games/colors-sort/ColorsSortScene.ts +0 -315
  305. package/src/games/connect-em-all/ConnectEmAll.tsx +0 -70
  306. package/src/games/connect-em-all/ConnectEmAllConstants.ts +0 -77
  307. package/src/games/connect-em-all/ConnectEmAllGame.ts +0 -401
  308. package/src/games/connect-em-all/ConnectEmAllScene.ts +0 -235
  309. package/src/games/crossy-road/CrossyRoad.tsx +0 -74
  310. package/src/games/crossy-road/CrossyRoadCamera.ts +0 -59
  311. package/src/games/crossy-road/CrossyRoadConstants.ts +0 -132
  312. package/src/games/crossy-road/CrossyRoadGame.ts +0 -293
  313. package/src/games/crossy-road/CrossyRoadMeshes.ts +0 -195
  314. package/src/games/crossy-road/CrossyRoadPerson.ts +0 -198
  315. package/src/games/crossy-road/CrossyRoadRules.ts +0 -99
  316. package/src/games/crossy-road/CrossyRoadScene.ts +0 -355
  317. package/src/games/dino-jump/DinoJump.tsx +0 -77
  318. package/src/games/dino-jump/DinoJumpConstants.ts +0 -80
  319. package/src/games/dino-jump/DinoJumpGame.ts +0 -344
  320. package/src/games/dino-jump/DinoJumpScene.ts +0 -686
  321. package/src/games/dots-and-boxes/DotsAndBoxes.tsx +0 -83
  322. package/src/games/dots-and-boxes/DotsAndBoxesConstants.ts +0 -77
  323. package/src/games/dots-and-boxes/DotsAndBoxesGame.ts +0 -271
  324. package/src/games/dots-and-boxes/DotsAndBoxesScene.ts +0 -249
  325. package/src/games/falling-sticks/FallingSticks.tsx +0 -72
  326. package/src/games/falling-sticks/FallingSticksConstants.ts +0 -62
  327. package/src/games/falling-sticks/FallingSticksGame.ts +0 -220
  328. package/src/games/falling-sticks/FallingSticksRules.ts +0 -145
  329. package/src/games/falling-sticks/FallingSticksScene.ts +0 -245
  330. package/src/games/find-different-number/FindDifferentNumber.tsx +0 -74
  331. package/src/games/find-different-number/FindDifferentNumberConstants.ts +0 -74
  332. package/src/games/find-different-number/FindDifferentNumberGame.ts +0 -174
  333. package/src/games/find-different-number/FindDifferentNumberRules.ts +0 -43
  334. package/src/games/find-different-number/FindDifferentNumberScene.ts +0 -193
  335. package/src/games/flappy-bird/FlappyBird.tsx +0 -73
  336. package/src/games/flappy-bird/FlappyBirdConstants.ts +0 -95
  337. package/src/games/flappy-bird/FlappyBirdGame.ts +0 -375
  338. package/src/games/flappy-bird/FlappyBirdScene.ts +0 -630
  339. package/src/games/fruit-merger/FruitMerger.tsx +0 -73
  340. package/src/games/fruit-merger/FruitMergerConstants.ts +0 -102
  341. package/src/games/fruit-merger/FruitMergerGame.ts +0 -285
  342. package/src/games/fruit-merger/FruitMergerRules.ts +0 -286
  343. package/src/games/fruit-merger/FruitMergerScene.ts +0 -498
  344. package/src/games/fruit-ninja/FruitNinja.tsx +0 -129
  345. package/src/games/fruit-ninja/FruitNinjaConstants.ts +0 -107
  346. package/src/games/fruit-ninja/FruitNinjaGame.ts +0 -391
  347. package/src/games/fruit-ninja/FruitNinjaScene.ts +0 -319
  348. package/src/games/fruit-ninja/FruitNinjaWorld.ts +0 -17
  349. package/src/games/game-2048/Game2048.tsx +0 -84
  350. package/src/games/game-2048/Game2048Constants.ts +0 -68
  351. package/src/games/game-2048/Game2048Game.ts +0 -181
  352. package/src/games/game-2048/Game2048Rules.ts +0 -101
  353. package/src/games/game-2048/Game2048Scene.ts +0 -206
  354. package/src/games/knife-hit/KnifeHit.tsx +0 -78
  355. package/src/games/knife-hit/KnifeHitConstants.ts +0 -89
  356. package/src/games/knife-hit/KnifeHitGame.ts +0 -264
  357. package/src/games/knife-hit/KnifeHitScene.ts +0 -360
  358. package/src/games/ludo-king/LudoKing.tsx +0 -86
  359. package/src/games/ludo-king/LudoKingConstants.ts +0 -212
  360. package/src/games/ludo-king/LudoKingGame.ts +0 -326
  361. package/src/games/ludo-king/LudoKingRules.ts +0 -143
  362. package/src/games/ludo-king/LudoKingScene.ts +0 -397
  363. package/src/games/maze-runner/MazeRunner.tsx +0 -88
  364. package/src/games/maze-runner/MazeRunnerConstants.ts +0 -65
  365. package/src/games/maze-runner/MazeRunnerGame.ts +0 -176
  366. package/src/games/maze-runner/MazeRunnerRules.ts +0 -161
  367. package/src/games/maze-runner/MazeRunnerScene.ts +0 -245
  368. package/src/games/memory-match/MemoryMatch.tsx +0 -77
  369. package/src/games/memory-match/MemoryMatchConstants.ts +0 -105
  370. package/src/games/memory-match/MemoryMatchGame.ts +0 -222
  371. package/src/games/memory-match/MemoryMatchRules.ts +0 -38
  372. package/src/games/memory-match/MemoryMatchScene.ts +0 -268
  373. package/src/games/mine-sweeper/MineSweeper.tsx +0 -77
  374. package/src/games/mine-sweeper/MineSweeperConstants.ts +0 -94
  375. package/src/games/mine-sweeper/MineSweeperGame.ts +0 -234
  376. package/src/games/mine-sweeper/MineSweeperRules.ts +0 -67
  377. package/src/games/mine-sweeper/MineSweeperScene.ts +0 -262
  378. package/src/games/mob-control/MobControl.tsx +0 -73
  379. package/src/games/mob-control/MobControlConstants.ts +0 -106
  380. package/src/games/mob-control/MobControlGame.ts +0 -176
  381. package/src/games/mob-control/MobControlMeshes.ts +0 -85
  382. package/src/games/mob-control/MobControlRenderer.ts +0 -108
  383. package/src/games/mob-control/MobControlRules.ts +0 -522
  384. package/src/games/mob-control/MobControlScene.ts +0 -399
  385. package/src/games/number-search/NumberSearch.tsx +0 -18
  386. package/src/games/number-search/NumberSearchNumbers.ts +0 -623
  387. package/src/games/nuts-and-bolts/NutsAndBolts.tsx +0 -85
  388. package/src/games/nuts-and-bolts/NutsAndBoltsConstants.ts +0 -75
  389. package/src/games/nuts-and-bolts/NutsAndBoltsGame.ts +0 -298
  390. package/src/games/nuts-and-bolts/NutsAndBoltsRules.ts +0 -474
  391. package/src/games/nuts-and-bolts/NutsAndBoltsScene.ts +0 -498
  392. package/src/games/pac-man/PacMan.tsx +0 -86
  393. package/src/games/pac-man/PacManConstants.ts +0 -169
  394. package/src/games/pac-man/PacManGame.ts +0 -406
  395. package/src/games/pac-man/PacManRules.ts +0 -255
  396. package/src/games/pac-man/PacManScene.ts +0 -387
  397. package/src/games/paper-io/PaperIo.tsx +0 -91
  398. package/src/games/paper-io/PaperIoConstants.ts +0 -86
  399. package/src/games/paper-io/PaperIoGame.ts +0 -193
  400. package/src/games/paper-io/PaperIoMeshes.ts +0 -233
  401. package/src/games/paper-io/PaperIoRules.ts +0 -315
  402. package/src/games/paper-io/PaperIoScene.ts +0 -310
  403. package/src/games/penguin-run/PenguinMeshes.ts +0 -269
  404. package/src/games/penguin-run/PenguinModel.ts +0 -712
  405. package/src/games/penguin-run/PenguinRun.tsx +0 -77
  406. package/src/games/penguin-run/PenguinRunConstants.ts +0 -69
  407. package/src/games/penguin-run/PenguinRunGame.ts +0 -406
  408. package/src/games/penguin-run/PenguinRunScene.ts +0 -949
  409. package/src/games/perfect-circle/PerfectCircle.tsx +0 -74
  410. package/src/games/perfect-circle/PerfectCircleConstants.ts +0 -52
  411. package/src/games/perfect-circle/PerfectCircleGame.ts +0 -153
  412. package/src/games/perfect-circle/PerfectCircleRules.ts +0 -111
  413. package/src/games/perfect-circle/PerfectCircleScene.ts +0 -176
  414. package/src/games/pipe-connect/PipeConnect.tsx +0 -69
  415. package/src/games/pipe-connect/PipeConnectConstants.ts +0 -101
  416. package/src/games/pipe-connect/PipeConnectGame.ts +0 -179
  417. package/src/games/pipe-connect/PipeConnectRules.ts +0 -326
  418. package/src/games/pipe-connect/PipeConnectScene.ts +0 -271
  419. package/src/games/play-with-tua/PlayWithTua.tsx +0 -123
  420. package/src/games/play-with-tua/PlayWithTuaConstants.ts +0 -70
  421. package/src/games/play-with-tua/PlayWithTuaGame.ts +0 -167
  422. package/src/games/play-with-tua/PlayWithTuaModel.ts +0 -42
  423. package/src/games/play-with-tua/PlayWithTuaScene.ts +0 -36
  424. package/src/games/popit-fidget/PopitFidget.tsx +0 -72
  425. package/src/games/popit-fidget/PopitFidgetConstants.ts +0 -71
  426. package/src/games/popit-fidget/PopitFidgetGame.ts +0 -148
  427. package/src/games/popit-fidget/PopitFidgetScene.ts +0 -242
  428. package/src/games/reversi/Reversi.tsx +0 -94
  429. package/src/games/reversi/ReversiConstants.ts +0 -67
  430. package/src/games/reversi/ReversiGame.ts +0 -266
  431. package/src/games/reversi/ReversiRules.ts +0 -176
  432. package/src/games/reversi/ReversiScene.ts +0 -240
  433. package/src/games/search-grid/SearchGrid.tsx +0 -92
  434. package/src/games/search-grid/SearchGridConstants.ts +0 -178
  435. package/src/games/search-grid/SearchGridGame.ts +0 -209
  436. package/src/games/search-grid/SearchGridScene.ts +0 -301
  437. package/src/games/shared/BackdropCard.tsx +0 -54
  438. package/src/games/shared/EngineBackdrop.ts +0 -300
  439. package/src/games/shared/EngineBlasts.ts +0 -136
  440. package/src/games/shared/EngineBlocks.ts +0 -91
  441. package/src/games/shared/EngineControlText.ts +0 -17
  442. package/src/games/shared/EngineDice.ts +0 -250
  443. package/src/games/shared/EngineFootprint.ts +0 -35
  444. package/src/games/shared/EngineFruits.ts +0 -1435
  445. package/src/games/shared/EngineGameLoader.tsx +0 -88
  446. package/src/games/shared/EngineGameScreen.tsx +0 -325
  447. package/src/games/shared/EngineGameWidth.ts +0 -3
  448. package/src/games/shared/EngineGameWidth.web.ts +0 -3
  449. package/src/games/shared/EngineGlyphs.ts +0 -178
  450. package/src/games/shared/EngineHud.ts +0 -815
  451. package/src/games/shared/EngineLoading.ts +0 -477
  452. package/src/games/shared/EngineMeadow.ts +0 -725
  453. package/src/games/shared/EngineMeshCache.ts +0 -15
  454. package/src/games/shared/EngineMeshes.ts +0 -10
  455. package/src/games/shared/EngineRacingChase.ts +0 -21
  456. package/src/games/shared/EngineRacingHandling.ts +0 -48
  457. package/src/games/shared/EngineReadyContext.ts +0 -4
  458. package/src/games/shared/EngineTilt.ts +0 -44
  459. package/src/games/shared/EngineTouchSurface.tsx +0 -103
  460. package/src/games/shared/EngineUtils.ts +0 -52
  461. package/src/games/shared/GameActivity.ts +0 -13
  462. package/src/games/shared/GameLoading.tsx +0 -202
  463. package/src/games/shared/GameLoadingTransition.tsx +0 -61
  464. package/src/games/shared/ProceduralCacheVersion.ts +0 -2
  465. package/src/games/shared/useEngineGame.ts +0 -240
  466. package/src/games/shared/useGameResource.ts +0 -21
  467. package/src/games/shared/useLiveState.ts +0 -58
  468. package/src/games/sliding-numbers/SlidingNumbers.tsx +0 -71
  469. package/src/games/sliding-numbers/SlidingNumbersConstants.ts +0 -65
  470. package/src/games/sliding-numbers/SlidingNumbersGame.ts +0 -192
  471. package/src/games/sliding-numbers/SlidingNumbersRules.ts +0 -79
  472. package/src/games/sliding-numbers/SlidingNumbersScene.ts +0 -193
  473. package/src/games/snake-3d/Snake3D.tsx +0 -76
  474. package/src/games/snake-3d/Snake3DConstants.ts +0 -61
  475. package/src/games/snake-3d/Snake3DGame.ts +0 -192
  476. package/src/games/snake-3d/Snake3DMotion.ts +0 -22
  477. package/src/games/snake-3d/Snake3DRules.ts +0 -116
  478. package/src/games/snake-3d/Snake3DScene.ts +0 -322
  479. package/src/games/snakes-and-ladders/SnakesAndLadders.tsx +0 -87
  480. package/src/games/snakes-and-ladders/SnakesAndLaddersConstants.ts +0 -136
  481. package/src/games/snakes-and-ladders/SnakesAndLaddersGame.ts +0 -310
  482. package/src/games/snakes-and-ladders/SnakesAndLaddersScene.ts +0 -515
  483. package/src/games/space-fighter/SpaceFighter.tsx +0 -74
  484. package/src/games/space-fighter/SpaceFighterConstants.ts +0 -86
  485. package/src/games/space-fighter/SpaceFighterGame.ts +0 -292
  486. package/src/games/space-fighter/SpaceFighterScene.ts +0 -550
  487. package/src/games/spider-solitaire/SpiderSolitaire.tsx +0 -80
  488. package/src/games/spider-solitaire/SpiderSolitaireConstants.ts +0 -107
  489. package/src/games/spider-solitaire/SpiderSolitaireGame.ts +0 -387
  490. package/src/games/spider-solitaire/SpiderSolitaireRules.ts +0 -123
  491. package/src/games/spider-solitaire/SpiderSolitaireScene.ts +0 -352
  492. package/src/games/stack-tower/StackTower.tsx +0 -76
  493. package/src/games/stack-tower/StackTowerConstants.ts +0 -74
  494. package/src/games/stack-tower/StackTowerGame.ts +0 -236
  495. package/src/games/stack-tower/StackTowerScene.ts +0 -186
  496. package/src/games/sudoku/Sudoku.tsx +0 -73
  497. package/src/games/sudoku/SudokuConstants.ts +0 -127
  498. package/src/games/sudoku/SudokuGame.ts +0 -250
  499. package/src/games/sudoku/SudokuRules.ts +0 -125
  500. package/src/games/sudoku/SudokuScene.ts +0 -304
  501. package/src/games/tangram/Tangram.tsx +0 -79
  502. package/src/games/tangram/TangramConstants.ts +0 -64
  503. package/src/games/tangram/TangramGame.ts +0 -356
  504. package/src/games/tangram/TangramRules.ts +0 -409
  505. package/src/games/tangram/TangramScene.ts +0 -203
  506. package/src/games/tank-1990/Tank1990.tsx +0 -78
  507. package/src/games/tank-1990/Tank1990Constants.ts +0 -81
  508. package/src/games/tank-1990/Tank1990Game.ts +0 -331
  509. package/src/games/tank-1990/Tank1990Rules.ts +0 -390
  510. package/src/games/tank-1990/Tank1990Scene.ts +0 -434
  511. package/src/games/tic-tac-toe/TicTacToe.tsx +0 -98
  512. package/src/games/tic-tac-toe/TicTacToeConstants.ts +0 -69
  513. package/src/games/tic-tac-toe/TicTacToeGame.ts +0 -200
  514. package/src/games/tic-tac-toe/TicTacToeRules.ts +0 -103
  515. package/src/games/tic-tac-toe/TicTacToeScene.ts +0 -245
  516. package/src/games/tile-home/TileHome.tsx +0 -92
  517. package/src/games/tile-home/TileHomeConstants.ts +0 -139
  518. package/src/games/tile-home/TileHomeGame.ts +0 -435
  519. package/src/games/tile-home/TileHomeScene.ts +0 -154
  520. package/src/games/treasure-hunt/TreasureHunt.tsx +0 -206
  521. package/src/games/treasure-hunt/TreasureHuntConstants.ts +0 -266
  522. package/src/games/treasure-hunt/TreasureHuntControls.ts +0 -280
  523. package/src/games/treasure-hunt/TreasureHuntGame.ts +0 -402
  524. package/src/games/treasure-hunt/TreasureHuntMeshes.ts +0 -422
  525. package/src/games/treasure-hunt/TreasureHuntModel.ts +0 -506
  526. package/src/games/treasure-hunt/TreasureHuntRules.ts +0 -1210
  527. package/src/games/treasure-hunt/TreasureHuntScene.ts +0 -586
  528. package/src/games/whack-a-mole/WhackAMole.tsx +0 -79
  529. package/src/games/whack-a-mole/WhackAMoleConstants.ts +0 -94
  530. package/src/games/whack-a-mole/WhackAMoleGame.ts +0 -233
  531. package/src/games/whack-a-mole/WhackAMoleScene.ts +0 -349
  532. package/src/games/word-search/WordSearch.tsx +0 -18
  533. package/src/games/word-search/WordSearchWords.ts +0 -1642
  534. package/src/helpers/GamePatternData.ts +0 -120
  535. package/src/helpers/GameSettingsModal.tsx +0 -384
  536. package/src/helpers/GameTheme.tsx +0 -37
  537. package/src/helpers/IconPaths.ts +0 -6
  538. package/src/helpers/index.ts +0 -2
  539. package/src/index.tsx +0 -60
  540. package/src/services/GameAssetLoader.ts +0 -111
  541. package/src/services/GameAssets.ts +0 -149
  542. package/src/services/GameLoaders.ts +0 -93
  543. package/src/services/GamesConstants.ts +0 -193
  544. package/src/services/GamesMetadata.ts +0 -711
  545. package/src/services/GamesService.ts +0 -116
  546. package/src/services/HapticsService.ts +0 -48
  547. package/src/services/ScoringService.ts +0 -19
  548. package/src/services/SfxSources.ts +0 -81
  549. package/src/services/SoundsService.ts +0 -582
  550. package/src/services/ThemeService.ts +0 -281
  551. package/src/services/UtilsService.ts +0 -134
  552. package/src/services/index.ts +0 -6
@@ -1,557 +0,0 @@
1
- // Bike Racing's rules, with no React: build a run with `createGame`, then `start` it and `tick` it every
2
- // frame. Traffic, crashes, scoring, the autoplay bot and the camera. The screen listens through the
3
- // `on…` hooks. Built as Car Racing is (games/car-racing), on its track and roadside.
4
- import { audio, type Camera, effects, type Entity, haptics, type Vec3, type Voice, World } from '@nayan-ui/engine';
5
- import { playBankSound } from '../../services/SoundsService';
6
- import {
7
- buildHorizon,
8
- buildRoad,
9
- burn,
10
- burning,
11
- clamp,
12
- explode,
13
- type Fire,
14
- forwardOf,
15
- newSample,
16
- orient,
17
- pick,
18
- placeAt,
19
- placeSegment,
20
- rand,
21
- recycleRoad,
22
- rightOf,
23
- setHorizonNight,
24
- spawnProps,
25
- spawnRaceMarkers,
26
- Track
27
- } from '../car-racing/CarRacingScene';
28
- import { frontHit, overlapAcross } from '../shared/EngineFootprint';
29
- import type { HudFeedback } from '../shared/EngineHud';
30
- import { createChase, updateChase } from '../shared/EngineRacingChase';
31
- import { sideImpactSpeed, smoothSteeringPose, stepSteering } from '../shared/EngineRacingHandling';
32
- import { BIKE_FOOTPRINT } from './BikeMeshes';
33
- import {
34
- type Assets,
35
- AUTOPLAY,
36
- CAMERA_FOV,
37
- CRASH_SLOWDOWN,
38
- EDGE,
39
- FINISH_CLEAR,
40
- getRacingSounds,
41
- INVULNERABLE,
42
- LANES,
43
- LATERAL_SPEED,
44
- LEAN,
45
- LIVES,
46
- MAX_LEAN,
47
- NEAR_MISS_GAP,
48
- PAINTS,
49
- PLAYER_PAINT,
50
- POINTS_PER_BIKE_PASSED,
51
- ROAD_HALF,
52
- SPAWN_AHEAD,
53
- START_SPEED,
54
- STEER_RESPONSE,
55
- TRACK_LENGTH,
56
- TRAFFIC_SPEED
57
- } from './BikeRacingConstants';
58
- import { leanBike, setBikeNight, spawnBike } from './BikeRacingScene';
59
-
60
- export type Phase = 'ready' | 'playing' | 'over';
61
-
62
- const WHEELIE = 0.38; // radians: the nose comes up as the run starts
63
- const WHEELIE_TIME = 1.1; // seconds
64
-
65
- // Reused per frame, so the game loop doesn't allocate.
66
- const tmp: [number, number, number] = [0, 0, 0];
67
- const driveRotation: [number, number, number, number] = [0, 0, 0, 1];
68
- const at: [number, number, number] = [0, 0, 0];
69
- const sample = newSample();
70
- const look = newSample();
71
-
72
- export function createGame(a: Assets, night: boolean) {
73
- const world = new World(2600);
74
- const camera: Camera = { eye: [5, 2.5, 5], target: [0, 0.6, 0], fov: CAMERA_FOV };
75
- const segments = buildRoad(world, a);
76
- const horizon = buildHorizon(world, night);
77
- const player = spawnBike(world, a, PLAYER_PAINT, [0, a.bike.size[1] / 2, 0], night);
78
- world.listener = player.root;
79
-
80
- const g = {
81
- world,
82
- night,
83
- track: new Track(),
84
- chase: createChase(),
85
- assets: a,
86
- camera,
87
- player,
88
- horizon,
89
- segments,
90
- traffic: [] as Bike[],
91
- /** Wrecks on fire. */
92
- burning: [] as Fire[],
93
- phase: 'ready' as Phase,
94
- time: 0,
95
- s: 0,
96
- d: 0,
97
- target: 0, // where the finger wants the bike across the road
98
- dragX: 0, // the finger's last dx, so each move steers by its own distance
99
- speed: 0,
100
- lateral: 0,
101
- steeringGoal: 0,
102
- steeringPose: { yaw: 0, roll: 0 },
103
- spawnTimer: 0.5,
104
- invulnerable: 0,
105
- scrape: 0,
106
- orbit: 0,
107
- /** Seconds left of the start's wheelie, and of the wobble after a crash. */
108
- wheelie: 0,
109
- wobble: 0,
110
- /** Score, lives and the countdown live in the engine (Rust), advanced by world.update. */
111
- get score() {
112
- return world.scoreboard.score;
113
- },
114
- get lives() {
115
- return world.scoreboard.lives;
116
- },
117
- /** Metres left to the finish gate. */
118
- left: TRACK_LENGTH,
119
- shake: 0,
120
- engine: null as Voice | null,
121
- audible: true,
122
- // UI hooks, set by the screen.
123
- onPhase: (_p: Phase) => {},
124
- onScore: (_s: number) => {},
125
- onLives: (_l: number) => {},
126
- onDistance: (_metres: number) => {},
127
- hudFeedback: {} as HudFeedback
128
- };
129
- for (const seg of segments) {
130
- placeSegment(g, seg);
131
- spawnProps(g, seg);
132
- }
133
- world.scoreboard.reset(LIVES);
134
- spawnRaceMarkers(world, g.track, 0, TRACK_LENGTH, a.font);
135
- return g;
136
- }
137
- export type Game = ReturnType<typeof createGame>;
138
-
139
- const ENGINE = { volume: 0.3, loop: true, pitch: 1.45 }; // a bike's engine revs higher than the car's
140
-
141
- export function start(g: Game) {
142
- if (g.world.isDisposed || g.phase !== 'ready') return;
143
- g.phase = 'playing';
144
- g.speed = START_SPEED * 0.55;
145
- g.wheelie = WHEELIE_TIME;
146
- // Fill the road ahead, so the first bikes arrive within seconds.
147
- for (let ahead = 45; ahead < Math.min(SPAWN_AHEAD, TRACK_LENGTH - FINISH_CLEAR); ahead += rand(16, 24)) spawnTraffic(g, ahead);
148
- g.engine = g.audible ? getRacingSounds().play('engine', ENGINE) : null;
149
- // Sounds load alongside the scene; if they're still decoding, the engine starts once they're in.
150
- if (!g.engine) {
151
- getRacingSounds().ready.then(() => {
152
- if (!g.world.isDisposed && g.audible && g.phase === 'playing' && !g.engine) g.engine = getRacingSounds().play('engine', ENGINE);
153
- });
154
- }
155
- g.onPhase('playing');
156
- playBankSound(getRacingSounds(), 'nitro', { volume: 0.6, pitch: 1.2 });
157
- haptics.impact(0.6, 0.4);
158
- }
159
-
160
- /** Mirrors the shared screen's audible state without letting an engine loop leak to another screen. */
161
- export function setAudible(g: Game, enabled: boolean) {
162
- g.audible = enabled;
163
- if (!enabled) {
164
- audio.stop(g.engine);
165
- g.engine = null;
166
- return;
167
- }
168
- if (g.phase !== 'playing' || g.engine || g.world.isDisposed) return;
169
- const resume = () => {
170
- if (!g.world.isDisposed && g.audible && g.phase === 'playing' && !g.engine) g.engine = getRacingSounds().play('engine', ENGINE);
171
- };
172
- resume();
173
- if (!g.engine) void getRacingSounds().ready.then(resume);
174
- }
175
-
176
- /** Change the scene in place when the host theme changes. */
177
- export function setNight(g: Game, night: boolean) {
178
- if (g.world.isDisposed || g.night === night) return;
179
- g.night = night;
180
- setHorizonNight(g.world, g.horizon, night);
181
- setBikeNight(g.world, g.player, night);
182
- for (const bike of g.traffic) setBikeNight(g.world, bike, night);
183
- for (const segment of g.segments) for (const lamp of segment.lights) g.world.set(lamp.entity, { color: night ? lamp.night : lamp.day });
184
- }
185
-
186
- /** Steers toward the finger: `dx` is the drag's distance so far, `metresPerPoint` how far that moves the bike. */
187
- export function steer(g: Game, phase: 'start' | 'move' | 'end', dx: number, metresPerPoint: number) {
188
- if (g.phase !== 'playing') return;
189
- if (phase === 'start') g.dragX = 0;
190
- if (phase === 'end') return;
191
- g.target = clamp(g.target + (dx - g.dragX) * metresPerPoint, -EDGE - 0.6, EDGE + 0.6);
192
- g.dragX = dx;
193
- }
194
-
195
- /** Stops the run's sounds and frees its world (the screen unmounting). */
196
- export function dispose(g: Game) {
197
- audio.stop(g.engine);
198
- g.world.dispose();
199
- }
200
-
201
- /** Present the integrated pose once; only independent wrecks use native velocity. */
202
- function drive(g: Game, root: Entity, s: number, d: number, h: number, yaw = 0) {
203
- const t = g.track.sample(s, sample);
204
- placeAt(t, d, h, at);
205
- g.world.set(root, { position: at, velocity: [0, 0, 0], rotation: orient(t.heading, t.pitch, yaw, 0, driveRotation) });
206
- }
207
-
208
- /** Running into a bike: it's thrown down the road, burning, and a life is lost. */
209
- function crash(g: Game, bike: Bike, damagePlayer = true) {
210
- bike.crashed = true;
211
- bike.passed = true; // no points for a bike you hit
212
- const t = g.track.sample(bike.s, sample);
213
- const right = rightOf(t.heading);
214
- const side = Math.sign(bike.d - g.d) || (Math.random() < 0.5 ? -1 : 1);
215
- const size = g.assets.bike.size;
216
- g.world.set(bike.root, {
217
- physics: { type: 'dynamic', size: [0.6, size[1] + 0.4, size[2] * 0.95], layer: 8, mask: 4 | 8, bounce: 0.3, friction: 0.5, density: 0.3 },
218
- spin: [rand(-4, 4), rand(-6, 6), -side * rand(4, 8)],
219
- impact: { sound: getRacingSounds().get('bump'), minSpeed: 2, maxSpeed: 14, volume: 0.7, haptic: 0.3 },
220
- lifetime: 3.4
221
- });
222
- // Thrown on ahead at about the player's new speed, tumbling and sliding along in view, burning.
223
- g.speed = damagePlayer ? Math.max(START_SPEED * 0.55, g.speed * CRASH_SLOWDOWN) : g.speed * 0.9;
224
- const ahead = g.speed * 1.1;
225
- const a = g.track.sample(bike.s, sample);
226
- const ax = a.x;
227
- const az = a.z;
228
- const b = g.track.sample(bike.s + 1, sample);
229
- const len = Math.hypot(b.x - ax, b.z - az) || 1;
230
- const along: Vec3 = [(b.x - ax) / len, 0, (b.z - az) / len];
231
- g.world.set(bike.root, { velocity: [along[0] * ahead + right[0] * side * 4, 4.5, along[2] * ahead + right[2] * side * 4] });
232
- const p = g.world.position(bike.root);
233
- if (p) explode(g.world, p);
234
- g.burning.push(burning(bike.root, g.time + 3));
235
-
236
- g.shake = 0.45;
237
- g.wobble = 0.9;
238
- if (damagePlayer) g.onLives(g.world.scoreboard.addLives(-1));
239
- g.hudFeedback.flash = true;
240
- playBankSound(getRacingSounds(), 'hit', { volume: 1 });
241
- haptics.impact(1, 0.8);
242
- if (g.lives <= 0) {
243
- g.burning.push(burning(g.player.root, Infinity));
244
- end(g);
245
- return;
246
- }
247
- g.invulnerable = INVULNERABLE; // a moment's grace, so one pile-up doesn't cost two lives
248
- }
249
-
250
- /**
251
- * A sideswipe: no life lost. The other bike is shoved sideways (leaning away as it slides), the player
252
- * bounces back a little with a wobble, and the two are pushed apart so the contact doesn't repeat.
253
- */
254
- function sideswipe(g: Game, bike: Bike, overlap: number) {
255
- const trafficLateral = Math.cos(bike.phase) * bike.weave * bike.weaveSpeed + bike.vshove;
256
- if (sideImpactSpeed(g.lateral, trafficLateral, bike.d - g.d) >= 2.5) {
257
- bike.bumped = true;
258
- g.lateral *= 0.55;
259
- crash(g, bike, false);
260
- return;
261
- }
262
- const away = Math.sign(bike.d - g.d) || 1;
263
- bike.shove += away * overlap * 0.7;
264
- g.d -= away * overlap * 0.3;
265
- bike.vshove = away * (3 + Math.abs(g.lateral) * 0.7);
266
- g.lateral = -away * Math.abs(g.lateral) * 0.3;
267
- bike.bumped = true;
268
- g.speed *= 0.98;
269
- g.wobble = Math.max(g.wobble, 0.35);
270
- g.shake = Math.max(g.shake, 0.12);
271
- if (bike.bumpCooldown > 0) return;
272
- bike.bumpCooldown = 0.3;
273
- const t = g.track.sample((bike.s + g.s) / 2, sample);
274
- placeAt(t, (bike.d + g.d) / 2, 0.5, at);
275
- effects.sparks(g.world, {
276
- position: [at[0], at[1], at[2]],
277
- count: 12,
278
- speed: 6,
279
- size: 0.06,
280
- lifetime: 0.35,
281
- gravity: -9.81,
282
- colors: [
283
- [1, 0.9, 0.4],
284
- [1, 0.65, 0.2]
285
- ]
286
- });
287
- playBankSound(getRacingSounds(), 'bump', { volume: 0.85 });
288
- haptics.impact(0.55, 0.7);
289
- }
290
-
291
- function end(g: Game) {
292
- if (g.phase !== 'playing') return;
293
- g.world.scoreboard.stop();
294
- g.phase = 'over';
295
- audio.stop(g.engine);
296
- g.engine = null;
297
- if (g.lives > 0) {
298
- playBankSound(getRacingSounds(), 'win', { volume: 0.8 });
299
- haptics.notify('success');
300
- } else {
301
- playBankSound(getRacingSounds(), 'die', { volume: 0.8 });
302
- haptics.notify('error');
303
- }
304
- g.onPhase('over');
305
- }
306
-
307
- export function tick(g: Game, dt: number) {
308
- if (g.world.isDisposed) return;
309
- dt = Math.max(0, Math.min(dt, 0.05));
310
- g.time += dt;
311
- const playing = g.phase === 'playing';
312
-
313
- if (playing) {
314
- // One cruising speed for the whole race: the launch and crash recoveries ease back up to it
315
- g.speed += (START_SPEED - g.speed) * (1 - Math.exp(-dt * 1.4));
316
- g.invulnerable = Math.max(0, g.invulnerable - dt);
317
- g.spawnTimer -= dt;
318
- if (g.spawnTimer <= 0) {
319
- g.spawnTimer = Math.max(0.35, 0.9 - (g.speed - START_SPEED) * 0.018) * rand(0.8, 1.2);
320
- spawnTraffic(g);
321
- }
322
- if (AUTOPLAY) autopilot(g);
323
- } else if (g.phase === 'over') {
324
- g.speed = Math.max(0, g.speed - 25 * dt); // roll to a stop
325
- }
326
-
327
- // Steering: slide toward the finger, scraping along the rail at the edges.
328
- const goal = clamp(g.target, -EDGE - 0.6, EDGE + 0.6);
329
- stepSteering(g, playing ? goal : g.d, dt, LATERAL_SPEED, STEER_RESPONSE, playing);
330
- g.scrape -= dt;
331
- if (Math.abs(g.d) > EDGE) {
332
- g.d = Math.sign(g.d) * EDGE;
333
- if (Math.sign(g.lateral) === Math.sign(g.d)) g.lateral = 0;
334
- if (playing && Math.abs(goal) > EDGE + 0.2 && g.scrape <= 0) {
335
- g.scrape = 0.06;
336
- g.speed *= 0.985;
337
- const t = g.track.sample(g.s + 0.8, sample);
338
- placeAt(t, Math.sign(g.d) * (ROAD_HALF + 0.9), 0.5, at);
339
- effects.sparks(g.world, {
340
- position: [at[0], at[1], at[2]],
341
- count: 6,
342
- speed: 6,
343
- size: 0.07,
344
- lifetime: 0.35,
345
- gravity: -9.81,
346
- colors: [
347
- [1, 0.85, 0.3],
348
- [1, 0.55, 0.1]
349
- ],
350
- flash: false
351
- });
352
- haptics.impact(0.25, 1);
353
- }
354
- }
355
-
356
- g.s += g.speed * dt;
357
- // The distance left to the finish gate; crossing it wins
358
- if (g.phase === 'playing') {
359
- const left = Math.max(0, Math.ceil(TRACK_LENGTH - g.s));
360
- if (left !== g.left) {
361
- g.left = left;
362
- g.onDistance(left);
363
- }
364
- if (g.s >= TRACK_LENGTH) end(g);
365
- }
366
- const size = g.assets.bike.size;
367
- smoothSteeringPose(g.steeringPose, g.lateral, g.speed, dt);
368
- drive(g, g.player.root, g.s, g.d, size[1] / 2, g.steeringPose.yaw);
369
- // The bike leans into the turn (and wobbles after a crash); the start pulls a wheelie
370
- g.wheelie = Math.max(0, g.wheelie - dt);
371
- g.wobble = Math.max(0, g.wobble - dt);
372
- const wheelie = playing && g.wheelie > 0 ? WHEELIE * Math.sin((g.wheelie / WHEELIE_TIME) * Math.PI) : 0;
373
- const wobble = g.wobble > 0 ? Math.sin(g.time * 30) * 0.18 * g.wobble : 0;
374
- leanBike(g.world, g.player.lean, -size[1] / 2, clamp(g.lateral * LEAN, -MAX_LEAN, MAX_LEAN) + wobble, wheelie);
375
-
376
- // Traffic rides along its lane; scored once behind the player, gone once far behind.
377
- for (let i = g.traffic.length - 1; i >= 0; i--) {
378
- const bike = g.traffic[i]!;
379
- if (bike.crashed) {
380
- if (!g.world.has(bike.root)) g.traffic.splice(i, 1); // its lifetime ended
381
- continue;
382
- }
383
- // A gentle weave within its lane, leaning with it
384
- bike.phase += dt * bike.weaveSpeed;
385
- // A shove from a sideswipe slides it out of its line, fading; the rails bounce it back.
386
- bike.bumpCooldown -= dt;
387
- bike.shove += bike.vshove * dt;
388
- bike.vshove *= Math.exp(-dt * 2.5);
389
- const vd = Math.cos(bike.phase) * bike.weave * bike.weaveSpeed + bike.vshove;
390
- bike.s += TRAFFIC_SPEED * dt;
391
- let d = bike.lane + Math.sin(bike.phase) * bike.weave + bike.shove;
392
- if (Math.abs(d) > EDGE) {
393
- bike.shove -= d - Math.sign(d) * EDGE;
394
- bike.vshove = -bike.vshove * 0.3;
395
- d = Math.sign(d) * EDGE;
396
- }
397
- bike.d = d;
398
- drive(g, bike.root, bike.s, d, size[1] / 2, Math.atan2(vd, TRAFFIC_SPEED) * 0.7);
399
- leanBike(g.world, bike.lean, -size[1] / 2, clamp(vd * LEAN * 2, -0.45, 0.45));
400
- const ds = bike.s - g.s;
401
- const reach = BIKE_FOOTPRINT.length;
402
- const gap = Math.abs(bike.d - g.d);
403
- if (Math.abs(ds) < reach) bike.closest = Math.min(bike.closest, gap);
404
- // Touching is the bikes' and riders' outlines overlapping, not their lanes. How they met says what
405
- // happens: front wheel into the other's tail (still apart lengthways a moment ago) is a crash;
406
- // already alongside, a sideswipe that shoves the other bike away.
407
- const depth = overlapAcross(BIKE_FOOTPRINT, BIKE_FOOTPRINT, ds, gap);
408
- if (g.phase === 'playing' && depth > 0) {
409
- if (!bike.touching && frontHit(BIKE_FOOTPRINT, BIKE_FOOTPRINT, bike.wasAhead, ds, 0.35)) bike.headOn = true;
410
- bike.touching = true;
411
- if (!bike.headOn) {
412
- sideswipe(g, bike, depth);
413
- } else if (g.invulnerable <= 0) {
414
- crash(g, bike);
415
- continue;
416
- }
417
- } else {
418
- bike.touching = false;
419
- bike.headOn = false;
420
- }
421
- bike.wasAhead = ds;
422
- if (!bike.passed && g.phase === 'playing' && ds < -reach) {
423
- bike.passed = true;
424
- g.onScore(g.world.scoreboard.add(POINTS_PER_BIKE_PASSED));
425
- playBankSound(getRacingSounds(), 'point', { volume: 0.5 });
426
- haptics.impact(0.25, 0.9);
427
- if (bike.closest < NEAR_MISS_GAP && !bike.bumped) g.hudFeedback.message = 'NEAR MISS!';
428
- }
429
- if (ds < -30) {
430
- g.world.despawn(bike.root);
431
- g.traffic.splice(i, 1);
432
- }
433
- }
434
-
435
- burn(g.world, g.camera, g.burning, g.time, dt);
436
- g.world.update(dt);
437
- recycleRoad(g, g.segments, g.s);
438
- followCamera(g, dt);
439
- }
440
-
441
- /** Camera: orbiting the bike on the start screen, then low behind the rider, looking down the road. */
442
- function followCamera(g: Game, dt: number) {
443
- const drawn = g.world.worldPosition(g.player.root, tmp);
444
- if (!drawn) return;
445
- const t = g.track.sample(g.s, look);
446
- const fwd = forwardOf(t.heading);
447
- if (g.phase === 'ready') {
448
- g.orbit += dt * 0.35;
449
- const angle = g.orbit + 0.9;
450
- updateChase(g.chase, g.camera, drawn, [Math.sin(angle) * 5, 1.6, Math.cos(angle) * 5], [0, 0.35, 0], dt);
451
- } else {
452
- updateChase(
453
- g.chase,
454
- g.camera,
455
- drawn,
456
- [-fwd[0] * 5.4, 1.9 + Math.max(0, -t.pitch) * 3, -fwd[2] * 5.4],
457
- [fwd[0] * 12, 0.6 + Math.tan(t.pitch) * 12, fwd[2] * 12],
458
- dt
459
- );
460
- }
461
- g.camera.fov = CAMERA_FOV;
462
- g.shake *= Math.exp(-dt * 6);
463
- g.world.set(g.horizon, { position: [drawn[0], 0, drawn[2]] });
464
- }
465
-
466
- // ── Traffic ───────────────────────────────────────────────────────────
467
-
468
- export type Bike = {
469
- root: Entity;
470
- lean: Entity;
471
- lights: Entity[];
472
- s: number;
473
- d: number;
474
- /** Its lane's centre, and which lane (0..2). */
475
- lane: number;
476
- laneIndex: number;
477
- /** A gentle weave about the lane's centre. */
478
- weave: number;
479
- weaveSpeed: number;
480
- phase: number;
481
- /** How far a sideswipe has shoved it out of its line, and how fast it's still sliding. */
482
- shove: number;
483
- vshove: number;
484
- passed: boolean;
485
- crashed: boolean;
486
- /** It was sideswiped (no near-miss bonus for it). */
487
- bumped: boolean;
488
- /** Seconds until another sideswipe makes a sound again. */
489
- bumpCooldown: number;
490
- /** Closest it came beside the player, for near misses. */
491
- closest: number;
492
- /** How far ahead of the player it was last frame, and whether it's touching (and met nose to tail). */
493
- wasAhead: number;
494
- touching: boolean;
495
- headOn: boolean;
496
- };
497
-
498
- const spawnSample = newSample();
499
- const spawnAt: [number, number, number] = [0, 0, 0];
500
-
501
- /** Traffic ahead, in a lane that doesn't close the road: bikes close together always leave a lane open. */
502
- export function spawnTraffic(g: Game, ahead = SPAWN_AHEAD) {
503
- const s = g.s + ahead;
504
- if (s > TRACK_LENGTH - FINISH_CLEAR) return; // the run-in to the finish stays clear
505
- const window = 12 + g.speed * 0.32;
506
- const blocked = new Set<number>();
507
- for (const bike of g.traffic) if (!bike.crashed && Math.abs(bike.s - s) < window) blocked.add(bike.laneIndex);
508
- const open = [0, 1, 2].filter((l) => !blocked.has(l));
509
- if (open.length <= 1) return;
510
- const laneIndex = pick(open);
511
- const lane = LANES[laneIndex]!;
512
- const t = g.track.sample(s, spawnSample);
513
- placeAt(t, lane, g.assets.bike.size[1] / 2, spawnAt);
514
- const { root, lean, lights } = spawnBike(g.world, g.assets, pick(PAINTS), [spawnAt[0], spawnAt[1], spawnAt[2]], g.night);
515
- g.world.set(root, { rotation: orient(t.heading, t.pitch) });
516
- g.traffic.push({
517
- root,
518
- lean,
519
- lights,
520
- s,
521
- d: lane,
522
- lane,
523
- laneIndex,
524
- weave: rand(0.1, 0.35),
525
- weaveSpeed: rand(0.6, 1.2),
526
- phase: rand(0, Math.PI * 2),
527
- shove: 0,
528
- vshove: 0,
529
- passed: false,
530
- crashed: false,
531
- bumped: false,
532
- bumpCooldown: 0,
533
- closest: Infinity,
534
- wasAhead: ahead,
535
- touching: false,
536
- headOn: false
537
- });
538
- }
539
-
540
- /** Demo bot: head for the lane whose next bike is furthest away. */
541
- export function autopilot(g: Game) {
542
- const nearest = [Infinity, Infinity, Infinity];
543
- for (const bike of g.traffic) {
544
- if (bike.crashed) continue;
545
- const ahead = bike.s - g.s;
546
- if (ahead > -4) nearest[bike.laneIndex] = Math.min(nearest[bike.laneIndex]!, ahead);
547
- }
548
- let current = 0;
549
- for (let l = 1; l < 3; l++) if (Math.abs(LANES[l]! - g.d) < Math.abs(LANES[current]! - g.d)) current = l;
550
- let lane = current;
551
- if (nearest[current]! < 40) {
552
- for (const l of [current - 1, current + 1]) {
553
- if (l >= 0 && l < 3 && nearest[l]! > nearest[lane]! + 6) lane = l;
554
- }
555
- }
556
- g.target = LANES[lane]!;
557
- }
@@ -1,119 +0,0 @@
1
- // What Bike Racing draws besides Car Racing's road, scenery, horizon and fire (shared from
2
- // games/car-racing): the sport bikes, each with its rider tucked down over the tank in a racing
3
- // crouch, leaning into the turns.
4
- import {
5
- type Color,
6
- type Entity,
7
- type GeometryPart,
8
- merge,
9
- type Model,
10
- type MutableQuat,
11
- quat,
12
- shapeGeometry,
13
- tube,
14
- type Vec3,
15
- type World
16
- } from '@nayan-ui/engine';
17
- import { cacheGameAsset, createGameMesh as createShape } from '../shared/EngineMeshes';
18
- import { type Assets, SUIT, SUIT_TRIM, VISOR } from './BikeRacingConstants';
19
-
20
- let riderModel: Model | undefined;
21
-
22
- /** The rider, in the bike's frame (y up, nose toward -z, wheels on y = 0): one mesh, its suit, gloves and boots. */
23
- function riderMesh(): Model {
24
- return cacheGameAsset('bike-racing/BikeRacingScene:riderMesh', () => riderMeshUncached());
25
- }
26
-
27
- function riderMeshUncached(): Model {
28
- if (riderModel) return riderModel;
29
- const limb = (a: Vec3, b: Vec3, r0: number, r1: number, color: Color): GeometryPart => ({
30
- geometry: tube([a, b], { radius: (t) => r0 + (r1 - r0) * t, sides: 12, smoothness: 2, caps: true }),
31
- color
32
- });
33
- const ball = (at: Vec3, scale: Vec3 | number, color: Color): GeometryPart => ({ geometry: shapeGeometry('sphere'), position: at, scale, color });
34
- const parts: GeometryPart[] = [
35
- // Torso, tucked flat over the tank (rounded at the hips and shoulders), and the neck
36
- limb([0, 0.86, 0.26], [0, 1.05, -0.12], 0.16, 0.14, SUIT),
37
- ball([0, 0.86, 0.26], [0.3, 0.26, 0.28], SUIT),
38
- ball([0, 1.04, -0.11], [0.32, 0.24, 0.24], SUIT),
39
- limb([0, 1.07, -0.15], [0, 1.1, -0.21], 0.06, 0.06, SUIT),
40
- // A stripe down the back
41
- limb([0, 0.98, 0.2], [0, 1.17, -0.08], 0.035, 0.03, SUIT_TRIM)
42
- ];
43
- for (const s of [-1, 1]) {
44
- // Arms out to the clip-ons, gloves on the grips
45
- parts.push(ball([s * 0.18, 1.04, -0.12], 0.13, SUIT));
46
- parts.push(limb([s * 0.18, 1.04, -0.12], [s * 0.29, 0.93, -0.3], 0.06, 0.055, SUIT));
47
- parts.push(ball([s * 0.29, 0.93, -0.3], 0.11, SUIT));
48
- parts.push(limb([s * 0.29, 0.93, -0.3], [s * 0.32, 0.79, -0.46], 0.055, 0.045, SUIT));
49
- parts.push(ball([s * 0.32, 0.785, -0.465], 0.1, SUIT_TRIM));
50
- // Legs: knees tucked against the tank, boots on the pegs
51
- parts.push(limb([s * 0.12, 0.84, 0.26], [s * 0.25, 0.78, -0.06], 0.085, 0.07, SUIT));
52
- parts.push(ball([s * 0.25, 0.78, -0.06], 0.14, SUIT));
53
- parts.push(limb([s * 0.25, 0.78, -0.06], [s * 0.23, 0.4, 0.1], 0.065, 0.055, SUIT));
54
- parts.push(ball([s * 0.23, 0.38, 0.13], [0.09, 0.08, 0.2], SUIT_TRIM));
55
- }
56
- riderModel = createShape(merge(parts), { center: false, shine: 0.45 });
57
- return riderModel;
58
- }
59
-
60
- /**
61
- * A bike: an invisible root at its middle (the collider's centre once wrecked), a lean pivot where the
62
- * tyres touch the road, and on it the body (painted), tyres, rider and helmet (in the bike's color).
63
- */
64
- export function spawnBike(world: World, a: Assets, paint: Color, position: Vec3, night: boolean) {
65
- const model = a.bike;
66
- const root = world.spawn({ mesh: 'none', position });
67
- const lean = world.spawn({ mesh: 'none', parent: root, position: [0, -model.size[1] / 2, 0] });
68
- const part = (o: Parameters<World['spawn']>[0]) => world.spawn({ parent: lean, pickable: false, ...o });
69
- part({ mesh: model.body, color: paint });
70
- part({ mesh: model.trim });
71
- part({ mesh: model.glass });
72
- part({ mesh: riderMesh() });
73
- // The helmet in the bike's color, its visor smoked
74
- part({ mesh: 'sphere', position: [0, 1.14, -0.29], scale: [0.29, 0.28, 0.32], color: paint });
75
- part({ mesh: 'sphere', position: [0, 1.13, -0.39], scale: [0.24, 0.11, 0.15], color: VISOR });
76
- const bike = { root, lean, lights: [] as Entity[] };
77
- setBikeNight(world, bike, night);
78
- return bike;
79
- }
80
-
81
- /** Repaint lights without rebuilding the bike or disturbing its lean and wheelie. */
82
- export function setBikeNight(world: World, bike: { root: Entity; lean: Entity; lights: Entity[] }, night: boolean) {
83
- for (const light of bike.lights) world.despawn(light);
84
- bike.lights.length = 0;
85
- if (!night || !world.has(bike.root)) return;
86
- bike.lights.push(
87
- world.spawn({ mesh: 'sphere', parent: bike.lean, pickable: false, position: [0, 0.71, -0.93], scale: [0.24, 0.05, 0.05], color: [2, 1.95, 1.7] }),
88
- world.spawn({ mesh: 'cube', parent: bike.lean, pickable: false, position: [0, 0.895, 0.985], scale: [0.09, 0.03, 0.02], color: [2, 0.16, 0.1] })
89
- );
90
- }
91
-
92
- const REAR_CONTACT = 0.73; // where the rear tyre meets the road (z), the pivot of a wheelie
93
-
94
- const leanRotation: MutableQuat = [0, 0, 0, 1];
95
- const rollRotation: MutableQuat = [0, 0, 0, 1];
96
- const wheelieRotation: MutableQuat = [0, 0, 0, 1];
97
- const leanPosition: [number, number, number] = [0, 0, 0];
98
-
99
- /**
100
- * Leans a bike `roll` radians into a turn (positive to the right) about where its tyres touch the
101
- * road, and lifts its nose `wheelie` radians about the rear tyre. `ground` is the pivot's place under
102
- * the root (half the bike's height down).
103
- */
104
- export function leanBike(world: World, lean: Entity, ground: number, roll: number, wheelie = 0) {
105
- // The wheelie's pitch first, then the roll
106
- quat.multiply(quat.z(-roll, rollRotation), quat.x(wheelie, wheelieRotation), leanRotation);
107
- leanPosition[1] = ground + REAR_CONTACT * Math.sin(wheelie);
108
- leanPosition[2] = REAR_CONTACT * (1 - Math.cos(wheelie));
109
- world.set(lean, {
110
- rotation: leanRotation,
111
- // Keep the rear tyre on the road while the nose comes up
112
- position: leanPosition
113
- });
114
- }
115
-
116
- /** Reusable assets; the game loader advances one builder per frame. */
117
- export function* warmAssets(): Iterable<() => unknown> {
118
- yield riderMesh;
119
- }