@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.
- package/lib/module/games/arrows/Arrows.js +1 -1
- package/lib/module/games/arrows/ArrowsScene.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterScene.js +1 -1
- package/lib/module/games/bike-racing/BikeMeshes.js +1 -1
- package/lib/module/games/bike-racing/BikeRacing.js +1 -1
- package/lib/module/games/bike-racing/BikeRacingConstants.js +1 -1
- package/lib/module/games/bike-racing/BikeRacingScene.js +1 -1
- package/lib/module/games/block-blast/BlockBlast.js +1 -1
- package/lib/module/games/block-blast/BlockBlastScene.js +1 -1
- package/lib/module/games/block-breaker/BlockBreaker.js +1 -1
- package/lib/module/games/block-breaker/BlockBreakerScene.js +1 -1
- package/lib/module/games/bluk/Bluk.js +1 -1
- package/lib/module/games/bluk/BlukScene.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooterScene.js +1 -1
- package/lib/module/games/candy-crush/CandyCrush.js +1 -1
- package/lib/module/games/candy-crush/CandyCrushScene.js +1 -1
- package/lib/module/games/car-racing/CarMeshes.js +1 -1
- package/lib/module/games/car-racing/CarRacing.js +1 -1
- package/lib/module/games/car-racing/CarRacingScene.js +1 -1
- package/lib/module/games/chameleon-run/ChameleonRun.js +1 -1
- package/lib/module/games/chameleon-run/ChameleonRunBackdrop.js +1 -1
- package/lib/module/games/chameleon-run/ChameleonRunMeshes.js +1 -1
- package/lib/module/games/checkers/Checkers.js +1 -1
- package/lib/module/games/checkers/CheckersScene.js +1 -1
- package/lib/module/games/color-switch/ColorSwitch.js +1 -1
- package/lib/module/games/color-switch/ColorSwitchScene.js +1 -1
- package/lib/module/games/colors-sort/ColorsSort.js +1 -1
- package/lib/module/games/colors-sort/ColorsSortScene.js +1 -1
- package/lib/module/games/connect-em-all/ConnectEmAll.js +1 -1
- package/lib/module/games/connect-em-all/ConnectEmAllScene.js +1 -1
- package/lib/module/games/crossy-road/CrossyRoad.js +1 -1
- package/lib/module/games/crossy-road/CrossyRoadMeshes.js +1 -1
- package/lib/module/games/crossy-road/CrossyRoadPerson.js +1 -1
- package/lib/module/games/dino-jump/DinoJump.js +1 -1
- package/lib/module/games/dino-jump/DinoJumpScene.js +1 -1
- package/lib/module/games/dots-and-boxes/DotsAndBoxes.js +1 -1
- package/lib/module/games/dots-and-boxes/DotsAndBoxesScene.js +1 -1
- package/lib/module/games/falling-sticks/FallingSticks.js +1 -1
- package/lib/module/games/falling-sticks/FallingSticksScene.js +1 -1
- package/lib/module/games/find-different-number/FindDifferentNumber.js +1 -1
- package/lib/module/games/find-different-number/FindDifferentNumberScene.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBird.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdScene.js +1 -1
- package/lib/module/games/fruit-merger/FruitMerger.js +1 -1
- package/lib/module/games/fruit-merger/FruitMergerScene.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinja.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaScene.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaWorld.js +1 -1
- package/lib/module/games/game-2048/Game2048.js +1 -1
- package/lib/module/games/game-2048/Game2048Scene.js +1 -1
- package/lib/module/games/knife-hit/KnifeHit.js +1 -1
- package/lib/module/games/knife-hit/KnifeHitScene.js +1 -1
- package/lib/module/games/ludo-king/LudoKing.js +1 -1
- package/lib/module/games/ludo-king/LudoKingScene.js +1 -1
- package/lib/module/games/maze-runner/MazeRunner.js +1 -1
- package/lib/module/games/maze-runner/MazeRunnerScene.js +1 -1
- package/lib/module/games/memory-match/MemoryMatch.js +1 -1
- package/lib/module/games/memory-match/MemoryMatchScene.js +1 -1
- package/lib/module/games/mine-sweeper/MineSweeper.js +1 -1
- package/lib/module/games/mine-sweeper/MineSweeperScene.js +1 -1
- package/lib/module/games/mob-control/MobControl.js +1 -1
- package/lib/module/games/mob-control/MobControlGame.js +1 -1
- package/lib/module/games/mob-control/MobControlMeshes.js +1 -1
- package/lib/module/games/mob-control/MobControlRenderer.js +1 -1
- package/lib/module/games/mob-control/MobControlRules.js +1 -1
- package/lib/module/games/mob-control/MobControlScene.js +1 -1
- package/lib/module/games/nuts-and-bolts/NutsAndBolts.js +1 -1
- package/lib/module/games/nuts-and-bolts/NutsAndBoltsScene.js +1 -1
- package/lib/module/games/pac-man/PacMan.js +1 -1
- package/lib/module/games/pac-man/PacManGame.js +1 -1
- package/lib/module/games/pac-man/PacManScene.js +1 -1
- package/lib/module/games/paper-io/PaperIo.js +1 -1
- package/lib/module/games/paper-io/PaperIoMeshes.js +1 -1
- package/lib/module/games/paper-io/PaperIoScene.js +1 -1
- package/lib/module/games/penguin-run/PenguinMeshes.js +1 -1
- package/lib/module/games/penguin-run/PenguinRun.js +1 -1
- package/lib/module/games/penguin-run/PenguinRunScene.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircle.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircleScene.js +1 -1
- package/lib/module/games/pipe-connect/PipeConnect.js +1 -1
- package/lib/module/games/pipe-connect/PipeConnectScene.js +1 -1
- package/lib/module/games/play-with-tua/PlayWithTua.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidget.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetScene.js +1 -1
- package/lib/module/games/reversi/Reversi.js +1 -1
- package/lib/module/games/reversi/ReversiScene.js +1 -1
- package/lib/module/games/search-grid/SearchGrid.js +1 -1
- package/lib/module/games/search-grid/SearchGridScene.js +1 -1
- package/lib/module/games/shared/BackdropCard.js +1 -1
- package/lib/module/games/shared/EngineBackdrop.js +1 -1
- package/lib/module/games/shared/EngineBlasts.js +1 -1
- package/lib/module/games/shared/EngineBlocks.js +1 -1
- package/lib/module/games/shared/EngineDice.js +1 -1
- package/lib/module/games/shared/EngineFruits.js +1 -1
- package/lib/module/games/shared/EngineGameLoader.js +1 -1
- package/lib/module/games/shared/EngineGameScreen.js +1 -1
- package/lib/module/games/shared/EngineGlyphs.js +1 -1
- package/lib/module/games/shared/EngineHud.js +1 -1
- package/lib/module/games/shared/EngineMeadow.js +1 -1
- package/lib/module/games/shared/EngineTouchSurface.js +1 -1
- package/lib/module/games/shared/GameActivity.js +1 -1
- package/lib/module/games/shared/GameLoading.js +1 -1
- package/lib/module/games/shared/GameLoadingTransition.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersScene.js +1 -1
- package/lib/module/games/snake-3d/Snake3D.js +1 -1
- package/lib/module/games/snake-3d/Snake3DScene.js +1 -1
- package/lib/module/games/snakes-and-ladders/SnakesAndLadders.js +1 -1
- package/lib/module/games/snakes-and-ladders/SnakesAndLaddersScene.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighter.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighterScene.js +1 -1
- package/lib/module/games/spider-solitaire/SpiderSolitaire.js +1 -1
- package/lib/module/games/spider-solitaire/SpiderSolitaireScene.js +1 -1
- package/lib/module/games/stack-tower/StackTower.js +1 -1
- package/lib/module/games/stack-tower/StackTowerScene.js +1 -1
- package/lib/module/games/sudoku/Sudoku.js +1 -1
- package/lib/module/games/sudoku/SudokuScene.js +1 -1
- package/lib/module/games/tangram/Tangram.js +1 -1
- package/lib/module/games/tangram/TangramScene.js +1 -1
- package/lib/module/games/tank-1990/Tank1990.js +1 -1
- package/lib/module/games/tank-1990/Tank1990Scene.js +1 -1
- package/lib/module/games/tic-tac-toe/TicTacToe.js +1 -1
- package/lib/module/games/tic-tac-toe/TicTacToeScene.js +1 -1
- package/lib/module/games/tile-home/TileHome.js +1 -1
- package/lib/module/games/tile-home/TileHomeScene.js +1 -1
- package/lib/module/games/treasure-hunt/TreasureHunt.js +1 -1
- package/lib/module/games/treasure-hunt/TreasureHuntConstants.js +1 -1
- package/lib/module/games/treasure-hunt/TreasureHuntModel.js +1 -1
- package/lib/module/games/treasure-hunt/TreasureHuntScene.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMole.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleScene.js +1 -1
- package/lib/module/helpers/GameSettingsModal.js +1 -1
- package/lib/module/helpers/GameTheme.js +1 -1
- package/package.json +1 -2
- package/src/assets/fonts/Inter-SemiBold.ttf +0 -0
- package/src/assets/models/explorer/explorer.glb +0 -0
- package/src/assets/models/explorer/params.json +0 -51
- package/src/assets/models/explorer/source.json +0 -222
- package/src/assets/models/play-with-tua/play-with-tua.glb +0 -0
- package/src/assets/models/play-with-tua/sources.json +0 -141
- package/src/assets/sfx/balloon_pop.wav +0 -0
- package/src/assets/sfx/blocked.wav +0 -0
- package/src/assets/sfx/boing.wav +0 -0
- package/src/assets/sfx/bonus.wav +0 -0
- package/src/assets/sfx/boom.wav +0 -0
- package/src/assets/sfx/bump.wav +0 -0
- package/src/assets/sfx/cannon.wav +0 -0
- package/src/assets/sfx/capture.wav +0 -0
- package/src/assets/sfx/card_flip.wav +0 -0
- package/src/assets/sfx/card_place.wav +0 -0
- package/src/assets/sfx/catch.wav +0 -0
- package/src/assets/sfx/chime.wav +0 -0
- package/src/assets/sfx/chomp.wav +0 -0
- package/src/assets/sfx/chomp_alt.wav +0 -0
- package/src/assets/sfx/clack.wav +0 -0
- package/src/assets/sfx/clang.wav +0 -0
- package/src/assets/sfx/clash.wav +0 -0
- package/src/assets/sfx/click.wav +0 -0
- package/src/assets/sfx/coin.wav +0 -0
- package/src/assets/sfx/combo.wav +0 -0
- package/src/assets/sfx/crash.wav +0 -0
- package/src/assets/sfx/crunch.wav +0 -0
- package/src/assets/sfx/dance.wav +0 -0
- package/src/assets/sfx/deselect.wav +0 -0
- package/src/assets/sfx/dice_roll.wav +0 -0
- package/src/assets/sfx/die.wav +0 -0
- package/src/assets/sfx/draw.wav +0 -0
- package/src/assets/sfx/drop.wav +0 -0
- package/src/assets/sfx/eat.wav +0 -0
- package/src/assets/sfx/engine.wav +0 -0
- package/src/assets/sfx/error.wav +0 -0
- package/src/assets/sfx/flag.wav +0 -0
- package/src/assets/sfx/flap.wav +0 -0
- package/src/assets/sfx/flip_disc.wav +0 -0
- package/src/assets/sfx/footstep_run.wav +0 -0
- package/src/assets/sfx/footstep_walk.wav +0 -0
- package/src/assets/sfx/game_over.wav +0 -0
- package/src/assets/sfx/gate.wav +0 -0
- package/src/assets/sfx/hit.wav +0 -0
- package/src/assets/sfx/hop.wav +0 -0
- package/src/assets/sfx/hurt.wav +0 -0
- package/src/assets/sfx/invalid.wav +0 -0
- package/src/assets/sfx/jump.wav +0 -0
- package/src/assets/sfx/ladder.wav +0 -0
- package/src/assets/sfx/land.wav +0 -0
- package/src/assets/sfx/laugh.wav +0 -0
- package/src/assets/sfx/lose.wav +0 -0
- package/src/assets/sfx/merge.wav +0 -0
- package/src/assets/sfx/miss.wav +0 -0
- package/src/assets/sfx/nitro.wav +0 -0
- package/src/assets/sfx/pew.wav +0 -0
- package/src/assets/sfx/place.wav +0 -0
- package/src/assets/sfx/pling.wav +0 -0
- package/src/assets/sfx/point.wav +0 -0
- package/src/assets/sfx/pop.wav +0 -0
- package/src/assets/sfx/pop_soft.wav +0 -0
- package/src/assets/sfx/power_up.wav +0 -0
- package/src/assets/sfx/reveal.wav +0 -0
- package/src/assets/sfx/robot.wav +0 -0
- package/src/assets/sfx/rotate.wav +0 -0
- package/src/assets/sfx/run_steps.wav +0 -0
- package/src/assets/sfx/select.wav +0 -0
- package/src/assets/sfx/shuffle.wav +0 -0
- package/src/assets/sfx/six.wav +0 -0
- package/src/assets/sfx/slice.wav +0 -0
- package/src/assets/sfx/slide.wav +0 -0
- package/src/assets/sfx/snake.wav +0 -0
- package/src/assets/sfx/snap.wav +0 -0
- package/src/assets/sfx/splash.wav +0 -0
- package/src/assets/sfx/star.wav +0 -0
- package/src/assets/sfx/start.wav +0 -0
- package/src/assets/sfx/swoosh.wav +0 -0
- package/src/assets/sfx/tap.wav +0 -0
- package/src/assets/sfx/thud.wav +0 -0
- package/src/assets/sfx/thunk.wav +0 -0
- package/src/assets/sfx/tick.wav +0 -0
- package/src/assets/sfx/time_up.wav +0 -0
- package/src/assets/sfx/tock.wav +0 -0
- package/src/assets/sfx/walk_steps.wav +0 -0
- package/src/assets/sfx/warning.wav +0 -0
- package/src/assets/sfx/whack.wav +0 -0
- package/src/assets/sfx/whoosh.wav +0 -0
- package/src/assets/sfx/win.wav +0 -0
- package/src/assets/sfx/zap.wav +0 -0
- package/src/assets/textures/ad_bolt.png +0 -0
- package/src/assets/textures/ad_bubbles.png +0 -0
- package/src/assets/textures/ad_chevrons.png +0 -0
- package/src/assets/textures/asphalt.png +0 -0
- package/src/assets/textures/bark.jpg +0 -0
- package/src/assets/textures/explorer-atlas.png +0 -0
- package/src/assets/textures/facade.png +0 -0
- package/src/assets/textures/grass.png +0 -0
- package/src/assets/textures/leaves.png +0 -0
- package/src/assets/textures/limestone.jpg +0 -0
- package/src/assets/textures/meadow.jpg +0 -0
- package/src/assets/textures/nature-sources.json +0 -87
- package/src/assets/textures/pine.png +0 -0
- package/src/assets/textures/river.jpg +0 -0
- package/src/assets/textures/soft_glow.png +0 -0
- package/src/games/arrows/Arrows.tsx +0 -69
- package/src/games/arrows/ArrowsConstants.ts +0 -107
- package/src/games/arrows/ArrowsGame.ts +0 -735
- package/src/games/arrows/ArrowsScene.ts +0 -395
- package/src/games/balloon-blaster/BalloonBlaster.tsx +0 -75
- package/src/games/balloon-blaster/BalloonBlasterConstants.ts +0 -79
- package/src/games/balloon-blaster/BalloonBlasterGame.ts +0 -287
- package/src/games/balloon-blaster/BalloonBlasterPhysics.ts +0 -95
- package/src/games/balloon-blaster/BalloonBlasterScene.ts +0 -225
- package/src/games/bike-racing/BikeMeshes.ts +0 -273
- package/src/games/bike-racing/BikeRacing.tsx +0 -211
- package/src/games/bike-racing/BikeRacingConstants.ts +0 -103
- package/src/games/bike-racing/BikeRacingGame.ts +0 -557
- package/src/games/bike-racing/BikeRacingScene.ts +0 -119
- package/src/games/block-blast/BlockBlast.tsx +0 -73
- package/src/games/block-blast/BlockBlastConstants.ts +0 -179
- package/src/games/block-blast/BlockBlastGame.ts +0 -471
- package/src/games/block-blast/BlockBlastScene.ts +0 -156
- package/src/games/block-breaker/BlockBreaker.tsx +0 -79
- package/src/games/block-breaker/BlockBreakerConstants.ts +0 -139
- package/src/games/block-breaker/BlockBreakerGame.ts +0 -459
- package/src/games/block-breaker/BlockBreakerScene.ts +0 -257
- package/src/games/bluk/Bluk.tsx +0 -82
- package/src/games/bluk/BlukConstants.ts +0 -121
- package/src/games/bluk/BlukGame.ts +0 -323
- package/src/games/bluk/BlukRules.ts +0 -154
- package/src/games/bluk/BlukScene.ts +0 -514
- package/src/games/bubble-shooter/BubbleShooter.tsx +0 -76
- package/src/games/bubble-shooter/BubbleShooterConstants.ts +0 -103
- package/src/games/bubble-shooter/BubbleShooterGame.ts +0 -459
- package/src/games/bubble-shooter/BubbleShooterScene.ts +0 -158
- package/src/games/candy-crush/CandyCrush.tsx +0 -77
- package/src/games/candy-crush/CandyCrushConstants.ts +0 -94
- package/src/games/candy-crush/CandyCrushGame.ts +0 -477
- package/src/games/candy-crush/CandyCrushScene.ts +0 -209
- package/src/games/car-racing/CarMeshes.ts +0 -440
- package/src/games/car-racing/CarRacing.tsx +0 -211
- package/src/games/car-racing/CarRacingConstants.ts +0 -167
- package/src/games/car-racing/CarRacingFacade.ts +0 -40
- package/src/games/car-racing/CarRacingGame.ts +0 -539
- package/src/games/car-racing/CarRacingScene.ts +0 -1026
- package/src/games/car-racing/CarRacingScenery.ts +0 -265
- package/src/games/chameleon-run/ChameleonRun.tsx +0 -96
- package/src/games/chameleon-run/ChameleonRunBackdrop.ts +0 -186
- package/src/games/chameleon-run/ChameleonRunConstants.ts +0 -47
- package/src/games/chameleon-run/ChameleonRunGame.ts +0 -309
- package/src/games/chameleon-run/ChameleonRunMeshes.ts +0 -305
- package/src/games/chameleon-run/ChameleonRunRules.ts +0 -252
- package/src/games/chameleon-run/ChameleonRunScene.ts +0 -310
- package/src/games/checkers/Checkers.tsx +0 -83
- package/src/games/checkers/CheckersAI.ts +0 -255
- package/src/games/checkers/CheckersConstants.ts +0 -68
- package/src/games/checkers/CheckersGame.ts +0 -322
- package/src/games/checkers/CheckersRules.ts +0 -167
- package/src/games/checkers/CheckersScene.ts +0 -308
- package/src/games/color-switch/ColorSwitch.tsx +0 -75
- package/src/games/color-switch/ColorSwitchConstants.ts +0 -61
- package/src/games/color-switch/ColorSwitchGame.ts +0 -329
- package/src/games/color-switch/ColorSwitchScene.ts +0 -220
- package/src/games/colors-sort/ColorsSort.tsx +0 -82
- package/src/games/colors-sort/ColorsSortConstants.ts +0 -119
- package/src/games/colors-sort/ColorsSortGame.ts +0 -246
- package/src/games/colors-sort/ColorsSortScene.ts +0 -315
- package/src/games/connect-em-all/ConnectEmAll.tsx +0 -70
- package/src/games/connect-em-all/ConnectEmAllConstants.ts +0 -77
- package/src/games/connect-em-all/ConnectEmAllGame.ts +0 -401
- package/src/games/connect-em-all/ConnectEmAllScene.ts +0 -235
- package/src/games/crossy-road/CrossyRoad.tsx +0 -74
- package/src/games/crossy-road/CrossyRoadCamera.ts +0 -59
- package/src/games/crossy-road/CrossyRoadConstants.ts +0 -132
- package/src/games/crossy-road/CrossyRoadGame.ts +0 -293
- package/src/games/crossy-road/CrossyRoadMeshes.ts +0 -195
- package/src/games/crossy-road/CrossyRoadPerson.ts +0 -198
- package/src/games/crossy-road/CrossyRoadRules.ts +0 -99
- package/src/games/crossy-road/CrossyRoadScene.ts +0 -355
- package/src/games/dino-jump/DinoJump.tsx +0 -77
- package/src/games/dino-jump/DinoJumpConstants.ts +0 -80
- package/src/games/dino-jump/DinoJumpGame.ts +0 -344
- package/src/games/dino-jump/DinoJumpScene.ts +0 -686
- package/src/games/dots-and-boxes/DotsAndBoxes.tsx +0 -83
- package/src/games/dots-and-boxes/DotsAndBoxesConstants.ts +0 -77
- package/src/games/dots-and-boxes/DotsAndBoxesGame.ts +0 -271
- package/src/games/dots-and-boxes/DotsAndBoxesScene.ts +0 -249
- package/src/games/falling-sticks/FallingSticks.tsx +0 -72
- package/src/games/falling-sticks/FallingSticksConstants.ts +0 -62
- package/src/games/falling-sticks/FallingSticksGame.ts +0 -220
- package/src/games/falling-sticks/FallingSticksRules.ts +0 -145
- package/src/games/falling-sticks/FallingSticksScene.ts +0 -245
- package/src/games/find-different-number/FindDifferentNumber.tsx +0 -74
- package/src/games/find-different-number/FindDifferentNumberConstants.ts +0 -74
- package/src/games/find-different-number/FindDifferentNumberGame.ts +0 -174
- package/src/games/find-different-number/FindDifferentNumberRules.ts +0 -43
- package/src/games/find-different-number/FindDifferentNumberScene.ts +0 -193
- package/src/games/flappy-bird/FlappyBird.tsx +0 -73
- package/src/games/flappy-bird/FlappyBirdConstants.ts +0 -95
- package/src/games/flappy-bird/FlappyBirdGame.ts +0 -375
- package/src/games/flappy-bird/FlappyBirdScene.ts +0 -630
- package/src/games/fruit-merger/FruitMerger.tsx +0 -73
- package/src/games/fruit-merger/FruitMergerConstants.ts +0 -102
- package/src/games/fruit-merger/FruitMergerGame.ts +0 -285
- package/src/games/fruit-merger/FruitMergerRules.ts +0 -286
- package/src/games/fruit-merger/FruitMergerScene.ts +0 -498
- package/src/games/fruit-ninja/FruitNinja.tsx +0 -129
- package/src/games/fruit-ninja/FruitNinjaConstants.ts +0 -107
- package/src/games/fruit-ninja/FruitNinjaGame.ts +0 -391
- package/src/games/fruit-ninja/FruitNinjaScene.ts +0 -319
- package/src/games/fruit-ninja/FruitNinjaWorld.ts +0 -17
- package/src/games/game-2048/Game2048.tsx +0 -84
- package/src/games/game-2048/Game2048Constants.ts +0 -68
- package/src/games/game-2048/Game2048Game.ts +0 -181
- package/src/games/game-2048/Game2048Rules.ts +0 -101
- package/src/games/game-2048/Game2048Scene.ts +0 -206
- package/src/games/knife-hit/KnifeHit.tsx +0 -78
- package/src/games/knife-hit/KnifeHitConstants.ts +0 -89
- package/src/games/knife-hit/KnifeHitGame.ts +0 -264
- package/src/games/knife-hit/KnifeHitScene.ts +0 -360
- package/src/games/ludo-king/LudoKing.tsx +0 -86
- package/src/games/ludo-king/LudoKingConstants.ts +0 -212
- package/src/games/ludo-king/LudoKingGame.ts +0 -326
- package/src/games/ludo-king/LudoKingRules.ts +0 -143
- package/src/games/ludo-king/LudoKingScene.ts +0 -397
- package/src/games/maze-runner/MazeRunner.tsx +0 -88
- package/src/games/maze-runner/MazeRunnerConstants.ts +0 -65
- package/src/games/maze-runner/MazeRunnerGame.ts +0 -176
- package/src/games/maze-runner/MazeRunnerRules.ts +0 -161
- package/src/games/maze-runner/MazeRunnerScene.ts +0 -245
- package/src/games/memory-match/MemoryMatch.tsx +0 -77
- package/src/games/memory-match/MemoryMatchConstants.ts +0 -105
- package/src/games/memory-match/MemoryMatchGame.ts +0 -222
- package/src/games/memory-match/MemoryMatchRules.ts +0 -38
- package/src/games/memory-match/MemoryMatchScene.ts +0 -268
- package/src/games/mine-sweeper/MineSweeper.tsx +0 -77
- package/src/games/mine-sweeper/MineSweeperConstants.ts +0 -94
- package/src/games/mine-sweeper/MineSweeperGame.ts +0 -234
- package/src/games/mine-sweeper/MineSweeperRules.ts +0 -67
- package/src/games/mine-sweeper/MineSweeperScene.ts +0 -262
- package/src/games/mob-control/MobControl.tsx +0 -73
- package/src/games/mob-control/MobControlConstants.ts +0 -106
- package/src/games/mob-control/MobControlGame.ts +0 -176
- package/src/games/mob-control/MobControlMeshes.ts +0 -85
- package/src/games/mob-control/MobControlRenderer.ts +0 -108
- package/src/games/mob-control/MobControlRules.ts +0 -522
- package/src/games/mob-control/MobControlScene.ts +0 -399
- package/src/games/number-search/NumberSearch.tsx +0 -18
- package/src/games/number-search/NumberSearchNumbers.ts +0 -623
- package/src/games/nuts-and-bolts/NutsAndBolts.tsx +0 -85
- package/src/games/nuts-and-bolts/NutsAndBoltsConstants.ts +0 -75
- package/src/games/nuts-and-bolts/NutsAndBoltsGame.ts +0 -298
- package/src/games/nuts-and-bolts/NutsAndBoltsRules.ts +0 -474
- package/src/games/nuts-and-bolts/NutsAndBoltsScene.ts +0 -498
- package/src/games/pac-man/PacMan.tsx +0 -86
- package/src/games/pac-man/PacManConstants.ts +0 -169
- package/src/games/pac-man/PacManGame.ts +0 -406
- package/src/games/pac-man/PacManRules.ts +0 -255
- package/src/games/pac-man/PacManScene.ts +0 -387
- package/src/games/paper-io/PaperIo.tsx +0 -91
- package/src/games/paper-io/PaperIoConstants.ts +0 -86
- package/src/games/paper-io/PaperIoGame.ts +0 -193
- package/src/games/paper-io/PaperIoMeshes.ts +0 -233
- package/src/games/paper-io/PaperIoRules.ts +0 -315
- package/src/games/paper-io/PaperIoScene.ts +0 -310
- package/src/games/penguin-run/PenguinMeshes.ts +0 -269
- package/src/games/penguin-run/PenguinModel.ts +0 -712
- package/src/games/penguin-run/PenguinRun.tsx +0 -77
- package/src/games/penguin-run/PenguinRunConstants.ts +0 -69
- package/src/games/penguin-run/PenguinRunGame.ts +0 -406
- package/src/games/penguin-run/PenguinRunScene.ts +0 -949
- package/src/games/perfect-circle/PerfectCircle.tsx +0 -74
- package/src/games/perfect-circle/PerfectCircleConstants.ts +0 -52
- package/src/games/perfect-circle/PerfectCircleGame.ts +0 -153
- package/src/games/perfect-circle/PerfectCircleRules.ts +0 -111
- package/src/games/perfect-circle/PerfectCircleScene.ts +0 -176
- package/src/games/pipe-connect/PipeConnect.tsx +0 -69
- package/src/games/pipe-connect/PipeConnectConstants.ts +0 -101
- package/src/games/pipe-connect/PipeConnectGame.ts +0 -179
- package/src/games/pipe-connect/PipeConnectRules.ts +0 -326
- package/src/games/pipe-connect/PipeConnectScene.ts +0 -271
- package/src/games/play-with-tua/PlayWithTua.tsx +0 -123
- package/src/games/play-with-tua/PlayWithTuaConstants.ts +0 -70
- package/src/games/play-with-tua/PlayWithTuaGame.ts +0 -167
- package/src/games/play-with-tua/PlayWithTuaModel.ts +0 -42
- package/src/games/play-with-tua/PlayWithTuaScene.ts +0 -36
- package/src/games/popit-fidget/PopitFidget.tsx +0 -72
- package/src/games/popit-fidget/PopitFidgetConstants.ts +0 -71
- package/src/games/popit-fidget/PopitFidgetGame.ts +0 -148
- package/src/games/popit-fidget/PopitFidgetScene.ts +0 -242
- package/src/games/reversi/Reversi.tsx +0 -94
- package/src/games/reversi/ReversiConstants.ts +0 -67
- package/src/games/reversi/ReversiGame.ts +0 -266
- package/src/games/reversi/ReversiRules.ts +0 -176
- package/src/games/reversi/ReversiScene.ts +0 -240
- package/src/games/search-grid/SearchGrid.tsx +0 -92
- package/src/games/search-grid/SearchGridConstants.ts +0 -178
- package/src/games/search-grid/SearchGridGame.ts +0 -209
- package/src/games/search-grid/SearchGridScene.ts +0 -301
- package/src/games/shared/BackdropCard.tsx +0 -54
- package/src/games/shared/EngineBackdrop.ts +0 -300
- package/src/games/shared/EngineBlasts.ts +0 -136
- package/src/games/shared/EngineBlocks.ts +0 -91
- package/src/games/shared/EngineControlText.ts +0 -17
- package/src/games/shared/EngineDice.ts +0 -250
- package/src/games/shared/EngineFootprint.ts +0 -35
- package/src/games/shared/EngineFruits.ts +0 -1435
- package/src/games/shared/EngineGameLoader.tsx +0 -88
- package/src/games/shared/EngineGameScreen.tsx +0 -325
- package/src/games/shared/EngineGameWidth.ts +0 -3
- package/src/games/shared/EngineGameWidth.web.ts +0 -3
- package/src/games/shared/EngineGlyphs.ts +0 -178
- package/src/games/shared/EngineHud.ts +0 -815
- package/src/games/shared/EngineLoading.ts +0 -477
- package/src/games/shared/EngineMeadow.ts +0 -725
- package/src/games/shared/EngineMeshCache.ts +0 -15
- package/src/games/shared/EngineMeshes.ts +0 -10
- package/src/games/shared/EngineRacingChase.ts +0 -21
- package/src/games/shared/EngineRacingHandling.ts +0 -48
- package/src/games/shared/EngineReadyContext.ts +0 -4
- package/src/games/shared/EngineTilt.ts +0 -44
- package/src/games/shared/EngineTouchSurface.tsx +0 -103
- package/src/games/shared/EngineUtils.ts +0 -52
- package/src/games/shared/GameActivity.ts +0 -13
- package/src/games/shared/GameLoading.tsx +0 -202
- package/src/games/shared/GameLoadingTransition.tsx +0 -61
- package/src/games/shared/ProceduralCacheVersion.ts +0 -2
- package/src/games/shared/useEngineGame.ts +0 -240
- package/src/games/shared/useGameResource.ts +0 -21
- package/src/games/shared/useLiveState.ts +0 -58
- package/src/games/sliding-numbers/SlidingNumbers.tsx +0 -71
- package/src/games/sliding-numbers/SlidingNumbersConstants.ts +0 -65
- package/src/games/sliding-numbers/SlidingNumbersGame.ts +0 -192
- package/src/games/sliding-numbers/SlidingNumbersRules.ts +0 -79
- package/src/games/sliding-numbers/SlidingNumbersScene.ts +0 -193
- package/src/games/snake-3d/Snake3D.tsx +0 -76
- package/src/games/snake-3d/Snake3DConstants.ts +0 -61
- package/src/games/snake-3d/Snake3DGame.ts +0 -192
- package/src/games/snake-3d/Snake3DMotion.ts +0 -22
- package/src/games/snake-3d/Snake3DRules.ts +0 -116
- package/src/games/snake-3d/Snake3DScene.ts +0 -322
- package/src/games/snakes-and-ladders/SnakesAndLadders.tsx +0 -87
- package/src/games/snakes-and-ladders/SnakesAndLaddersConstants.ts +0 -136
- package/src/games/snakes-and-ladders/SnakesAndLaddersGame.ts +0 -310
- package/src/games/snakes-and-ladders/SnakesAndLaddersScene.ts +0 -515
- package/src/games/space-fighter/SpaceFighter.tsx +0 -74
- package/src/games/space-fighter/SpaceFighterConstants.ts +0 -86
- package/src/games/space-fighter/SpaceFighterGame.ts +0 -292
- package/src/games/space-fighter/SpaceFighterScene.ts +0 -550
- package/src/games/spider-solitaire/SpiderSolitaire.tsx +0 -80
- package/src/games/spider-solitaire/SpiderSolitaireConstants.ts +0 -107
- package/src/games/spider-solitaire/SpiderSolitaireGame.ts +0 -387
- package/src/games/spider-solitaire/SpiderSolitaireRules.ts +0 -123
- package/src/games/spider-solitaire/SpiderSolitaireScene.ts +0 -352
- package/src/games/stack-tower/StackTower.tsx +0 -76
- package/src/games/stack-tower/StackTowerConstants.ts +0 -74
- package/src/games/stack-tower/StackTowerGame.ts +0 -236
- package/src/games/stack-tower/StackTowerScene.ts +0 -186
- package/src/games/sudoku/Sudoku.tsx +0 -73
- package/src/games/sudoku/SudokuConstants.ts +0 -127
- package/src/games/sudoku/SudokuGame.ts +0 -250
- package/src/games/sudoku/SudokuRules.ts +0 -125
- package/src/games/sudoku/SudokuScene.ts +0 -304
- package/src/games/tangram/Tangram.tsx +0 -79
- package/src/games/tangram/TangramConstants.ts +0 -64
- package/src/games/tangram/TangramGame.ts +0 -356
- package/src/games/tangram/TangramRules.ts +0 -409
- package/src/games/tangram/TangramScene.ts +0 -203
- package/src/games/tank-1990/Tank1990.tsx +0 -78
- package/src/games/tank-1990/Tank1990Constants.ts +0 -81
- package/src/games/tank-1990/Tank1990Game.ts +0 -331
- package/src/games/tank-1990/Tank1990Rules.ts +0 -390
- package/src/games/tank-1990/Tank1990Scene.ts +0 -434
- package/src/games/tic-tac-toe/TicTacToe.tsx +0 -98
- package/src/games/tic-tac-toe/TicTacToeConstants.ts +0 -69
- package/src/games/tic-tac-toe/TicTacToeGame.ts +0 -200
- package/src/games/tic-tac-toe/TicTacToeRules.ts +0 -103
- package/src/games/tic-tac-toe/TicTacToeScene.ts +0 -245
- package/src/games/tile-home/TileHome.tsx +0 -92
- package/src/games/tile-home/TileHomeConstants.ts +0 -139
- package/src/games/tile-home/TileHomeGame.ts +0 -435
- package/src/games/tile-home/TileHomeScene.ts +0 -154
- package/src/games/treasure-hunt/TreasureHunt.tsx +0 -206
- package/src/games/treasure-hunt/TreasureHuntConstants.ts +0 -266
- package/src/games/treasure-hunt/TreasureHuntControls.ts +0 -280
- package/src/games/treasure-hunt/TreasureHuntGame.ts +0 -402
- package/src/games/treasure-hunt/TreasureHuntMeshes.ts +0 -422
- package/src/games/treasure-hunt/TreasureHuntModel.ts +0 -506
- package/src/games/treasure-hunt/TreasureHuntRules.ts +0 -1210
- package/src/games/treasure-hunt/TreasureHuntScene.ts +0 -586
- package/src/games/whack-a-mole/WhackAMole.tsx +0 -79
- package/src/games/whack-a-mole/WhackAMoleConstants.ts +0 -94
- package/src/games/whack-a-mole/WhackAMoleGame.ts +0 -233
- package/src/games/whack-a-mole/WhackAMoleScene.ts +0 -349
- package/src/games/word-search/WordSearch.tsx +0 -18
- package/src/games/word-search/WordSearchWords.ts +0 -1642
- package/src/helpers/GamePatternData.ts +0 -120
- package/src/helpers/GameSettingsModal.tsx +0 -384
- package/src/helpers/GameTheme.tsx +0 -37
- package/src/helpers/IconPaths.ts +0 -6
- package/src/helpers/index.ts +0 -2
- package/src/index.tsx +0 -60
- package/src/services/GameAssetLoader.ts +0 -111
- package/src/services/GameAssets.ts +0 -149
- package/src/services/GameLoaders.ts +0 -93
- package/src/services/GamesConstants.ts +0 -193
- package/src/services/GamesMetadata.ts +0 -711
- package/src/services/GamesService.ts +0 -116
- package/src/services/HapticsService.ts +0 -48
- package/src/services/ScoringService.ts +0 -19
- package/src/services/SfxSources.ts +0 -81
- package/src/services/SoundsService.ts +0 -582
- package/src/services/ThemeService.ts +0 -281
- package/src/services/UtilsService.ts +0 -134
- package/src/services/index.ts +0 -6
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { type Camera, type DragEvent, World } from '@nayan-ui/engine';
|
|
2
|
-
import type { GameTheme } from '../../services/ThemeService';
|
|
3
|
-
import {
|
|
4
|
-
BASE_SPEED,
|
|
5
|
-
type Config,
|
|
6
|
-
configFor,
|
|
7
|
-
DRAG_THRESHOLD,
|
|
8
|
-
MAX_FRAME_SECONDS,
|
|
9
|
-
MAX_LIVES,
|
|
10
|
-
type RunColor,
|
|
11
|
-
SCORE_SYNC,
|
|
12
|
-
STEP_SECONDS,
|
|
13
|
-
TRACK_LENGTH
|
|
14
|
-
} from './ChameleonRunConstants';
|
|
15
|
-
import { type Failure, jump, newRun, nextPlatform, platformUnder, type Run, step, switchColor } from './ChameleonRunRules';
|
|
16
|
-
import {
|
|
17
|
-
buildScene,
|
|
18
|
-
cheer,
|
|
19
|
-
clearPlatforms,
|
|
20
|
-
collectStar,
|
|
21
|
-
drawScene,
|
|
22
|
-
frameCamera,
|
|
23
|
-
hop,
|
|
24
|
-
land,
|
|
25
|
-
removeScene,
|
|
26
|
-
resetChameleon,
|
|
27
|
-
type Scene,
|
|
28
|
-
setStride,
|
|
29
|
-
stumble,
|
|
30
|
-
tintChameleon,
|
|
31
|
-
tumble
|
|
32
|
-
} from './ChameleonRunScene';
|
|
33
|
-
|
|
34
|
-
export type Phase = 'ready' | 'playing' | 'over';
|
|
35
|
-
export type GameEvent = 'jump' | 'land' | 'star' | 'swap' | 'hurt' | 'fall' | 'win';
|
|
36
|
-
export interface RunHud {
|
|
37
|
-
color: RunColor;
|
|
38
|
-
next: RunColor | null;
|
|
39
|
-
combo: number;
|
|
40
|
-
jumps: number;
|
|
41
|
-
progress: number;
|
|
42
|
-
failure: Failure | null;
|
|
43
|
-
}
|
|
44
|
-
export const INITIAL_HUD: RunHud = { color: 'yellow', next: 'yellow', combo: 0, jumps: 2, progress: 0, failure: null };
|
|
45
|
-
|
|
46
|
-
export function createGame(theme: GameTheme) {
|
|
47
|
-
const camera: Camera = { eye: [0, 3.1, 5.4], target: [0, 1.1, -6], fov: 0.85 };
|
|
48
|
-
return {
|
|
49
|
-
world: new World(1100),
|
|
50
|
-
camera,
|
|
51
|
-
theme,
|
|
52
|
-
config: null as Config | null,
|
|
53
|
-
scene: null as Scene | null,
|
|
54
|
-
run: null as Run | null,
|
|
55
|
-
phase: 'ready' as Phase,
|
|
56
|
-
running: false,
|
|
57
|
-
won: false,
|
|
58
|
-
active: true,
|
|
59
|
-
pending: 0,
|
|
60
|
-
clock: 0,
|
|
61
|
-
lastScoreSync: -1,
|
|
62
|
-
syncedScore: -1,
|
|
63
|
-
shownDistance: 0,
|
|
64
|
-
shownLives: MAX_LIVES,
|
|
65
|
-
finishSpeed: 0,
|
|
66
|
-
coast: 0,
|
|
67
|
-
dragFired: false,
|
|
68
|
-
hudKey: '',
|
|
69
|
-
cameraLift: 0,
|
|
70
|
-
onPhase: (_p: Phase) => {},
|
|
71
|
-
onScore: (_s: number) => {},
|
|
72
|
-
onStars: (_n: number) => {},
|
|
73
|
-
onDistance: (_metres: number) => {},
|
|
74
|
-
onLives: (_lives: number) => {},
|
|
75
|
-
onHud: (_hud: RunHud) => {},
|
|
76
|
-
onEvent: (_e: GameEvent) => {}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export type Game = ReturnType<typeof createGame>;
|
|
80
|
-
|
|
81
|
-
export function setLayout(g: Game, width: number, height: number) {
|
|
82
|
-
if (width <= 0 || height <= 0 || g.world.isDisposed) return;
|
|
83
|
-
if (g.scene && g.config?.width === width && g.config.height === height) return;
|
|
84
|
-
// Camera/layout changes never regenerate the course or reset the result.
|
|
85
|
-
const config = configFor(width, height);
|
|
86
|
-
if (g.scene && g.config?.trackWidth !== config.trackWidth) clearPlatforms(g.world, g.scene);
|
|
87
|
-
g.config = config;
|
|
88
|
-
if (!g.run) g.run = newRun(g.config);
|
|
89
|
-
g.scene ??= buildScene(g.world, g.theme);
|
|
90
|
-
frameCamera(g.camera, g.config, g.cameraLift);
|
|
91
|
-
draw(g);
|
|
92
|
-
if (g.run.color !== 'yellow') tintChameleon(g.world, g.scene, g.run.color, g.run.y);
|
|
93
|
-
setStride(g.world, g.scene, g.running && g.run.onGround);
|
|
94
|
-
syncHud(g);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function setTheme(g: Game, theme: GameTheme) {
|
|
98
|
-
if (theme === g.theme || g.world.isDisposed) return;
|
|
99
|
-
g.theme = theme;
|
|
100
|
-
if (g.scene) removeScene(g.world, g.scene);
|
|
101
|
-
g.scene = null;
|
|
102
|
-
if (g.config) setLayout(g, g.config.width, g.config.height);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function draw(g: Game) {
|
|
106
|
-
if (g.config && g.scene && g.run) drawScene(g.world, g.config, g.scene, g.run);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function syncHud(g: Game) {
|
|
110
|
-
const r = g.run;
|
|
111
|
-
if (!r) return;
|
|
112
|
-
const next = nextPlatform(r)?.color ?? null;
|
|
113
|
-
const progress = Math.min(100, Math.floor((r.distance / TRACK_LENGTH) * 100));
|
|
114
|
-
const hud: RunHud = { color: r.color, next, combo: r.combo, jumps: 2 - r.jumpsUsed, progress, failure: r.failure };
|
|
115
|
-
const key = `${hud.color}/${next}/${hud.combo}/${hud.jumps}/${progress}/${r.failure}`;
|
|
116
|
-
if (key !== g.hudKey) {
|
|
117
|
-
g.hudKey = key;
|
|
118
|
-
g.onHud(hud);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function fresh(g: Game) {
|
|
123
|
-
g.world.cancelTimers();
|
|
124
|
-
g.running = false;
|
|
125
|
-
g.won = false;
|
|
126
|
-
g.pending = 0;
|
|
127
|
-
g.syncedScore = 0;
|
|
128
|
-
g.shownDistance = 0;
|
|
129
|
-
g.shownLives = MAX_LIVES;
|
|
130
|
-
g.finishSpeed = 0;
|
|
131
|
-
g.coast = 0;
|
|
132
|
-
g.dragFired = false;
|
|
133
|
-
g.camera.shake = 0;
|
|
134
|
-
g.cameraLift = 0;
|
|
135
|
-
g.hudKey = '';
|
|
136
|
-
if (!g.config) return;
|
|
137
|
-
g.run = newRun(g.config);
|
|
138
|
-
if (g.scene) {
|
|
139
|
-
clearPlatforms(g.world, g.scene);
|
|
140
|
-
resetChameleon(g.world, g.scene);
|
|
141
|
-
}
|
|
142
|
-
frameCamera(g.camera, g.config);
|
|
143
|
-
draw(g);
|
|
144
|
-
g.onScore(0);
|
|
145
|
-
g.onStars(0);
|
|
146
|
-
g.onDistance(0);
|
|
147
|
-
g.onLives(MAX_LIVES);
|
|
148
|
-
syncHud(g);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export function start(g: Game) {
|
|
152
|
-
if (g.phase !== 'ready' || !g.config || !g.run || g.world.isDisposed) return;
|
|
153
|
-
// Keep the course shown in the preview, as Penguin Run does. Reset/replay builds the next one.
|
|
154
|
-
g.pending = 0;
|
|
155
|
-
g.dragFired = false;
|
|
156
|
-
g.lastScoreSync = g.clock;
|
|
157
|
-
g.running = true;
|
|
158
|
-
g.phase = 'playing';
|
|
159
|
-
if (g.scene) setStride(g.world, g.scene, true);
|
|
160
|
-
g.onPhase('playing');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export function reset(g: Game) {
|
|
164
|
-
if (g.world.isDisposed) return;
|
|
165
|
-
fresh(g);
|
|
166
|
-
g.phase = 'ready';
|
|
167
|
-
g.onPhase('ready');
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export function dispose(g: Game) {
|
|
171
|
-
if (g.scene) removeScene(g.world, g.scene);
|
|
172
|
-
g.scene = null;
|
|
173
|
-
g.world.dispose();
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export function setActive(g: Game, active: boolean) {
|
|
177
|
-
g.active = active;
|
|
178
|
-
g.pending = 0;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function syncScore(g: Game, force = false) {
|
|
182
|
-
if (!g.run || g.run.score === g.syncedScore || (!force && g.clock - g.lastScoreSync < SCORE_SYNC)) return;
|
|
183
|
-
g.lastScoreSync = g.clock;
|
|
184
|
-
g.syncedScore = g.run.score;
|
|
185
|
-
g.onScore(g.run.score);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export function tick(g: Game, dt: number) {
|
|
189
|
-
if (g.world.isDisposed || !g.active || !Number.isFinite(dt) || dt <= 0) return;
|
|
190
|
-
const elapsed = Math.min(dt, MAX_FRAME_SECONDS);
|
|
191
|
-
g.clock += elapsed;
|
|
192
|
-
if (g.running && g.config && g.run && g.scene) {
|
|
193
|
-
g.pending = Math.min(g.pending + elapsed, MAX_FRAME_SECONDS);
|
|
194
|
-
while (g.running && g.pending + 1e-9 >= STEP_SECONDS) {
|
|
195
|
-
g.pending = Math.max(0, g.pending - STEP_SECONDS);
|
|
196
|
-
stepOnce(g);
|
|
197
|
-
}
|
|
198
|
-
draw(g);
|
|
199
|
-
syncScore(g);
|
|
200
|
-
syncHud(g);
|
|
201
|
-
// Follow platform elevations gently, without bouncing with every jump.
|
|
202
|
-
const groundHeight = platformUnder(g.run)?.height ?? g.cameraLift;
|
|
203
|
-
g.cameraLift += (groundHeight - g.cameraLift) * Math.min(1, elapsed * 2);
|
|
204
|
-
frameCamera(g.camera, g.config, Math.max(-0.5, Math.min(1.5, g.cameraLift)));
|
|
205
|
-
}
|
|
206
|
-
if (g.phase === 'over' && g.won && g.scene && g.run && g.finishSpeed > 0) {
|
|
207
|
-
// As in Penguin Run, crossing the line ends scoring while the runner coasts to a stop.
|
|
208
|
-
g.finishSpeed = Math.max(0, g.finishSpeed - 22 * elapsed);
|
|
209
|
-
g.coast += g.finishSpeed * elapsed;
|
|
210
|
-
g.world.set(g.scene.field, { position: [0, 0, g.run.distance + g.coast] });
|
|
211
|
-
}
|
|
212
|
-
g.world.update(elapsed);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function stepOnce(g: Game) {
|
|
216
|
-
const { config: c, run: r, scene: s } = g;
|
|
217
|
-
if (!c || !r || !s) return;
|
|
218
|
-
const ev = step(c, r, STEP_SECONDS);
|
|
219
|
-
const metres = Math.min(TRACK_LENGTH, Math.floor(r.distance));
|
|
220
|
-
if (metres !== g.shownDistance) {
|
|
221
|
-
g.shownDistance = metres;
|
|
222
|
-
g.onDistance(metres);
|
|
223
|
-
}
|
|
224
|
-
if (r.lives !== g.shownLives) {
|
|
225
|
-
g.shownLives = r.lives;
|
|
226
|
-
g.onLives(r.lives);
|
|
227
|
-
}
|
|
228
|
-
if (ev.hurt) {
|
|
229
|
-
tintChameleon(g.world, s, r.color, r.y);
|
|
230
|
-
stumble(g.world, s, r);
|
|
231
|
-
g.camera.shake = 0.22;
|
|
232
|
-
g.onEvent('hurt');
|
|
233
|
-
}
|
|
234
|
-
// Effects use the current course offset, including on multi-step frames.
|
|
235
|
-
g.world.set(s.field, { position: [0, 0, r.distance] });
|
|
236
|
-
if (ev.landed) {
|
|
237
|
-
land(g.world, s, ev.landed);
|
|
238
|
-
g.onEvent('land');
|
|
239
|
-
}
|
|
240
|
-
if (ev.jumped) {
|
|
241
|
-
hop(g.world, s, ev.jumped === 'double');
|
|
242
|
-
g.onEvent('jump');
|
|
243
|
-
}
|
|
244
|
-
if (ev.star) {
|
|
245
|
-
collectStar(g.world, s, ev.star, r.distance);
|
|
246
|
-
g.onStars(r.stars);
|
|
247
|
-
syncScore(g, true);
|
|
248
|
-
g.onEvent('star');
|
|
249
|
-
}
|
|
250
|
-
setStride(g.world, s, r.onGround);
|
|
251
|
-
if (ev.failure || ev.won) {
|
|
252
|
-
g.running = false;
|
|
253
|
-
g.won = ev.won;
|
|
254
|
-
g.finishSpeed = ev.won ? BASE_SPEED : 0;
|
|
255
|
-
syncScore(g, true);
|
|
256
|
-
syncHud(g);
|
|
257
|
-
// Put the final pose in place before its native ending animation begins.
|
|
258
|
-
draw(g);
|
|
259
|
-
if (ev.won) {
|
|
260
|
-
cheer(g.world, s, r);
|
|
261
|
-
g.onEvent('win');
|
|
262
|
-
} else {
|
|
263
|
-
tumble(g.world, s, r);
|
|
264
|
-
g.onEvent('fall');
|
|
265
|
-
}
|
|
266
|
-
// Report immediately; useEngineGame delays only the card, so leaving during the effect
|
|
267
|
-
// cannot turn a completed run into a cancellation.
|
|
268
|
-
g.phase = 'over';
|
|
269
|
-
g.onPhase('over');
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export function tap(g: Game) {
|
|
274
|
-
if (!g.active || !g.running || !g.config || !g.run || !g.scene) return;
|
|
275
|
-
const kind = jump(g.config, g.run);
|
|
276
|
-
if (!kind) return;
|
|
277
|
-
setStride(g.world, g.scene, false);
|
|
278
|
-
hop(g.world, g.scene, kind === 'double');
|
|
279
|
-
syncHud(g);
|
|
280
|
-
g.onEvent('jump');
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export function swap(g: Game) {
|
|
284
|
-
if (!g.active || !g.running || !g.run || !g.scene) return;
|
|
285
|
-
switchColor(g.run);
|
|
286
|
-
tintChameleon(g.world, g.scene, g.run.color, g.run.y);
|
|
287
|
-
syncHud(g);
|
|
288
|
-
g.onEvent('swap');
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/** Penguin Run's mid-stroke response: one jump as soon as an upward swipe passes 18 points. */
|
|
292
|
-
export function steer(g: Game, e: DragEvent) {
|
|
293
|
-
if (e.phase === 'start') {
|
|
294
|
-
g.dragFired = false;
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
if (e.cancelled) {
|
|
298
|
-
g.dragFired = true;
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
if (e.phase !== 'move' || g.dragFired || e.dy > -DRAG_THRESHOLD || Math.abs(e.dy) <= Math.abs(e.dx)) return;
|
|
302
|
-
g.dragFired = true;
|
|
303
|
-
tap(g);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/** A stroke that already jumped must never also switch color when its finger is released. */
|
|
307
|
-
export function changeColor(g: Game) {
|
|
308
|
-
if (!g.dragFired) swap(g);
|
|
309
|
-
}
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
// A veiled-chameleon sculpt: compressed flanks, a raised casque, granular skin, turret eyes,
|
|
2
|
-
// opposed toe groups and a continuous prehensile coil. Skin stays neutral so gameplay can tint it.
|
|
3
|
-
import {
|
|
4
|
-
type Color,
|
|
5
|
-
ellipsoid,
|
|
6
|
-
extrude,
|
|
7
|
-
type Geometry,
|
|
8
|
-
type GeometryPart,
|
|
9
|
-
loft,
|
|
10
|
-
type LoftSection as Section,
|
|
11
|
-
merge,
|
|
12
|
-
type Model,
|
|
13
|
-
Path,
|
|
14
|
-
smoothCurve,
|
|
15
|
-
tube,
|
|
16
|
-
type Vec3
|
|
17
|
-
} from '@nayan-ui/engine';
|
|
18
|
-
import { cacheGameAsset, createGameMesh as createShape } from '../shared/EngineMeshes';
|
|
19
|
-
|
|
20
|
-
const meshes = new Map<string, Model>();
|
|
21
|
-
const cached = (key: string, build: () => Model) => {
|
|
22
|
-
let model = meshes.get(key);
|
|
23
|
-
if (!model) {
|
|
24
|
-
model = cacheGameAsset('chameleon-run/ChameleonRunMeshes:' + key, build);
|
|
25
|
-
meshes.set(key, model);
|
|
26
|
-
}
|
|
27
|
-
return model;
|
|
28
|
-
};
|
|
29
|
-
const clamp = (x: number, lo: number, hi: number) => Math.max(lo, Math.min(hi, x));
|
|
30
|
-
const hash = (x: number, y: number, z: number) => {
|
|
31
|
-
const n = Math.sin(x * 127.1 + y * 311.7 + z * 74.7) * 43758.5453;
|
|
32
|
-
return n - Math.floor(n);
|
|
33
|
-
};
|
|
34
|
-
const normalize = (v: Vec3): Vec3 => {
|
|
35
|
-
const length = Math.hypot(...v) || 1;
|
|
36
|
-
return [v[0] / length, v[1] / length, v[2] / length];
|
|
37
|
-
};
|
|
38
|
-
const cross = (a: Vec3, b: Vec3): Vec3 => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|
|
39
|
-
const ball = (position: Vec3, radii: Vec3, color: Color = [1, 1, 1], around = 20): GeometryPart => ({
|
|
40
|
-
geometry: ellipsoid(radii, color, around),
|
|
41
|
-
position
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
/** Gentle banding and irregular scale color, baked into vertices rather than separate entities. */
|
|
45
|
-
function skin(g: Geometry, bands = false): Geometry {
|
|
46
|
-
const v = g.vertices;
|
|
47
|
-
for (let i = 0; i < v.length; i += 11) {
|
|
48
|
-
const x = v[i]!;
|
|
49
|
-
const y = v[i + 1]!;
|
|
50
|
-
const z = v[i + 2]!;
|
|
51
|
-
const grain = hash(Math.floor(x * 95), Math.floor(y * 95), Math.floor(z * 95));
|
|
52
|
-
const mottling = hash(Math.floor(x * 24), Math.floor(y * 24), Math.floor(z * 24));
|
|
53
|
-
const band = bands ? Math.exp(-(Math.sin((x + 0.08) * 12 + y * 2.5) ** 2) / 0.12) : 0;
|
|
54
|
-
const tone = clamp(0.94 + mottling * 0.06 + (grain - 0.5) * 0.025 - band * 0.15, 0.75, 1);
|
|
55
|
-
v[i + 6] = tone;
|
|
56
|
-
v[i + 7] = tone * 0.985;
|
|
57
|
-
v[i + 8] = tone * 0.94;
|
|
58
|
-
v[i + 9] = 0;
|
|
59
|
-
v[i + 10] = 0;
|
|
60
|
-
}
|
|
61
|
-
return g;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Small raised, six-sided scales catch highlights without a shiny plastic material. */
|
|
65
|
-
function granules(g: Geometry, stride = 4, radius = 0.0065, rise = 0.0012): Geometry {
|
|
66
|
-
const vertices: number[] = [];
|
|
67
|
-
const indices: number[] = [];
|
|
68
|
-
for (let i = 0; i < g.vertices.length; i += 11 * stride) {
|
|
69
|
-
const v = g.vertices;
|
|
70
|
-
const p: Vec3 = [v[i]!, v[i + 1]!, v[i + 2]!];
|
|
71
|
-
const n = normalize([v[i + 3]!, v[i + 4]!, v[i + 5]!]);
|
|
72
|
-
const tangent = normalize(cross(n, Math.abs(n[1]) > 0.9 ? [1, 0, 0] : [0, 1, 0]));
|
|
73
|
-
const bitangent = cross(n, tangent);
|
|
74
|
-
const size = radius * (0.7 + hash(...p) * 0.6);
|
|
75
|
-
const base = vertices.length / 11;
|
|
76
|
-
const color: Vec3 = [v[i + 6]! * 1.025, v[i + 7]! * 1.025, v[i + 8]! * 1.025];
|
|
77
|
-
vertices.push(p[0] + n[0] * rise, p[1] + n[1] * rise, p[2] + n[2] * rise, ...n, ...color, v[i + 9]!, v[i + 10]!);
|
|
78
|
-
for (let j = 0; j < 6; j++) {
|
|
79
|
-
const a = (j * Math.PI) / 3;
|
|
80
|
-
const offset: Vec3 = [0, 1, 2].map((k) => (tangent[k]! * Math.cos(a) + bitangent[k]! * Math.sin(a)) * size) as unknown as Vec3;
|
|
81
|
-
const normal = normalize([n[0] + (offset[0] / size) * 0.22, n[1] + (offset[1] / size) * 0.22, n[2] + (offset[2] / size) * 0.22]);
|
|
82
|
-
vertices.push(p[0] + offset[0], p[1] + offset[1], p[2] + offset[2], ...normal, color[0] * 0.86, color[1] * 0.86, color[2] * 0.86, 0, 0);
|
|
83
|
-
indices.push(base, base + 1 + j, base + 1 + ((j + 1) % 6));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return { vertices: Float32Array.from(vertices), indices: Uint32Array.from(indices) };
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** Loft along +x; the shared loft builder supplies smooth normals and closed ends. */
|
|
90
|
-
function alongBody(sections: readonly Section[]): Geometry {
|
|
91
|
-
const g = loft(sections, { around: 36, smoothness: 4 });
|
|
92
|
-
for (let i = 0; i < g.vertices.length; i += 11) {
|
|
93
|
-
const x = g.vertices[i]!;
|
|
94
|
-
const nx = g.vertices[i + 3]!;
|
|
95
|
-
g.vertices[i] = g.vertices[i + 2]!;
|
|
96
|
-
g.vertices[i + 2] = -x;
|
|
97
|
-
g.vertices[i + 3] = g.vertices[i + 5]!;
|
|
98
|
-
g.vertices[i + 5] = -nx;
|
|
99
|
-
}
|
|
100
|
-
return skin(g, true);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** A small triangular dorsal scale, merged into the body's mesh. */
|
|
104
|
-
function crestTooth(x: number, y: number, size: number): GeometryPart {
|
|
105
|
-
const height = Math.abs(size);
|
|
106
|
-
const g = loft(
|
|
107
|
-
[
|
|
108
|
-
{ z: -0.013, bottom: 0, top: height * 0.15, width: height * 0.46, square: 2 },
|
|
109
|
-
{ z: 0, bottom: 0, top: height, width: height * 0.36, topWidth: 0.001, square: 2 },
|
|
110
|
-
{ z: 0.013, bottom: 0, top: height * 0.15, width: height * 0.46, square: 2 }
|
|
111
|
-
],
|
|
112
|
-
{ around: 10, smoothness: 1, color: [0.66, 0.68, 0.62] }
|
|
113
|
-
);
|
|
114
|
-
return { geometry: g, position: [x, y, 0], rotation: size < 0 ? [0, 0, 1, 0] : [0, 0, 0, 1] };
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/** Facing +x, with the feet at -0.5. Shape and pigment remain readable from the chase camera. */
|
|
118
|
-
export const bodyMesh = () =>
|
|
119
|
-
cached('body-realistic', () => {
|
|
120
|
-
const bodySections: Section[] = [
|
|
121
|
-
{ z: -0.54, bottom: -0.07, top: 0.08, width: 0.035, square: 2 },
|
|
122
|
-
{ z: -0.43, bottom: -0.17, top: 0.2, width: 0.105, square: 2 },
|
|
123
|
-
{ z: -0.22, bottom: -0.25, top: 0.3, width: 0.165, square: 2 },
|
|
124
|
-
{ z: 0.02, bottom: -0.24, top: 0.33, width: 0.175, square: 2 },
|
|
125
|
-
{ z: 0.21, bottom: -0.18, top: 0.27, width: 0.14, square: 2 },
|
|
126
|
-
{ z: 0.36, bottom: -0.1, top: 0.19, width: 0.105, square: 2 },
|
|
127
|
-
{ z: 0.44, bottom: -0.055, top: 0.15, width: 0.08, square: 2 }
|
|
128
|
-
];
|
|
129
|
-
const body = alongBody(bodySections);
|
|
130
|
-
const topAt = smoothCurve(bodySections.map((section) => [section.z, section.top] as const));
|
|
131
|
-
const head = alongBody([
|
|
132
|
-
{ z: 0.29, bottom: -0.02, top: 0.18, width: 0.075, square: 2.2 },
|
|
133
|
-
{ z: 0.36, bottom: -0.065, top: 0.33, width: 0.125, topWidth: 0.035, square: 2.2 },
|
|
134
|
-
{ z: 0.44, bottom: -0.075, top: 0.59, width: 0.14, topWidth: 0.016, square: 2.4 },
|
|
135
|
-
{ z: 0.5, bottom: -0.075, top: 0.65, width: 0.135, topWidth: 0.014, square: 2.4 },
|
|
136
|
-
{ z: 0.56, bottom: -0.07, top: 0.39, width: 0.14, topWidth: 0.055, square: 2.2 },
|
|
137
|
-
{ z: 0.66, bottom: -0.06, top: 0.2, width: 0.125, square: 2 },
|
|
138
|
-
{ z: 0.78, bottom: -0.03, top: 0.13, width: 0.08, square: 2 },
|
|
139
|
-
{ z: 0.835, bottom: 0.005, top: 0.08, width: 0.015, square: 2 }
|
|
140
|
-
]);
|
|
141
|
-
const parts: GeometryPart[] = [
|
|
142
|
-
{ geometry: body },
|
|
143
|
-
{ geometry: granules(body, 3) },
|
|
144
|
-
{ geometry: head },
|
|
145
|
-
{ geometry: granules(head, 3, 0.003, 0.0008) }
|
|
146
|
-
];
|
|
147
|
-
for (let i = 0; i < 17; i++) {
|
|
148
|
-
const x = -0.44 + i * 0.044;
|
|
149
|
-
const top = topAt(x) - 0.014;
|
|
150
|
-
parts.push(crestTooth(x, top, 0.033 + Math.sin((i / 16) * Math.PI) * 0.022));
|
|
151
|
-
}
|
|
152
|
-
return createShape(merge(parts), { center: false, shine: 0.14 });
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
/** Restrained throat folds, a closed jaw seam and tiny nostrils; no smile or cartoon eye whites. */
|
|
156
|
-
export const detailsMesh = () =>
|
|
157
|
-
cached('details-realistic', () => {
|
|
158
|
-
const parts: GeometryPart[] = [
|
|
159
|
-
ball([-0.01, -0.225, 0], [0.31, 0.038, 0.12], [0.58, 0.59, 0.45], 28),
|
|
160
|
-
ball([0.46, -0.06, 0], [0.15, 0.035, 0.075], [0.64, 0.63, 0.49])
|
|
161
|
-
];
|
|
162
|
-
for (const side of [-1, 1]) {
|
|
163
|
-
parts.push({
|
|
164
|
-
geometry: tube(
|
|
165
|
-
[
|
|
166
|
-
[0.4, -0.015, side * 0.123],
|
|
167
|
-
[0.54, -0.016, side * 0.14],
|
|
168
|
-
[0.69, 0.002, side * 0.113],
|
|
169
|
-
[0.815, 0.026, side * 0.045]
|
|
170
|
-
],
|
|
171
|
-
{ radius: 0.0038, sides: 5, smoothness: 3, color: [0.18, 0.2, 0.14] }
|
|
172
|
-
)
|
|
173
|
-
});
|
|
174
|
-
parts.push(ball([0.758, 0.098, side * 0.074], [0.012, 0.008, 0.006], [0.13, 0.16, 0.11], 12));
|
|
175
|
-
// A fine, irregular lateral stripe follows the compressed flank instead of raised spots.
|
|
176
|
-
parts.push({
|
|
177
|
-
geometry: tube(
|
|
178
|
-
[
|
|
179
|
-
[-0.41, -0.045, side * 0.108],
|
|
180
|
-
[-0.22, -0.058, side * 0.163],
|
|
181
|
-
[0.01, -0.045, side * 0.177],
|
|
182
|
-
[0.19, -0.03, side * 0.14],
|
|
183
|
-
[0.31, 0.015, side * 0.113]
|
|
184
|
-
],
|
|
185
|
-
{ radius: (t) => 0.004 + Math.sin(t * Math.PI) * 0.004, sides: 5, smoothness: 3, color: [0.77, 0.76, 0.6] }
|
|
186
|
-
)
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
for (let i = 0; i < 6; i++) parts.push(crestTooth(0.35 + i * 0.047, -0.062, -0.018));
|
|
190
|
-
return createShape(merge(parts), { center: false, shine: 0.12 });
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
/** Scaly turret eyelids with only a small forward-facing opening. Local +z is the gaze direction. */
|
|
194
|
-
export const eyeMesh = () =>
|
|
195
|
-
cached('eye-lid-realistic', () => {
|
|
196
|
-
const lid = skin(ellipsoid([0.086, 0.086, 0.074], undefined, 32));
|
|
197
|
-
const ring: Vec3[] = [];
|
|
198
|
-
for (let i = 0; i <= 24; i++) {
|
|
199
|
-
const a = (i / 24) * Math.PI * 2;
|
|
200
|
-
ring.push([Math.cos(a) * 0.027, Math.sin(a) * 0.027, 0.071]);
|
|
201
|
-
}
|
|
202
|
-
return createShape(
|
|
203
|
-
merge([
|
|
204
|
-
{ geometry: lid },
|
|
205
|
-
{ geometry: granules(lid, 3, 0.0024, 0.0006) },
|
|
206
|
-
{ geometry: tube(ring, { radius: 0.003, sides: 5, smoothness: 1, color: [0.62, 0.65, 0.56] }) }
|
|
207
|
-
]),
|
|
208
|
-
{ center: false, shine: 0.15 }
|
|
209
|
-
);
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
export const eyeDetailsMesh = () =>
|
|
213
|
-
cached('eye-aperture-realistic', () =>
|
|
214
|
-
createShape(
|
|
215
|
-
merge([
|
|
216
|
-
ball([0, 0, 0.074], [0.025, 0.025, 0.006], [0.39, 0.32, 0.15], 24),
|
|
217
|
-
ball([0.002, 0, 0.08], [0.011, 0.011, 0.003], [0.025, 0.035, 0.02], 24),
|
|
218
|
-
ball([0.005, 0.005, 0.083], [0.003, 0.003, 0.001], [1.1, 1.1, 1.05], 12)
|
|
219
|
-
]),
|
|
220
|
-
{ center: false, shine: 0.5 }
|
|
221
|
-
)
|
|
222
|
-
);
|
|
223
|
-
|
|
224
|
-
export const tailMesh = () =>
|
|
225
|
-
cached('tail-realistic', () => {
|
|
226
|
-
const points: Vec3[] = [
|
|
227
|
-
[0, 0, 0],
|
|
228
|
-
[-0.16, -0.015, 0],
|
|
229
|
-
[-0.29, 0.03, 0]
|
|
230
|
-
];
|
|
231
|
-
for (let i = 0; i <= 48; i++) {
|
|
232
|
-
const t = i / 48;
|
|
233
|
-
const a = Math.PI / 2 + t * Math.PI * 2.5;
|
|
234
|
-
const r = 0.26 * (1 - t * 0.83);
|
|
235
|
-
points.push([-0.42 + Math.cos(a) * r, -0.2 + Math.sin(a) * r, 0]);
|
|
236
|
-
}
|
|
237
|
-
const tail = skin(tube(points, { radius: (t) => 0.068 * (1 - t) ** 1.15 + 0.008, sides: 12, smoothness: 2, caps: true }), true);
|
|
238
|
-
return createShape(merge([{ geometry: tail }, { geometry: granules(tail, 10, 0.0025, 0.0007) }]), { center: false, shine: 0.13 });
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
export interface LimbDefinition {
|
|
242
|
-
x: number;
|
|
243
|
-
y: number;
|
|
244
|
-
side: -1 | 1;
|
|
245
|
-
hind: boolean;
|
|
246
|
-
}
|
|
247
|
-
export const LIMBS: readonly LimbDefinition[] = [
|
|
248
|
-
{ x: 0.28, y: -0.1, side: 1, hind: false },
|
|
249
|
-
{ x: 0.28, y: -0.1, side: -1, hind: false },
|
|
250
|
-
{ x: -0.3, y: -0.09, side: 1, hind: true },
|
|
251
|
-
{ x: -0.3, y: -0.09, side: -1, hind: true }
|
|
252
|
-
];
|
|
253
|
-
|
|
254
|
-
export const legMesh = (side: number, hind = false) =>
|
|
255
|
-
cached(`leg-realistic-${side}-${hind}`, () => {
|
|
256
|
-
const elbow: Vec3 = [hind ? 0.12 : -0.1, -0.16, side * 0.16];
|
|
257
|
-
const wrist: Vec3 = [hind ? -0.065 : 0.07, -0.36, side * 0.14];
|
|
258
|
-
const limb = skin(tube([[0, 0, 0], elbow, wrist], { radius: (t) => 0.054 - t * 0.03, sides: 12, smoothness: 5, caps: true }), false);
|
|
259
|
-
const parts: GeometryPart[] = [
|
|
260
|
-
{ geometry: limb },
|
|
261
|
-
{ geometry: granules(limb, 5, 0.0025, 0.0007) },
|
|
262
|
-
ball(elbow, [0.041, 0.046, 0.043], [0.84, 0.85, 0.78]),
|
|
263
|
-
ball([wrist[0], -0.374, wrist[2]], [0.052, 0.023, 0.041], [0.87, 0.88, 0.8])
|
|
264
|
-
];
|
|
265
|
-
// Five toes form two opposed gripping groups; forefeet and hindfeet reverse the 2/3 split.
|
|
266
|
-
for (const group of [-1, 1]) {
|
|
267
|
-
const count = (group === side) !== hind ? 2 : 3;
|
|
268
|
-
for (let i = 0; i < count; i++) {
|
|
269
|
-
const spread = (i - (count - 1) / 2) * 0.019;
|
|
270
|
-
const tip: Vec3 = [wrist[0] + 0.047 + spread, -0.385, wrist[2] + group * 0.048];
|
|
271
|
-
parts.push({
|
|
272
|
-
geometry: tube([[wrist[0], -0.37, wrist[2]], [wrist[0] + 0.025 + spread, -0.372, wrist[2] + group * 0.035], tip], {
|
|
273
|
-
radius: (t) => 0.013 - t * 0.006,
|
|
274
|
-
sides: 6,
|
|
275
|
-
smoothness: 2,
|
|
276
|
-
caps: true,
|
|
277
|
-
color: [0.85, 0.86, 0.77]
|
|
278
|
-
})
|
|
279
|
-
});
|
|
280
|
-
parts.push({
|
|
281
|
-
geometry: tube([tip, [tip[0] + 0.016, -0.399, tip[2] - group * 0.008]], {
|
|
282
|
-
radius: (t) => 0.006 * (1 - t) + 0.001,
|
|
283
|
-
sides: 5,
|
|
284
|
-
smoothness: 1,
|
|
285
|
-
color: [0.3, 0.27, 0.19]
|
|
286
|
-
})
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
return createShape(merge(parts), { center: false, shine: 0.12 });
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
export const starMesh = () =>
|
|
294
|
-
cached('star', () => createShape(extrude(new Path().addStar(0, 0, 0.5, 0.23), { depth: 0.18 }), { fit: 1, shine: 0.85 }));
|
|
295
|
-
|
|
296
|
-
/** Reusable assets; the game loader advances one builder per frame. */
|
|
297
|
-
export function* warmAssets(): Iterable<() => unknown> {
|
|
298
|
-
yield bodyMesh;
|
|
299
|
-
yield detailsMesh;
|
|
300
|
-
yield eyeMesh;
|
|
301
|
-
yield eyeDetailsMesh;
|
|
302
|
-
yield tailMesh;
|
|
303
|
-
yield starMesh;
|
|
304
|
-
for (const side of [-1, 1]) for (const hind of [false, true]) yield () => legMesh(side, hind);
|
|
305
|
-
}
|