@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,686 +0,0 @@
|
|
|
1
|
-
// Everything Dino Jump runs on and into, under its desert sky (EngineMeadow, desert, without its own
|
|
2
|
-
// ground). Screen points (y down) land on the play plane ahead of a low camera, where the original game drew
|
|
3
|
-
// them; the real desert floor meets that plane exactly on the ground line, so the dino and the obstacles
|
|
4
|
-
// stand on the sand. The near desert (the floor, saguaros, barrel cacti, rocks, dry brush, tufts and
|
|
5
|
-
// pebbles) comes in three tiles that scroll past at the dino's running speed, which gives real
|
|
6
|
-
// parallax, and wrap round. The dino, a tyrannosaur-like theropod, is built from shapes; its legs run and its body bobs in the
|
|
7
|
-
// engine's core. Every part is a shared mesh: mesh ids are app-wide and limited.
|
|
8
|
-
import {
|
|
9
|
-
type Color,
|
|
10
|
-
effects,
|
|
11
|
-
type Entity,
|
|
12
|
-
type Geometry,
|
|
13
|
-
lathe,
|
|
14
|
-
merge,
|
|
15
|
-
type Model,
|
|
16
|
-
type Quat,
|
|
17
|
-
quat,
|
|
18
|
-
recolor,
|
|
19
|
-
shapeGeometry,
|
|
20
|
-
type TransformBatch,
|
|
21
|
-
tube,
|
|
22
|
-
type Vec3,
|
|
23
|
-
type World
|
|
24
|
-
} from '@nayan-ui/engine';
|
|
25
|
-
import type { GameTheme } from '../../services/ThemeService';
|
|
26
|
-
import { at, bushMesh, fbm, HAZE, noise, pointSize, random, rockMesh, sceneryTint, tuftMesh, type View3D } from '../shared/EngineMeadow';
|
|
27
|
-
import { cacheGameAsset, createGameMesh as createShape } from '../shared/EngineMeshes';
|
|
28
|
-
import { toColor } from '../shared/EngineUtils';
|
|
29
|
-
import { DINO_HEIGHT, DINO_WIDTH, type Layout, OBSTACLE_SIZE, type ObstacleKind, STRIDE_TIME, TILE } from './DinoJumpConstants';
|
|
30
|
-
|
|
31
|
-
// ── Helpers ───────────────────────────────────────────────────────────
|
|
32
|
-
|
|
33
|
-
const meshes = new Map<string, Model>();
|
|
34
|
-
const cached = (key: string, build: () => Model) => {
|
|
35
|
-
let m = meshes.get(key);
|
|
36
|
-
if (!m) {
|
|
37
|
-
m = cacheGameAsset('dino-jump/DinoJumpScene:' + key, build);
|
|
38
|
-
meshes.set(key, m);
|
|
39
|
-
}
|
|
40
|
-
return m;
|
|
41
|
-
};
|
|
42
|
-
type RGB = [number, number, number];
|
|
43
|
-
const rgb = (css: string): RGB => {
|
|
44
|
-
const [r, g, b] = toColor(css);
|
|
45
|
-
return [r, g, b];
|
|
46
|
-
};
|
|
47
|
-
const mix = (a: RGB, b: RGB, t: number): RGB => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];
|
|
48
|
-
const sphere = () => shapeGeometry('sphere');
|
|
49
|
-
|
|
50
|
-
/** Cactus skin: ribs (`count` round), darker in the grooves. */
|
|
51
|
-
const ribbed = (count: number, depth: number) => ({
|
|
52
|
-
displace: (u: number) => depth * Math.cos(u * Math.PI * 2 * count),
|
|
53
|
-
color: ({ u }: { u: number }): Color => mix(rgb('#2f6b2c'), rgb('#5aa646'), 0.5 + 0.5 * Math.cos(u * Math.PI * 2 * count))
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// ── Cacti and the mushroom (unit boxes, scaled to their collision size) ──
|
|
57
|
-
|
|
58
|
-
/** A small cactus: a stout ribbed column with a stubby arm, one unit wide and tall. */
|
|
59
|
-
const smallCactusMesh = () =>
|
|
60
|
-
cached('dj-cactus-small', () =>
|
|
61
|
-
createShape(
|
|
62
|
-
merge([
|
|
63
|
-
{
|
|
64
|
-
geometry: lathe(
|
|
65
|
-
[
|
|
66
|
-
[0.34, 0],
|
|
67
|
-
[0.36, 0.55],
|
|
68
|
-
[0.33, 0.82],
|
|
69
|
-
[0.22, 0.96],
|
|
70
|
-
[0.001, 1]
|
|
71
|
-
],
|
|
72
|
-
{ segments: 24, ...ribbed(10, 0.025) }
|
|
73
|
-
)
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
geometry: tube(
|
|
77
|
-
[
|
|
78
|
-
[0.25, 0.4, 0],
|
|
79
|
-
[0.42, 0.42, 0],
|
|
80
|
-
[0.45, 0.62, 0]
|
|
81
|
-
],
|
|
82
|
-
{ radius: 0.1, color: rgb('#3f8a38') }
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
]),
|
|
86
|
-
{ center: false, shine: 0.25 }
|
|
87
|
-
)
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
/** A tall saguaro with an arm each side, one unit wide (arm to arm) and tall. */
|
|
91
|
-
const largeCactusMesh = () =>
|
|
92
|
-
cached('dj-cactus-large', () =>
|
|
93
|
-
createShape(
|
|
94
|
-
merge([
|
|
95
|
-
{
|
|
96
|
-
geometry: lathe(
|
|
97
|
-
[
|
|
98
|
-
[0.22, 0],
|
|
99
|
-
[0.24, 0.6],
|
|
100
|
-
[0.22, 0.86],
|
|
101
|
-
[0.15, 0.97],
|
|
102
|
-
[0.001, 1]
|
|
103
|
-
],
|
|
104
|
-
{ segments: 24, ...ribbed(12, 0.018) }
|
|
105
|
-
)
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
geometry: tube(
|
|
109
|
-
[
|
|
110
|
-
[-0.18, 0.36, 0],
|
|
111
|
-
[-0.4, 0.38, 0],
|
|
112
|
-
[-0.42, 0.66, 0]
|
|
113
|
-
],
|
|
114
|
-
{ radius: 0.085, color: rgb('#3f8a38') }
|
|
115
|
-
)
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
geometry: tube(
|
|
119
|
-
[
|
|
120
|
-
[0.18, 0.46, 0],
|
|
121
|
-
[0.38, 0.48, 0],
|
|
122
|
-
[0.4, 0.76, 0]
|
|
123
|
-
],
|
|
124
|
-
{ radius: 0.08, color: rgb('#3f8a38') }
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
]),
|
|
128
|
-
{ center: false, shine: 0.25 }
|
|
129
|
-
)
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
/** The bonus mushroom: a red spotted cap on a cream stem, one unit wide and tall. */
|
|
133
|
-
const mushroomMesh = () =>
|
|
134
|
-
cached('dj-mushroom', () => {
|
|
135
|
-
const spots: { geometry: Geometry; position: Vec3; scale: number; color: RGB }[] = [];
|
|
136
|
-
const rand = random(5);
|
|
137
|
-
for (let i = 0; i < 9; i++) {
|
|
138
|
-
const a = rand() * Math.PI * 2;
|
|
139
|
-
const up = 0.25 + rand() * 0.6; // 0 at the rim, 1 at the crown
|
|
140
|
-
const r = 0.5 * Math.cos(up * 1.2);
|
|
141
|
-
spots.push({
|
|
142
|
-
geometry: sphere(),
|
|
143
|
-
position: [Math.cos(a) * r, 0.5 + up * 0.48, Math.sin(a) * r],
|
|
144
|
-
scale: 0.09 + rand() * 0.05,
|
|
145
|
-
color: [1, 1, 1]
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
return createShape(
|
|
149
|
-
merge([
|
|
150
|
-
{
|
|
151
|
-
geometry: lathe(
|
|
152
|
-
[
|
|
153
|
-
[0.15, 0],
|
|
154
|
-
[0.17, 0.25],
|
|
155
|
-
[0.14, 0.52]
|
|
156
|
-
],
|
|
157
|
-
{ segments: 16, color: rgb('#f3e3c3') }
|
|
158
|
-
)
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
geometry: lathe(
|
|
162
|
-
[
|
|
163
|
-
[0.001, 0.46],
|
|
164
|
-
[0.5, 0.48],
|
|
165
|
-
[0.47, 0.66],
|
|
166
|
-
[0.34, 0.86],
|
|
167
|
-
[0.16, 0.97],
|
|
168
|
-
[0.001, 1]
|
|
169
|
-
],
|
|
170
|
-
{ segments: 24, color: rgb('#e23b33') }
|
|
171
|
-
)
|
|
172
|
-
},
|
|
173
|
-
...spots
|
|
174
|
-
]),
|
|
175
|
-
{ center: false, shine: 0.5 }
|
|
176
|
-
);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
const OBSTACLE_MESH: Record<ObstacleKind, () => Model> = { cactus_small: smallCactusMesh, cactus_large: largeCactusMesh, mushroom: mushroomMesh };
|
|
180
|
-
|
|
181
|
-
/** An obstacle standing on the ground line, its box's left edge at screen x. */
|
|
182
|
-
export function spawnObstacle(world: World, v: View3D, l: Layout, kind: ObstacleKind, x: number, tint: Color): Entity {
|
|
183
|
-
const k = pointSize(v);
|
|
184
|
-
const { width, height } = OBSTACLE_SIZE[kind];
|
|
185
|
-
return world.spawn({
|
|
186
|
-
mesh: OBSTACLE_MESH[kind](),
|
|
187
|
-
position: at(v, x + width / 2, l.groundY),
|
|
188
|
-
scale: [width * k, height * k, width * k * (kind === 'cactus_large' ? 0.6 : 1)],
|
|
189
|
-
rotation: quat.y(kind === 'mushroom' ? 0.5 : 0),
|
|
190
|
-
color: tint,
|
|
191
|
-
pickable: false
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export function placeObstacle(world: World, v: View3D, l: Layout, e: Entity, kind: ObstacleKind, x: number, updates?: TransformBatch) {
|
|
196
|
-
const position = at(v, x + OBSTACLE_SIZE[kind].width / 2, l.groundY);
|
|
197
|
-
if (updates) updates.position(e, position[0], position[1], position[2]);
|
|
198
|
-
else world.set(e, { position });
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// ── The dino ──────────────────────────────────────────────────────────
|
|
202
|
-
|
|
203
|
-
const SKIN_TOP = rgb('#3a4527');
|
|
204
|
-
const SKIN_SIDE = rgb('#6d7a43');
|
|
205
|
-
const SKIN_BELLY = rgb('#cdbf8f');
|
|
206
|
-
const SKIN_STRIPE = rgb('#262b17');
|
|
207
|
-
const CLAW = rgb('#2a2418');
|
|
208
|
-
const TOOTH = rgb('#efe5c8');
|
|
209
|
-
const MOUTH = rgb('#3a1a14');
|
|
210
|
-
const smooth = (a: number, b: number, x: number) => {
|
|
211
|
-
const t = Math.min(1, Math.max(0, (x - a) / (b - a)));
|
|
212
|
-
return t * t * (3 - 2 * t);
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
/** Countershaded, mottled hide: dark olive along the back, pale under the belly; `striped` adds bands across the back. */
|
|
216
|
-
const hide =
|
|
217
|
-
(striped = false) =>
|
|
218
|
-
({ position: p, normal: n }: { position: Vec3; normal: Vec3 }): Color => {
|
|
219
|
-
const up = 0.5 + 0.5 * n[1];
|
|
220
|
-
let c = mix(SKIN_BELLY, SKIN_SIDE, smooth(0.22, 0.5, up));
|
|
221
|
-
c = mix(c, SKIN_TOP, smooth(0.6, 0.95, up));
|
|
222
|
-
if (striped && up > 0.55 && p[0] < 0.14) c = mix(c, SKIN_STRIPE, smooth(0.45, 0.8, Math.sin(p[0] * 46)) * smooth(0.55, 0.8, up) * 0.75);
|
|
223
|
-
const m = 0.86 + 0.28 * noise(p[0] * 22 + 3, p[1] * 22 + p[2] * 11);
|
|
224
|
-
return [c[0] * m, c[1] * m, c[2] * m];
|
|
225
|
-
};
|
|
226
|
-
const skin = (g: Geometry) => recolor(g, hide());
|
|
227
|
-
|
|
228
|
-
/** Linear between [t, value] stops, eased. */
|
|
229
|
-
const taper = (stops: [number, number][]) => (t: number) => {
|
|
230
|
-
for (let i = 0; i + 1 < stops.length; i++) {
|
|
231
|
-
const [a, ra] = stops[i]!;
|
|
232
|
-
const [b, rb] = stops[i + 1]!;
|
|
233
|
-
if (t <= b) return ra + (rb - ra) * smooth(a, b, t);
|
|
234
|
-
}
|
|
235
|
-
return stops[stops.length - 1]![1];
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
/** A claw (or a tooth): a tapering cone `length` long, pointing along +y from its base at the origin. */
|
|
239
|
-
const claw = (length: number, base: number, color: RGB = CLAW) =>
|
|
240
|
-
lathe(
|
|
241
|
-
[
|
|
242
|
-
[base, 0],
|
|
243
|
-
[base * 0.6, length * 0.5],
|
|
244
|
-
[0.001, length]
|
|
245
|
-
],
|
|
246
|
-
{ segments: 8, color }
|
|
247
|
-
);
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* The dino's body, head, arms and tail, one unit tall, facing +x, its near side toward +z: a theropod
|
|
251
|
-
* in the tyrannosaur mould, its spine level from tail tip to hips, a deep chest, an S-curved neck and a
|
|
252
|
-
* long boxy skull with a row of teeth.
|
|
253
|
-
*/
|
|
254
|
-
const dinoMesh = () =>
|
|
255
|
-
cached('dj-dino-rex', () => {
|
|
256
|
-
// Tail tip to the base of the skull, one smooth tapering tube, a little narrower than it is deep
|
|
257
|
-
const spine = tube(
|
|
258
|
-
[
|
|
259
|
-
[-0.54, 0.41, 0],
|
|
260
|
-
[-0.42, 0.44, 0],
|
|
261
|
-
[-0.28, 0.5, 0],
|
|
262
|
-
[-0.12, 0.55, 0],
|
|
263
|
-
[0.03, 0.57, 0],
|
|
264
|
-
[0.14, 0.63, 0],
|
|
265
|
-
[0.21, 0.73, 0],
|
|
266
|
-
[0.26, 0.83, 0]
|
|
267
|
-
],
|
|
268
|
-
{
|
|
269
|
-
radius: taper([
|
|
270
|
-
[0, 0.01],
|
|
271
|
-
[0.16, 0.042],
|
|
272
|
-
[0.33, 0.095],
|
|
273
|
-
[0.5, 0.155],
|
|
274
|
-
[0.62, 0.165],
|
|
275
|
-
[0.76, 0.12],
|
|
276
|
-
[0.88, 0.078],
|
|
277
|
-
[1, 0.072]
|
|
278
|
-
]),
|
|
279
|
-
sides: 24,
|
|
280
|
-
smoothness: 10,
|
|
281
|
-
color: hide(true)
|
|
282
|
-
}
|
|
283
|
-
);
|
|
284
|
-
// Upper jaw: the skull runs on into a long, deep snout
|
|
285
|
-
const snoutR = (t: number) => 0.072 - 0.026 * t;
|
|
286
|
-
const snout = tube(
|
|
287
|
-
[
|
|
288
|
-
[0.29, 0.885, 0],
|
|
289
|
-
[0.38, 0.877, 0],
|
|
290
|
-
[0.475, 0.862, 0]
|
|
291
|
-
],
|
|
292
|
-
{ radius: snoutR, sides: 18, color: hide() }
|
|
293
|
-
);
|
|
294
|
-
const jaw = tube(
|
|
295
|
-
[
|
|
296
|
-
[0.27, 0.84, 0],
|
|
297
|
-
[0.36, 0.818, 0],
|
|
298
|
-
[0.455, 0.8, 0]
|
|
299
|
-
],
|
|
300
|
-
{ radius: (t) => 0.046 - 0.016 * t, sides: 16, color: hide() }
|
|
301
|
-
);
|
|
302
|
-
const teeth: { geometry: Geometry; position: Vec3; rotation: Quat; scale: number }[] = [];
|
|
303
|
-
for (let i = 0; i < 7; i++) {
|
|
304
|
-
const x = 0.335 + i * 0.021;
|
|
305
|
-
const t = (x - 0.29) / 0.185;
|
|
306
|
-
const r = snoutR(t);
|
|
307
|
-
const y = 0.885 - 0.023 * t - r * 0.72;
|
|
308
|
-
for (const side of [1, -1])
|
|
309
|
-
teeth.push({
|
|
310
|
-
geometry: claw(0.026, 0.008, TOOTH),
|
|
311
|
-
position: [x, y, side * r * 0.62],
|
|
312
|
-
rotation: quat.z(Math.PI),
|
|
313
|
-
scale: 1 - Math.abs(i - 2) * 0.08
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
const pair = (part: { geometry: Geometry; position: Vec3; scale: number | Vec3; color?: RGB; rotation?: Quat }) => [
|
|
317
|
-
part,
|
|
318
|
-
{ ...part, position: [part.position[0], part.position[1], -part.position[2]] as Vec3 }
|
|
319
|
-
];
|
|
320
|
-
const arm = (z: number) => ({
|
|
321
|
-
geometry: skin(
|
|
322
|
-
tube(
|
|
323
|
-
[
|
|
324
|
-
[0.15, 0.57, z],
|
|
325
|
-
[0.19, 0.51, z * 1.15],
|
|
326
|
-
[0.235, 0.515, z * 1.15]
|
|
327
|
-
],
|
|
328
|
-
{ radius: (t) => 0.026 - 0.01 * t, sides: 10 }
|
|
329
|
-
)
|
|
330
|
-
)
|
|
331
|
-
});
|
|
332
|
-
const armClaws = (z: number) =>
|
|
333
|
-
[0.012, -0.012].map((dz) => ({ geometry: claw(0.022, 0.006), position: [0.235, 0.512, z * 1.15 + dz] as Vec3, rotation: quat.z(-2.0) }));
|
|
334
|
-
return createShape(
|
|
335
|
-
merge([
|
|
336
|
-
{ geometry: spine, scale: [1, 1, 0.8] },
|
|
337
|
-
// A deep chest and belly hanging under the ribs
|
|
338
|
-
{ geometry: skin(sphere()), position: [0.01, 0.5, 0], scale: [0.36, 0.3, 0.25] },
|
|
339
|
-
// Skull: a broad cranium behind the snout, cheek muscles bulging behind the jaw
|
|
340
|
-
{ geometry: skin(sphere()), position: [0.3, 0.875, 0], scale: [0.2, 0.17, 0.16] },
|
|
341
|
-
{ geometry: snout, scale: [1, 1, 0.82] },
|
|
342
|
-
{ geometry: jaw, scale: [1, 1, 0.78] },
|
|
343
|
-
...teeth,
|
|
344
|
-
...pair({
|
|
345
|
-
geometry: tube(
|
|
346
|
-
[
|
|
347
|
-
[0.28, 0.842, 0.046],
|
|
348
|
-
[0.37, 0.828, 0.042],
|
|
349
|
-
[0.455, 0.818, 0.032]
|
|
350
|
-
],
|
|
351
|
-
{ radius: 0.006, sides: 6, caps: false }
|
|
352
|
-
),
|
|
353
|
-
position: [0, 0, 0],
|
|
354
|
-
scale: 1,
|
|
355
|
-
color: MOUTH
|
|
356
|
-
}),
|
|
357
|
-
// Heavy brow over a small amber eye with a dark slit, a nostril at the snout's tip
|
|
358
|
-
...pair({ geometry: skin(sphere()), position: [0.335, 0.94, 0.05], scale: [0.1, 0.032, 0.045] }),
|
|
359
|
-
...pair({ geometry: sphere(), position: [0.34, 0.91, 0.064], scale: 0.034, color: rgb('#d79a1c') }),
|
|
360
|
-
...pair({ geometry: sphere(), position: [0.345, 0.91, 0.079], scale: [0.009, 0.026, 0.008], color: rgb('#0b0b0b') }),
|
|
361
|
-
...pair({ geometry: sphere(), position: [0.35, 0.918, 0.08], scale: 0.007, color: [1, 1, 1] }),
|
|
362
|
-
...pair({ geometry: sphere(), position: [0.462, 0.88, 0.026], scale: [0.02, 0.012, 0.012], color: rgb('#1d1f12') }),
|
|
363
|
-
// Short two-fingered arms
|
|
364
|
-
arm(0.085),
|
|
365
|
-
arm(-0.085),
|
|
366
|
-
...armClaws(0.085),
|
|
367
|
-
...armClaws(-0.085)
|
|
368
|
-
]),
|
|
369
|
-
{ center: false, shine: 0.18 }
|
|
370
|
-
);
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* A leg, pivoting at the hip (the origin): a heavy drumstick thigh, the knee forward, a slim shin back to
|
|
375
|
-
* a high ankle, then the long foot bones down to three clawed toes on the ground (it walks on its toes).
|
|
376
|
-
*/
|
|
377
|
-
const legMesh = () =>
|
|
378
|
-
cached('dj-leg-rex', () => {
|
|
379
|
-
const toes = [-0.032, 0, 0.032].flatMap((z) => {
|
|
380
|
-
const length = z === 0 ? 0.1 : 0.08;
|
|
381
|
-
const tip: Vec3 = [0.03 + length, -0.443, z * 1.6];
|
|
382
|
-
return [
|
|
383
|
-
{
|
|
384
|
-
geometry: skin(tube([[0.03, -0.438, z * 0.6], [0.03 + length * 0.55, -0.44, z * 1.2], tip], { radius: (t) => 0.021 - 0.009 * t, sides: 8 }))
|
|
385
|
-
},
|
|
386
|
-
{ geometry: claw(0.03, 0.011), position: tip, rotation: quat.z(-1.75) }
|
|
387
|
-
];
|
|
388
|
-
});
|
|
389
|
-
return createShape(
|
|
390
|
-
merge([
|
|
391
|
-
{ geometry: skin(sphere()), position: [0.01, -0.07, 0], scale: [0.25, 0.3, 0.17], rotation: quat.z(-0.25) },
|
|
392
|
-
{
|
|
393
|
-
geometry: skin(
|
|
394
|
-
tube(
|
|
395
|
-
[
|
|
396
|
-
[0.0, -0.1, 0],
|
|
397
|
-
[0.065, -0.2, 0]
|
|
398
|
-
],
|
|
399
|
-
{ radius: (t) => 0.075 - 0.03 * t, sides: 12 }
|
|
400
|
-
)
|
|
401
|
-
)
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
geometry: skin(
|
|
405
|
-
tube(
|
|
406
|
-
[
|
|
407
|
-
[0.065, -0.2, 0],
|
|
408
|
-
[0.02, -0.27, 0],
|
|
409
|
-
[-0.03, -0.33, 0]
|
|
410
|
-
],
|
|
411
|
-
{ radius: (t) => 0.045 - 0.016 * t, sides: 12 }
|
|
412
|
-
)
|
|
413
|
-
)
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
geometry: skin(
|
|
417
|
-
tube(
|
|
418
|
-
[
|
|
419
|
-
[-0.03, -0.33, 0],
|
|
420
|
-
[-0.005, -0.39, 0],
|
|
421
|
-
[0.03, -0.437, 0]
|
|
422
|
-
],
|
|
423
|
-
{ radius: (t) => 0.028 - 0.004 * t, sides: 10 }
|
|
424
|
-
)
|
|
425
|
-
)
|
|
426
|
-
},
|
|
427
|
-
...toes
|
|
428
|
-
]),
|
|
429
|
-
{ center: false, shine: 0.15 }
|
|
430
|
-
);
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
export type DinoView = { root: Entity; body: Entity; near: Entity; far: Entity };
|
|
434
|
-
|
|
435
|
-
const HIP: Vec3 = [-0.06, 0.46, 0];
|
|
436
|
-
const SWING = 0.5;
|
|
437
|
-
|
|
438
|
-
/** The dino, its feet on screen point (x, y) (its box's bottom middle). */
|
|
439
|
-
export function spawnDino(world: World, v: View3D, x: number, y: number, tint: Color): DinoView {
|
|
440
|
-
const size = DINO_HEIGHT * pointSize(v);
|
|
441
|
-
const root = world.spawn({ mesh: 'none', position: at(v, x, y), pickable: false });
|
|
442
|
-
const body = world.spawn({ mesh: dinoMesh(), parent: root, scale: size, color: tint, pickable: false });
|
|
443
|
-
const leg = (z: number) =>
|
|
444
|
-
world.spawn({ mesh: legMesh(), parent: root, position: [HIP[0] * size, HIP[1] * size, z * size], scale: size, color: tint, pickable: false });
|
|
445
|
-
return { root, body, near: leg(0.1), far: leg(-0.1) };
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
export const dinoCentre = (x: number) => x + DINO_WIDTH / 2;
|
|
449
|
-
|
|
450
|
-
export function placeDino(world: World, v: View3D, d: DinoView, x: number, y: number) {
|
|
451
|
-
world.set(d.root, { position: at(v, x, y) });
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/** Running: the legs swing in turn and the body bobs; otherwise they hold a pose (tucked in the air). */
|
|
455
|
-
export function setGait(world: World, v: View3D, d: DinoView, gait: 'stand' | 'run' | 'air') {
|
|
456
|
-
for (const leg of [d.near, d.far]) world.stopAnimation(leg);
|
|
457
|
-
const size = DINO_HEIGHT * pointSize(v);
|
|
458
|
-
if (gait === 'run') {
|
|
459
|
-
world.set(d.near, { rotation: quat.z(SWING) });
|
|
460
|
-
world.set(d.far, { rotation: quat.z(-SWING) });
|
|
461
|
-
world.animate(d.near, { rotation: quat.z(-SWING) }, { duration: STRIDE_TIME, easing: 'easeInOut', repeat: 'forever', yoyo: true });
|
|
462
|
-
world.animate(d.far, { rotation: quat.z(SWING) }, { duration: STRIDE_TIME, easing: 'easeInOut', repeat: 'forever', yoyo: true });
|
|
463
|
-
world.set(d.root, { bob: { amplitude: [0, size * 0.025, 0], speed: Math.PI / STRIDE_TIME } });
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
world.set(d.root, { bob: null });
|
|
467
|
-
world.set(d.near, { rotation: quat.z(gait === 'air' ? 0.5 : 0) });
|
|
468
|
-
world.set(d.far, { rotation: quat.z(gait === 'air' ? -0.25 : 0) });
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/** A hit: the dino flashes red and shakes. */
|
|
472
|
-
export function hurtDino(world: World, d: DinoView, tint: Color) {
|
|
473
|
-
world.animate(d.body, [{ color: [1.8, 0.35, 0.35, 1], at: 0.25 }, { color: tint }], { duration: 0.4 });
|
|
474
|
-
world.animate(d.root, { shake: 0.05 }, { duration: 0.3 });
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/** A mushroom eaten: a golden glow. */
|
|
478
|
-
export function cheerDino(world: World, d: DinoView, tint: Color) {
|
|
479
|
-
world.animate(d.body, [{ color: [1.7, 1.5, 0.7, 1], at: 0.3 }, { color: tint }], { duration: 0.45 });
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// ── Effects ───────────────────────────────────────────────────────────
|
|
483
|
-
|
|
484
|
-
const SAND: Color = [0.86, 0.74, 0.55, 0.85];
|
|
485
|
-
const CACTUS_BITS: Color[] = ['#2f6b2c', '#5aa646', '#c9a063'].map((c) => toColor(c));
|
|
486
|
-
const MUSHROOM_BITS: Color[] = ['#e23b33', '#ffffff', '#ffd54f'].map((c) => toColor(c));
|
|
487
|
-
|
|
488
|
-
/** A puff of sand at screen point (x, y): kicked up running, or a bigger one landing. */
|
|
489
|
-
export function dust(world: World, v: View3D, x: number, y: number, big: boolean) {
|
|
490
|
-
const k = pointSize(v);
|
|
491
|
-
effects.dust(world, {
|
|
492
|
-
position: at(v, x, y),
|
|
493
|
-
count: big ? 5 : 1,
|
|
494
|
-
size: (big ? 22 : 14) * k,
|
|
495
|
-
speed: (big ? 60 : 30) * k,
|
|
496
|
-
direction: [-1, 0.5, 0],
|
|
497
|
-
spread: big ? 1.4 : 0.6,
|
|
498
|
-
lifetime: big ? 0.5 : 0.4,
|
|
499
|
-
color: SAND,
|
|
500
|
-
endSize: 2.2
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/** Bits fly where the dino hit an obstacle (green and sand for a cactus, red and white for a mushroom). */
|
|
505
|
-
export function hitBurst(world: World, v: View3D, x: number, y: number, mushroom: boolean) {
|
|
506
|
-
const k = pointSize(v);
|
|
507
|
-
effects.shatter(world, {
|
|
508
|
-
position: at(v, x, y, v.playDepth - 0.3),
|
|
509
|
-
count: 12,
|
|
510
|
-
mesh: mushroom ? 'sphere' : 'cube',
|
|
511
|
-
size: 8 * k,
|
|
512
|
-
speed: 220 * k,
|
|
513
|
-
lifetime: 0.55,
|
|
514
|
-
gravity: -2200 * k,
|
|
515
|
-
colors: mushroom ? MUSHROOM_BITS : CACTUS_BITS
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// ── The scrolling desert ──────────────────────────────────────────────
|
|
520
|
-
|
|
521
|
-
const SAND_LIGHT = rgb('#ecd29a');
|
|
522
|
-
const SAND_DARK = rgb('#cfa86a');
|
|
523
|
-
const SAND_RED = rgb('#d89a62');
|
|
524
|
-
|
|
525
|
-
/** Noise that repeats every `period` along x, so tiles meet without a seam. */
|
|
526
|
-
const periodic = (x: number, z: number, period: number, f: (x: number, z: number) => number) => {
|
|
527
|
-
const t = (((x % period) + period) % period) / period;
|
|
528
|
-
return f(t * period, z) * (1 - t) + f((t - 1) * period, z) * t;
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
* The desert floor for one tile, `TILE` metres across, from just in front of the camera to past the
|
|
533
|
-
* near hills: sand in drifts and ripples, a firmer, paler strip where the dino runs, hazing with distance.
|
|
534
|
-
*/
|
|
535
|
-
const floorMesh = (runZ: number) =>
|
|
536
|
-
cached(`dj-floor:${runZ.toFixed(2)}`, () => {
|
|
537
|
-
const vertices: number[] = [];
|
|
538
|
-
const indices: number[] = [];
|
|
539
|
-
const rows = 44;
|
|
540
|
-
const cols = 48;
|
|
541
|
-
for (let i = 0; i < rows; i++) {
|
|
542
|
-
const z = -(1.2 + Math.pow(1.12, i) - 1);
|
|
543
|
-
for (let j = 0; j < cols; j++) {
|
|
544
|
-
const x = -TILE / 2 + (j / (cols - 1)) * TILE;
|
|
545
|
-
const drift = periodic(x, z, TILE, (a, b) => fbm(a * 0.07, b * 0.07));
|
|
546
|
-
const ripple = periodic(x, z, TILE, (a, b) => noise(a * 0.9, b * 0.35));
|
|
547
|
-
let c = mix(SAND_DARK, SAND_LIGHT, drift);
|
|
548
|
-
c = mix(c, SAND_RED, Math.max(0, 0.45 - drift) * 0.6);
|
|
549
|
-
c = mix(c, mix(c, [1, 1, 1], 0.12), ripple * 0.6);
|
|
550
|
-
const track = Math.max(0, 1 - Math.abs(-z - runZ) / 1.3);
|
|
551
|
-
c = mix(c, rgb('#f2deb0'), track * 0.45);
|
|
552
|
-
const haze = 1 - Math.exp(-((-z / 140) ** 2));
|
|
553
|
-
c = mix(c, HAZE, haze * 0.7);
|
|
554
|
-
vertices.push(x, 0, z, 0, 1, 0, c[0], c[1], c[2], 0, 0);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
const id = (i: number, j: number) => i * cols + j;
|
|
558
|
-
for (let i = 0; i + 1 < rows; i++)
|
|
559
|
-
for (let j = 0; j + 1 < cols; j++) indices.push(id(i, j), id(i, j + 1), id(i + 1, j + 1), id(i, j), id(i + 1, j + 1), id(i + 1, j));
|
|
560
|
-
return createShape({ vertices: new Float32Array(vertices), indices: new Uint32Array(indices) }, { center: false });
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
/** A saguaro to stand in the distance: a ribbed trunk with arms, one unit tall. */
|
|
564
|
-
const saguaroMesh = () =>
|
|
565
|
-
cached('dj-saguaro', () =>
|
|
566
|
-
createShape(
|
|
567
|
-
merge([
|
|
568
|
-
{
|
|
569
|
-
geometry: lathe(
|
|
570
|
-
[
|
|
571
|
-
[0.07, 0],
|
|
572
|
-
[0.075, 0.7],
|
|
573
|
-
[0.065, 0.92],
|
|
574
|
-
[0.035, 0.99],
|
|
575
|
-
[0.001, 1]
|
|
576
|
-
],
|
|
577
|
-
{ segments: 18, ...ribbed(12, 0.006) }
|
|
578
|
-
)
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
geometry: tube(
|
|
582
|
-
[
|
|
583
|
-
[-0.06, 0.42, 0],
|
|
584
|
-
[-0.2, 0.44, 0],
|
|
585
|
-
[-0.22, 0.72, 0]
|
|
586
|
-
],
|
|
587
|
-
{ radius: 0.045, color: rgb('#3f8a38') }
|
|
588
|
-
)
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
geometry: tube(
|
|
592
|
-
[
|
|
593
|
-
[0.06, 0.52, 0],
|
|
594
|
-
[0.17, 0.54, 0],
|
|
595
|
-
[0.18, 0.8, 0]
|
|
596
|
-
],
|
|
597
|
-
{ radius: 0.04, color: rgb('#3f8a38') }
|
|
598
|
-
)
|
|
599
|
-
}
|
|
600
|
-
]),
|
|
601
|
-
{ center: false, shine: 0.2 }
|
|
602
|
-
)
|
|
603
|
-
);
|
|
604
|
-
|
|
605
|
-
/** A barrel cactus with a ring of pink flowers, about half a unit tall. */
|
|
606
|
-
const barrelMesh = () =>
|
|
607
|
-
cached('dj-barrel', () =>
|
|
608
|
-
createShape(
|
|
609
|
-
merge([
|
|
610
|
-
{
|
|
611
|
-
geometry: lathe(
|
|
612
|
-
[
|
|
613
|
-
[0.001, 0],
|
|
614
|
-
[0.3, 0.04],
|
|
615
|
-
[0.4, 0.22],
|
|
616
|
-
[0.36, 0.42],
|
|
617
|
-
[0.2, 0.54],
|
|
618
|
-
[0.001, 0.56]
|
|
619
|
-
],
|
|
620
|
-
{ segments: 22, ...ribbed(14, 0.02) }
|
|
621
|
-
)
|
|
622
|
-
},
|
|
623
|
-
...[0, 1, 2, 3, 4].map((i) => ({
|
|
624
|
-
geometry: sphere(),
|
|
625
|
-
position: [Math.cos(i * 1.26) * 0.12, 0.56, Math.sin(i * 1.26) * 0.12] as Vec3,
|
|
626
|
-
scale: 0.09,
|
|
627
|
-
color: rgb('#ff6fa8')
|
|
628
|
-
}))
|
|
629
|
-
]),
|
|
630
|
-
{ center: false, shine: 0.25 }
|
|
631
|
-
)
|
|
632
|
-
);
|
|
633
|
-
|
|
634
|
-
export type Tiles = { roots: Entity[] };
|
|
635
|
-
|
|
636
|
-
/** Three desert tiles side by side, each its floor with its plants and rocks as children. */
|
|
637
|
-
export function spawnDesert(world: World, theme: GameTheme, runZ: number): Tiles {
|
|
638
|
-
const tint = sceneryTint(theme);
|
|
639
|
-
const shade = (c: Color): Color => [c[0] * tint[0], c[1] * tint[1], c[2] * tint[2], c[3] ?? 1];
|
|
640
|
-
const roots = [0, 1, 2].map((t) => {
|
|
641
|
-
const root = world.spawn({ mesh: floorMesh(runZ), color: shade([1, 1, 1, 1]), pickable: false });
|
|
642
|
-
const rand = random(100 + t * 17);
|
|
643
|
-
const put = (mesh: Model, x: number, z: number, s: number | Vec3, color: Color = [1, 1, 1, 1], rotation: Quat = quat.y(rand() * 6.3)) =>
|
|
644
|
-
world.spawn({ mesh, parent: root, position: [x, 0, z], scale: s, rotation, color: shade(color), pickable: false });
|
|
645
|
-
const anywhere = () => (rand() - 0.5) * TILE;
|
|
646
|
-
// Keep the strip just behind the dino clear of anything that could pass for an obstacle
|
|
647
|
-
const behind = (near: number, far: number) => {
|
|
648
|
-
let z = -(near + rand() * (far - near));
|
|
649
|
-
if (Math.abs(-z - runZ) < 4) z -= 5;
|
|
650
|
-
return z;
|
|
651
|
-
};
|
|
652
|
-
for (let i = 0; i < 6; i++) put(saguaroMesh(), anywhere(), behind(18, 70), 3 + rand() * 3.5, [1, 1, 1, 1], quat.y(rand() * 0.6 - 0.3));
|
|
653
|
-
for (let i = 0; i < 6; i++) put(barrelMesh(), anywhere(), behind(13, 40), 0.5 + rand() * 0.6);
|
|
654
|
-
for (let i = 0; i < 8; i++) {
|
|
655
|
-
const s = 0.3 + rand() * 1.4;
|
|
656
|
-
put(rockMesh(), anywhere(), behind(12, 60), [s * 1.3, s, s], [0.95, 0.78, 0.6, 1]);
|
|
657
|
-
}
|
|
658
|
-
for (let i = 0; i < 8; i++) {
|
|
659
|
-
const s = 0.5 + rand() * 0.7;
|
|
660
|
-
put(bushMesh(), anywhere(), behind(12, 50), [s * 1.2, s * 0.8, s * 1.2], [0.72, 0.62, 0.36, 1]);
|
|
661
|
-
}
|
|
662
|
-
// Dry tufts and pebbles right in front. A prop d metres out stays below the dino's ground line while
|
|
663
|
-
// it's shorter than eye height x (1 - d / runZ): the tufts (up to ~0.3 m) keep within 5.5 m, the
|
|
664
|
-
// pebbles (a few cm) can go nearly to the line
|
|
665
|
-
for (let i = 0; i < 16; i++) put(tuftMesh(), anywhere(), -(2.6 + rand() * 2.9), 0.5 + rand() * 0.3, [0.82, 0.72, 0.42, 1]);
|
|
666
|
-
for (let i = 0; i < 14; i++) {
|
|
667
|
-
const s = 0.05 + rand() * 0.07;
|
|
668
|
-
put(rockMesh(), anywhere(), -(2.6 + rand() * 5.5), [s * 1.4, s, s], [0.85, 0.72, 0.58, 1]);
|
|
669
|
-
}
|
|
670
|
-
return root;
|
|
671
|
-
});
|
|
672
|
-
return { roots };
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
/** Scrolls the desert `travelled` metres: each tile wraps round to the far side once it's well out of view. */
|
|
676
|
-
export function placeDesert(world: World, t: Tiles, travelled: number) {
|
|
677
|
-
t.roots.forEach((root, i) => {
|
|
678
|
-
const span = TILE * 3;
|
|
679
|
-
const x = ((((i * TILE - travelled + TILE * 1.5) % span) + span) % span) - TILE * 1.5;
|
|
680
|
-
world.set(root, { position: [x, 0, 0] });
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
export function removeDesert(world: World, t: Tiles) {
|
|
685
|
-
for (const r of t.roots) world.despawn(r);
|
|
686
|
-
}
|