@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,265 +0,0 @@
|
|
|
1
|
-
// Small reusable detail meshes layered onto the original scenery. Model registration is done
|
|
2
|
-
// during asset loading; recycling road segments only instances these cached meshes.
|
|
3
|
-
import { type Color, ellipsoid, type Geometry, merge, type Model, type Vec3 } from '@nayan-ui/engine';
|
|
4
|
-
import { cacheGameAsset, createGameMesh } from '../shared/EngineMeshes';
|
|
5
|
-
import { facadeWindowQuads } from './CarRacingFacade';
|
|
6
|
-
|
|
7
|
-
type Vector = [number, number, number];
|
|
8
|
-
class Details {
|
|
9
|
-
private vertices: number[] = [];
|
|
10
|
-
private indices: number[] = [];
|
|
11
|
-
quad(a: Vec3, b: Vec3, c: Vec3, d: Vec3, normal: Vec3, color: Color, uv: [number, number] = [1, 1]) {
|
|
12
|
-
const first = this.vertices.length / 11;
|
|
13
|
-
for (const [p, tex] of [
|
|
14
|
-
[a, [0, 0]],
|
|
15
|
-
[b, [uv[0], 0]],
|
|
16
|
-
[c, uv],
|
|
17
|
-
[d, [0, uv[1]]]
|
|
18
|
-
] as [Vec3, number[]][]) {
|
|
19
|
-
this.vertices.push(...p, ...normal, color[0], color[1], color[2], tex[0]!, tex[1]!);
|
|
20
|
-
}
|
|
21
|
-
const ab = [b[0] - a[0], b[1] - a[1], b[2] - a[2]],
|
|
22
|
-
ac = [c[0] - a[0], c[1] - a[1], c[2] - a[2]];
|
|
23
|
-
const facing =
|
|
24
|
-
(ab[1]! * ac[2]! - ab[2]! * ac[1]!) * normal[0] +
|
|
25
|
-
(ab[2]! * ac[0]! - ab[0]! * ac[2]!) * normal[1] +
|
|
26
|
-
(ab[0]! * ac[1]! - ab[1]! * ac[0]!) * normal[2];
|
|
27
|
-
this.indices.push(...(facing >= 0 ? [0, 1, 2, 0, 2, 3] : [0, 2, 1, 0, 3, 2]).map((i) => first + i));
|
|
28
|
-
}
|
|
29
|
-
box(size: Vec3, at: Vec3, color: Color) {
|
|
30
|
-
const [x, y, z] = at,
|
|
31
|
-
[w, h, d] = size.map((v) => v / 2) as Vector;
|
|
32
|
-
this.quad([x - w, y - h, z + d], [x + w, y - h, z + d], [x + w, y + h, z + d], [x - w, y + h, z + d], [0, 0, 1], color);
|
|
33
|
-
this.quad([x + w, y - h, z - d], [x - w, y - h, z - d], [x - w, y + h, z - d], [x + w, y + h, z - d], [0, 0, -1], color);
|
|
34
|
-
this.quad([x + w, y - h, z + d], [x + w, y - h, z - d], [x + w, y + h, z - d], [x + w, y + h, z + d], [1, 0, 0], color);
|
|
35
|
-
this.quad([x - w, y - h, z - d], [x - w, y - h, z + d], [x - w, y + h, z + d], [x - w, y + h, z - d], [-1, 0, 0], color);
|
|
36
|
-
this.quad([x - w, y + h, z + d], [x + w, y + h, z + d], [x + w, y + h, z - d], [x - w, y + h, z - d], [0, 1, 0], color);
|
|
37
|
-
this.quad([x - w, y - h, z - d], [x + w, y - h, z - d], [x + w, y - h, z + d], [x - w, y - h, z + d], [0, -1, 0], color);
|
|
38
|
-
}
|
|
39
|
-
geometry(): Geometry {
|
|
40
|
-
return { vertices: new Float32Array(this.vertices), indices: new Uint32Array(this.indices) };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const STONE: Color = [0.57, 0.57, 0.53],
|
|
44
|
-
METAL: Color = [0.2, 0.24, 0.23],
|
|
45
|
-
WOOD: Color = [0.43, 0.31, 0.2];
|
|
46
|
-
function detail(key: string, build: (mesh: Details) => void, shine = 0.1): Model {
|
|
47
|
-
return cacheGameAsset(`car-racing/scenery-details-v1/${key}`, () => {
|
|
48
|
-
const mesh = new Details();
|
|
49
|
-
build(mesh);
|
|
50
|
-
return createGameMesh(mesh.geometry(), { center: false, shine });
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function podium(): Model {
|
|
54
|
-
return detail(
|
|
55
|
-
'podium',
|
|
56
|
-
(m) => {
|
|
57
|
-
m.box([1.025, 0.32, 1.025], [0, 0.16, 0], STONE);
|
|
58
|
-
m.box([1.012, 2.6, 1.012], [0, 1.5, 0], [0.2, 0.28, 0.3]);
|
|
59
|
-
m.box([1.055, 0.18, 1.055], [0, 2.9, 0], [0.49, 0.48, 0.43]);
|
|
60
|
-
for (const side of [-1, 1]) {
|
|
61
|
-
for (const t of [-0.48, -0.24, 0, 0.24, 0.48]) {
|
|
62
|
-
m.box([0.025, 2.5, 0.035], [side * 0.514, 1.5, t], [0.39, 0.41, 0.39]);
|
|
63
|
-
m.box([0.035, 2.5, 0.025], [t, 1.5, side * 0.514], [0.39, 0.41, 0.39]);
|
|
64
|
-
}
|
|
65
|
-
m.box([0.095, 0.12, 0.66], [side * 0.55, 2.55, 0], [0.31, 0.36, 0.31]);
|
|
66
|
-
m.box([0.025, 0.08, 0.015], [side * 0.534, 1.28, 0.065], [0.72, 0.73, 0.69]);
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
0.25
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
function roof(style: number): Model {
|
|
73
|
-
return detail(`roof-${style}`, (m) => {
|
|
74
|
-
m.box([1.045, 0.25, 1.045], [0, 0.03, 0], [0.57, 0.56, 0.52]);
|
|
75
|
-
for (const side of [-1, 1]) {
|
|
76
|
-
m.box([1.03, 0.55, 0.018], [0, 0.36, side * 0.507], [0.46, 0.47, 0.44]);
|
|
77
|
-
m.box([0.018, 0.55, 1.03], [side * 0.507, 0.36, 0], [0.46, 0.47, 0.44]);
|
|
78
|
-
}
|
|
79
|
-
m.box([0.25, 0.8, 0.25], [-0.17, 0.52, 0.16], [0.49, 0.53, 0.53]);
|
|
80
|
-
for (let slat = 0; slat < 4; slat++) m.box([0.255, 0.035, 0.025], [-0.17, 0.96, 0.07 + slat * 0.055], METAL);
|
|
81
|
-
m.box([0.12, style ? 1.5 : 0.65, 0.15], [0.24, style ? 0.95 : 0.52, -0.18], [0.52, 0.43, 0.35]);
|
|
82
|
-
if (style) m.box([0.18, 0.1, 0.21], [0.24, 1.72, -0.18], [0.63, 0.61, 0.56]);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function facade(style: number): Model {
|
|
86
|
-
return detail(`trim-${style}`, (m) => {
|
|
87
|
-
const trim: Color = style === 1 ? [0.58, 0.61, 0.61] : [0.72, 0.7, 0.64];
|
|
88
|
-
for (const side of [-1, 1]) {
|
|
89
|
-
for (const corner of [-1, 1]) m.box([0.025, 0.985, 0.025], [side * 0.496, 0, corner * 0.496], trim);
|
|
90
|
-
if (style === 0)
|
|
91
|
-
for (const x of [-0.25, 0.25]) {
|
|
92
|
-
m.box([0.013, 0.98, 0.012], [x, 0, side * 0.504], trim);
|
|
93
|
-
m.box([0.012, 0.98, 0.013], [side * 0.504, 0, x], trim);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
for (const y of style === 2 ? [-0.25, 0, 0.25, 0.49] : [0.49]) m.box([1.025, 0.009, 1.025], [0, y, 0], trim);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
function windows(): Model {
|
|
100
|
-
return detail(
|
|
101
|
-
'night-windows-aligned-v2',
|
|
102
|
-
(m) => {
|
|
103
|
-
for (const {
|
|
104
|
-
corners: [a, b, c, d],
|
|
105
|
-
normal
|
|
106
|
-
} of facadeWindowQuads()) {
|
|
107
|
-
m.quad(a, b, c, d, normal, [1.6, 1.46, 1.02]);
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
0
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
function bench(): Model {
|
|
114
|
-
return detail('bench', (m) => {
|
|
115
|
-
for (const z of [-0.2, -0.07, 0.06, 0.19]) m.box([1.7, 0.07, 0.1], [0, 0.52, z], WOOD);
|
|
116
|
-
for (const y of [0.77, 0.91, 1.05]) m.box([1.7, 0.1, 0.07], [0, y, -0.24], WOOD);
|
|
117
|
-
for (const x of [-0.59, 0.59]) {
|
|
118
|
-
m.box([0.08, 0.52, 0.45], [x, 0.26, 0], METAL);
|
|
119
|
-
m.box([0.065, 1.06, 0.065], [x, 0.53, -0.23], METAL);
|
|
120
|
-
m.box([0.07, 0.07, 0.45], [x, 0.72, 0], METAL);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
function planter(): Model {
|
|
125
|
-
return detail('planter', (m) => {
|
|
126
|
-
m.box([1.5, 0.48, 1.8], [0, 0.24, 0], [0.43, 0.44, 0.39]);
|
|
127
|
-
m.box([1.6, 0.08, 1.9], [0, 0.5, 0], [0.65, 0.64, 0.58]);
|
|
128
|
-
m.box([1.32, 0.035, 1.62], [0, 0.55, 0], [0.21, 0.18, 0.12]);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
function bin(): Model {
|
|
132
|
-
return detail('bin', (m) => {
|
|
133
|
-
m.box([0.5, 0.85, 0.5], [0, 0.43, 0], [0.23, 0.29, 0.25]);
|
|
134
|
-
m.box([0.56, 0.08, 0.56], [0, 0.9, 0], [0.39, 0.41, 0.35]);
|
|
135
|
-
m.box([0.36, 0.15, 0.02], [0, 0.76, 0.257], [0.055, 0.07, 0.06]);
|
|
136
|
-
for (const x of [-0.18, -0.06, 0.06, 0.18]) m.box([0.012, 0.63, 0.025], [x, 0.4, 0.26], [0.12, 0.18, 0.15]);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
function shelter(): Model {
|
|
140
|
-
return detail('shelter', (m) => {
|
|
141
|
-
m.box([2.15, 0.16, 4.4], [0, 3.0, 0], [0.39, 0.42, 0.4]);
|
|
142
|
-
m.box([2.3, 0.08, 4.6], [0, 3.13, 0], [0.58, 0.61, 0.57]);
|
|
143
|
-
for (const z of [-1.9, 1.9]) for (const x of [-0.85, 0.85]) m.box([0.08, 2.95, 0.08], [x, 1.5, z], METAL);
|
|
144
|
-
m.box([0.035, 2.25, 3.6], [0.88, 1.65, 0], [0.34, 0.48, 0.51]);
|
|
145
|
-
m.box([1.7, 0.06, 0.5], [0, 0.62, 0], WOOD);
|
|
146
|
-
for (const z of [-1.1, 1.1]) m.box([0.5, 0.58, 0.08], [0, 0.29, z], METAL);
|
|
147
|
-
m.box([0.06, 0.95, 0.65], [-0.86, 1.8, 1.4], [0.85, 0.86, 0.79]);
|
|
148
|
-
for (let line = 0; line < 5; line++) m.box([0.07, 0.035, 0.42], [-0.9, 2.1 - line * 0.12, 1.4], [0.21, 0.35, 0.3]);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
function grass(): Model {
|
|
152
|
-
return detail('grass', (m) => {
|
|
153
|
-
for (let blade = 0; blade < 14; blade++) {
|
|
154
|
-
const angle = blade * 2.39996,
|
|
155
|
-
x = Math.cos(angle) * (0.15 + (blade % 3) * 0.08),
|
|
156
|
-
z = Math.sin(angle) * (0.15 + (blade % 3) * 0.08);
|
|
157
|
-
const h = 0.22 + (blade % 4) * 0.07,
|
|
158
|
-
dx = Math.cos(angle) * 0.13,
|
|
159
|
-
dz = Math.sin(angle) * 0.13;
|
|
160
|
-
const normal: Vec3 = [Math.cos(angle), 0, Math.sin(angle)];
|
|
161
|
-
const side: Vec3 = [-normal[2] * 0.025, 0, normal[0] * 0.025];
|
|
162
|
-
const color: Color = [0.22 + (blade % 3) * 0.035, 0.34 + (blade % 4) * 0.025, 0.12];
|
|
163
|
-
const points: Vec3[] = [
|
|
164
|
-
[x + side[0], 0, z + side[2]],
|
|
165
|
-
[x - side[0], 0, z - side[2]],
|
|
166
|
-
[x + dx, h, z + dz],
|
|
167
|
-
[x + dx, h, z + dz]
|
|
168
|
-
];
|
|
169
|
-
m.quad(points[0]!, points[1]!, points[2]!, points[3]!, normal, color);
|
|
170
|
-
m.quad(points[3]!, points[2]!, points[1]!, points[0]!, [-normal[0], 0, -normal[2]], color);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
function flowers(): Model {
|
|
175
|
-
return detail('flowers', (m) => {
|
|
176
|
-
for (let i = 0; i < 9; i++) {
|
|
177
|
-
const x = Math.cos(i * 2.4) * 0.44,
|
|
178
|
-
z = Math.sin(i * 2.4) * 0.5,
|
|
179
|
-
h = 0.3 + (i % 3) * 0.09;
|
|
180
|
-
m.box([0.018, h, 0.018], [x, h / 2, z], [0.19, 0.32, 0.12]);
|
|
181
|
-
const petal: Color = i % 3 ? [0.9, 0.78, 0.32] : [0.86, 0.86, 0.79];
|
|
182
|
-
m.box([0.17, 0.035, 0.055], [x, h, z], petal);
|
|
183
|
-
m.box([0.055, 0.04, 0.17], [x, h, z], petal);
|
|
184
|
-
m.box([0.045, 0.048, 0.045], [x, h + 0.01, z], [0.59, 0.38, 0.1]);
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
function pavement(): Model {
|
|
189
|
-
return detail('pavement', (m) => {
|
|
190
|
-
m.box([2.6, 0.12, 6.35], [0, 0, 0], [0.65, 0.65, 0.61]);
|
|
191
|
-
for (let row = 0; row < 6; row++) m.box([2.6, 0.006, 0.015], [0, 0.063, -2.5 + row], [0.5, 0.51, 0.47]);
|
|
192
|
-
for (const x of [-0.43, 0.43]) m.box([0.015, 0.006, 6.3], [x, 0.063, 0], [0.5, 0.51, 0.47]);
|
|
193
|
-
for (const x of [-1.27, 1.27]) m.box([0.065, 0.06, 6.35], [x, 0.08, 0], [0.74, 0.73, 0.67]);
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
function drain(): Model {
|
|
197
|
-
return detail('drain', (m) => {
|
|
198
|
-
m.box([0.31, 0.014, 0.65], [0, 0, 0], [0.29, 0.3, 0.27]);
|
|
199
|
-
for (let i = 0; i < 7; i++) m.box([0.23, 0.006, 0.035], [0, 0.009, -0.25 + i * 0.08], [0.085, 0.1, 0.09]);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
function houseDetails(): Model {
|
|
203
|
-
return detail('house-details', (m) => {
|
|
204
|
-
m.box([5.2, 0.16, 5.8], [0, 3.14, 0], [0.64, 0.62, 0.53]);
|
|
205
|
-
m.box([0.55, 1.4, 0.55], [1.3, 4.0, -0.9], [0.49, 0.35, 0.28]);
|
|
206
|
-
m.box([0.68, 0.12, 0.68], [1.3, 4.73, -0.9], [0.58, 0.56, 0.51]);
|
|
207
|
-
for (const x of [-2.55, 2.55]) {
|
|
208
|
-
m.box([0.07, 1.2, 1.2], [x, 0.64, 0.9], [0.31, 0.35, 0.29]);
|
|
209
|
-
m.box([0.9, 0.1, 1.45], [x, 1.35, 0.9], [0.5, 0.36, 0.24]);
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
function routeSign(): Model {
|
|
214
|
-
return detail('route-sign', (m) => {
|
|
215
|
-
m.box([4.2, 1.5, 0.12], [0, 0, 0], [0.16, 0.29, 0.22]);
|
|
216
|
-
for (const side of [-1, 1]) {
|
|
217
|
-
m.box([4.12, 0.035, 0.015], [0, side * 0.69, 0.072], [0.79, 0.83, 0.73]);
|
|
218
|
-
m.box([0.035, 1.36, 0.015], [side * 2.03, 0, 0.072], [0.79, 0.83, 0.73]);
|
|
219
|
-
}
|
|
220
|
-
m.box([0.7, 0.12, 0.02], [1.25, -0.05, 0.08], [0.94, 0.95, 0.86]);
|
|
221
|
-
m.quad([1.42, -0.31, 0.094], [1.8, -0.05, 0.094], [1.42, 0.21, 0.094], [1.42, 0.21, 0.094], [0, 0, 1], [0.94, 0.95, 0.86]);
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function grassGround(): Model {
|
|
226
|
-
return detail('grass-ground-v2', (m) => m.quad([-0.5, 0, -0.5], [0.5, 0, -0.5], [0.5, 0, 0.5], [-0.5, 0, 0.5], [0, 1, 0], [1, 1, 1], [1, 1]));
|
|
227
|
-
}
|
|
228
|
-
function cloud(): Model {
|
|
229
|
-
return cacheGameAsset('car-racing/scenery-details-v1/cloud', () =>
|
|
230
|
-
createGameMesh(
|
|
231
|
-
merge([
|
|
232
|
-
{ geometry: ellipsoid([14, 2.4, 6], [1, 1, 1], 10) },
|
|
233
|
-
{ geometry: ellipsoid([8, 3.8, 5], [1, 1, 1], 10), position: [-4, 1.1, 0] },
|
|
234
|
-
{ geometry: ellipsoid([7, 2.8, 5], [1, 1, 1], 10), position: [8, 0.4, 1] }
|
|
235
|
-
]),
|
|
236
|
-
{ center: false, shine: 0 }
|
|
237
|
-
)
|
|
238
|
-
);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
let scenery: ReturnType<typeof buildScenery> | undefined;
|
|
242
|
-
function buildScenery() {
|
|
243
|
-
return {
|
|
244
|
-
podium: podium(),
|
|
245
|
-
roofs: [roof(0), roof(1)],
|
|
246
|
-
facades: [facade(0), facade(1), facade(2)],
|
|
247
|
-
windows: windows(),
|
|
248
|
-
bench: bench(),
|
|
249
|
-
planter: planter(),
|
|
250
|
-
bin: bin(),
|
|
251
|
-
shelter: shelter(),
|
|
252
|
-
grass: grass(),
|
|
253
|
-
flowers: flowers(),
|
|
254
|
-
pavement: pavement(),
|
|
255
|
-
drain: drain(),
|
|
256
|
-
house: houseDetails(),
|
|
257
|
-
grassGround: grassGround(),
|
|
258
|
-
routeSign: routeSign(),
|
|
259
|
-
cloud: cloud()
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
export type SceneryMeshes = ReturnType<typeof buildScenery>;
|
|
263
|
-
export function sceneryMeshes(): SceneryMeshes {
|
|
264
|
-
return (scenery ??= buildScenery());
|
|
265
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { HapticType } from '../../services/HapticsService';
|
|
3
|
-
import { GAME_SOUNDS, type SoundConfig } from '../../services/SoundsService';
|
|
4
|
-
import { GAME_IDS } from '../../services/UtilsService';
|
|
5
|
-
import { engineGame, EngineGameScreen } from '../shared/EngineGameScreen';
|
|
6
|
-
import { livesColumn, scoreColumn, textColumn } from '../shared/EngineHud';
|
|
7
|
-
import { useEngineGame } from '../shared/useEngineGame';
|
|
8
|
-
import { useLiveState } from '../shared/useLiveState';
|
|
9
|
-
import { backgroundFor, lightFor } from './ChameleonRunBackdrop';
|
|
10
|
-
import { MAX_LIVES, RESULTS_DELAY_LOSE, RESULTS_DELAY_WIN, TRACK_LENGTH } from './ChameleonRunConstants';
|
|
11
|
-
import {
|
|
12
|
-
changeColor,
|
|
13
|
-
createGame,
|
|
14
|
-
dispose,
|
|
15
|
-
type GameEvent,
|
|
16
|
-
INITIAL_HUD,
|
|
17
|
-
reset,
|
|
18
|
-
setActive,
|
|
19
|
-
setLayout,
|
|
20
|
-
setTheme,
|
|
21
|
-
start,
|
|
22
|
-
steer,
|
|
23
|
-
tick
|
|
24
|
-
} from './ChameleonRunGame';
|
|
25
|
-
|
|
26
|
-
const SOUNDS = GAME_SOUNDS.CHAMELEON_RUN;
|
|
27
|
-
const FEEDBACK: Record<GameEvent, { sound?: SoundConfig; haptic: HapticType }> = {
|
|
28
|
-
jump: { sound: SOUNDS.JUMP, haptic: HapticType.LIGHT },
|
|
29
|
-
land: { sound: SOUNDS.LAND, haptic: HapticType.LIGHT },
|
|
30
|
-
swap: { sound: SOUNDS.SWAP, haptic: HapticType.LIGHT },
|
|
31
|
-
star: { sound: SOUNDS.STAR, haptic: HapticType.SUCCESS },
|
|
32
|
-
hurt: { sound: SOUNDS.HURT, haptic: HapticType.HEAVY },
|
|
33
|
-
fall: { sound: SOUNDS.GAME_OVER, haptic: HapticType.ERROR },
|
|
34
|
-
win: { sound: SOUNDS.WIN, haptic: HapticType.SUCCESS }
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const ChameleonRun = engineGame(GAME_IDS.CHAMELEON_RUN, (props) => {
|
|
38
|
-
const [score, setScore] = useLiveState(0);
|
|
39
|
-
const [stars, setStars] = useLiveState(0);
|
|
40
|
-
const [distance, setDistance] = useLiveState(0);
|
|
41
|
-
const [lives, setLives] = useLiveState(MAX_LIVES);
|
|
42
|
-
const [hud, setHud] = useLiveState(INITIAL_HUD, 0);
|
|
43
|
-
const { game, theme, status, screen, gameOver } = useEngineGame(props, {
|
|
44
|
-
gameId: GAME_IDS.CHAMELEON_RUN,
|
|
45
|
-
create: createGame,
|
|
46
|
-
start,
|
|
47
|
-
reset,
|
|
48
|
-
dispose,
|
|
49
|
-
tick,
|
|
50
|
-
setTheme,
|
|
51
|
-
setActive,
|
|
52
|
-
resize: setLayout,
|
|
53
|
-
tap: changeColor,
|
|
54
|
-
drag: steer,
|
|
55
|
-
reportScore: (g) => g.run?.score ?? 0,
|
|
56
|
-
sounds: SOUNDS,
|
|
57
|
-
onStart: (fx) => fx(SOUNDS.START, HapticType.SUCCESS),
|
|
58
|
-
onStop: (fx) => fx(undefined, HapticType.MEDIUM),
|
|
59
|
-
resultsDelay: (result) => (result === 'win' ? RESULTS_DELAY_WIN : RESULTS_DELAY_LOSE),
|
|
60
|
-
wire: (g, fx) => {
|
|
61
|
-
g.onScore = setScore;
|
|
62
|
-
g.onStars = setStars;
|
|
63
|
-
g.onDistance = setDistance;
|
|
64
|
-
g.onLives = setLives;
|
|
65
|
-
g.onHud = setHud;
|
|
66
|
-
g.onEvent = (event) => fx(FEEDBACK[event].sound, FEEDBACK[event].haptic);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// Pausing the app or opening Settings freezes rules, the clock and native animations.
|
|
71
|
-
|
|
72
|
-
const light = useMemo(() => lightFor(theme), [theme]);
|
|
73
|
-
const background = useMemo(() => backgroundFor(theme), [theme]);
|
|
74
|
-
const failureMessage = hud.failure === 'color' ? 'Match your color to the platform before landing.' : 'Use the second jump to save a long leap.';
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<EngineGameScreen
|
|
78
|
-
{...screen}
|
|
79
|
-
light={light}
|
|
80
|
-
background={background}
|
|
81
|
-
fog={0}
|
|
82
|
-
columns={[scoreColumn(score), livesColumn(lives, MAX_LIVES), textColumn('TRACK', `${TRACK_LENGTH - distance} m`)]}
|
|
83
|
-
subtext="Change colors and jump!"
|
|
84
|
-
gameOver={gameOver({
|
|
85
|
-
title: status === 'win' ? 'YOU MADE IT!' : 'OUT OF LIVES!',
|
|
86
|
-
message:
|
|
87
|
-
status === 'win'
|
|
88
|
-
? `Finished ${TRACK_LENGTH} m with ${stars} stars! Best streak ×${game.run?.bestCombo ?? 0}.`
|
|
89
|
-
: `Out of lives after ${distance} of ${TRACK_LENGTH} m. ${failureMessage}`,
|
|
90
|
-
scoreLabel: 'Run Score',
|
|
91
|
-
score,
|
|
92
|
-
buttonText: status === 'win' ? 'Run Again!' : 'Try Again!'
|
|
93
|
-
})}
|
|
94
|
-
/>
|
|
95
|
-
);
|
|
96
|
-
});
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
// A code-only alpine valley. Terrain, rock strata, snow, haze and a soft sky are baked into
|
|
2
|
-
// four cached meshes (day/night × sky/terrain); there are no image assets or asynchronous loads.
|
|
3
|
-
import { type Entity, type Geometry, type Light, type Model, type Vec3, type World } from '@nayan-ui/engine';
|
|
4
|
-
import type { GameTheme } from '../../services/ThemeService';
|
|
5
|
-
import { cacheGameAsset, createGameMesh as createShape } from '../shared/EngineMeshes';
|
|
6
|
-
|
|
7
|
-
type RGB = readonly [number, number, number];
|
|
8
|
-
const DAY_LIGHT: Light = { direction: [-0.6, 0.75, 0.25], ambient: 0.48, color: [1.04, 1.02, 1], shadows: true, shadowExtent: 28 };
|
|
9
|
-
const NIGHT_LIGHT: Light = { direction: [-0.25, 0.75, 0.45], ambient: 0.6, color: [0.78, 0.86, 1.05], shadows: true, shadowExtent: 28 };
|
|
10
|
-
export const lightFor = (theme: GameTheme): Light => (theme.mode === 'dark' ? NIGHT_LIGHT : DAY_LIGHT);
|
|
11
|
-
export const backgroundFor = (theme: GameTheme): RGB => (theme.mode === 'dark' ? [0.055, 0.085, 0.13] : [0.63, 0.73, 0.81]);
|
|
12
|
-
|
|
13
|
-
const meshes = new Map<string, Model>();
|
|
14
|
-
const clamp = (x: number, lo = 0, hi = 1) => Math.max(lo, Math.min(hi, x));
|
|
15
|
-
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];
|
|
16
|
-
const smooth = (lo: number, hi: number, x: number) => {
|
|
17
|
-
const t = clamp((x - lo) / (hi - lo));
|
|
18
|
-
return t * t * (3 - 2 * t);
|
|
19
|
-
};
|
|
20
|
-
const normalize = (v: Vec3): Vec3 => {
|
|
21
|
-
const n = Math.hypot(...v) || 1;
|
|
22
|
-
return [v[0] / n, v[1] / n, v[2] / n];
|
|
23
|
-
};
|
|
24
|
-
const hash = (x: number, y: number) => {
|
|
25
|
-
const n = Math.sin(x * 127.1 + y * 311.7) * 43758.5453;
|
|
26
|
-
return n - Math.floor(n);
|
|
27
|
-
};
|
|
28
|
-
function noise(x: number, y: number) {
|
|
29
|
-
const ix = Math.floor(x),
|
|
30
|
-
iy = Math.floor(y);
|
|
31
|
-
const fx = smooth(0, 1, x - ix),
|
|
32
|
-
fy = smooth(0, 1, y - iy);
|
|
33
|
-
const a = hash(ix, iy),
|
|
34
|
-
b = hash(ix + 1, iy),
|
|
35
|
-
c = hash(ix, iy + 1),
|
|
36
|
-
d = hash(ix + 1, iy + 1);
|
|
37
|
-
return a + (b - a) * fx + (c - a) * fy + (a - b - c + d) * fx * fy;
|
|
38
|
-
}
|
|
39
|
-
const fbm = (x: number, y: number) =>
|
|
40
|
-
noise(x, y) * 0.55 + noise(x * 2.13 + 7, y * 2.13) * 0.28 + noise(x * 4.57, y * 4.57 + 11) * 0.12 + noise(x * 9.1, y * 9.1) * 0.05;
|
|
41
|
-
|
|
42
|
-
/** The central ravine stays well below the floating course; only distant flanks rise into mountains. */
|
|
43
|
-
function heightAt(x: number, z: number) {
|
|
44
|
-
const distance = -z;
|
|
45
|
-
const bend = Math.sin(distance * 0.014) * 12 + Math.sin(distance * 0.027 + 1) * 7;
|
|
46
|
-
const valley = 1 - Math.exp(-((Math.abs(x - bend) / (48 + distance * 0.14)) ** 1.8));
|
|
47
|
-
const warp = (fbm(x * 0.014 + 9, z * 0.011) - 0.5) * 19;
|
|
48
|
-
const ridge = 1 - Math.abs(noise((x + warp) * 0.018, z * 0.014 + 13) * 2 - 1);
|
|
49
|
-
const spur = 1 - Math.abs(noise(x * 0.047 + 5, z * 0.033) * 2 - 1);
|
|
50
|
-
const peaks = 28 + ridge ** 3 * 88 + spur * 12;
|
|
51
|
-
const farRange = smooth(210, 405, distance) * (20 + fbm(x * 0.022 + 30, z * 0.017) * 46);
|
|
52
|
-
const gullies = (fbm(x * 0.11, z * 0.09) - 0.5) * valley * 5;
|
|
53
|
-
return -44 + valley * peaks + farRange + gullies;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface Point {
|
|
57
|
-
position: Vec3;
|
|
58
|
-
color: RGB;
|
|
59
|
-
}
|
|
60
|
-
/** Background lighting is static, so bake it with the haze and compensate for the renderer once. */
|
|
61
|
-
function surface(rows: number, columns: number, theme: GameTheme, upward: boolean, point: (u: number, v: number) => Point): Geometry {
|
|
62
|
-
const light = lightFor(theme);
|
|
63
|
-
const n = normalize(light.direction);
|
|
64
|
-
const illumination = light.ambient * (0.6 + 0.4 * (n[1] * 0.5 + 0.5)) + 1 - light.ambient;
|
|
65
|
-
const lc = light.color ?? [1, 1, 1];
|
|
66
|
-
const vertices = new Float32Array((rows + 1) * (columns + 1) * 11);
|
|
67
|
-
const indices = new Uint32Array(rows * columns * 6);
|
|
68
|
-
let vi = 0,
|
|
69
|
-
ti = 0;
|
|
70
|
-
for (let row = 0; row <= rows; row++)
|
|
71
|
-
for (let column = 0; column <= columns; column++) {
|
|
72
|
-
const { position: p, color: c } = point(column / columns, row / rows);
|
|
73
|
-
vertices.set(
|
|
74
|
-
[p[0], p[1], p[2], n[0], n[1], n[2], c[0] / (illumination * lc[0]), c[1] / (illumination * lc[1]), c[2] / (illumination * lc[2]), 0, 0],
|
|
75
|
-
vi
|
|
76
|
-
);
|
|
77
|
-
vi += 11;
|
|
78
|
-
if (row === rows || column === columns) continue;
|
|
79
|
-
const a = row * (columns + 1) + column,
|
|
80
|
-
b = a + columns + 1;
|
|
81
|
-
indices.set(upward ? [a, a + 1, b, a + 1, b + 1, b] : [a, b, a + 1, a + 1, b, b + 1], ti);
|
|
82
|
-
ti += 6;
|
|
83
|
-
}
|
|
84
|
-
return { vertices, indices };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function skyMesh(theme: GameTheme): Model {
|
|
88
|
-
return cacheGameAsset('chameleon-run/ChameleonRunBackdrop:skyMesh' + JSON.stringify([theme]), () => skyMeshUncached(theme));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function skyMeshUncached(theme: GameTheme): Model {
|
|
92
|
-
const key = `sky-${theme.mode === 'dark' ? 'night' : 'day'}`;
|
|
93
|
-
let mesh = meshes.get(key);
|
|
94
|
-
if (mesh) return mesh;
|
|
95
|
-
const dark = theme.mode === 'dark';
|
|
96
|
-
const horizon: RGB = dark ? [0.12, 0.17, 0.24] : [0.76, 0.82, 0.85];
|
|
97
|
-
const zenith: RGB = dark ? [0.018, 0.035, 0.075] : [0.25, 0.43, 0.65];
|
|
98
|
-
mesh = createShape(
|
|
99
|
-
surface(48, 96, theme, false, (u, v) => {
|
|
100
|
-
const azimuth = (u - 0.5) * 3.2,
|
|
101
|
-
elevation = 0.95 - v * 1.8;
|
|
102
|
-
let color = mix(horizon, zenith, smooth(-0.04, 0.82, elevation));
|
|
103
|
-
// Thin, irregular cloud veils. Their shading is part of the sky, not large puff objects.
|
|
104
|
-
const cloudBand = smooth(0.08, 0.23, elevation) * (1 - smooth(0.56, 0.76, elevation));
|
|
105
|
-
const streak = smooth(0.52, 0.82, fbm(azimuth * 2 + elevation * 3, elevation * 33));
|
|
106
|
-
color = mix(color, dark ? [0.22, 0.28, 0.36] : [0.91, 0.92, 0.91], streak * cloudBand * 0.5);
|
|
107
|
-
const warmth = Math.exp(-((azimuth + 0.6) ** 2 / 0.5 + (elevation - 0.18) ** 2 / 0.04));
|
|
108
|
-
if (!dark) color = mix(color, [0.93, 0.87, 0.73], warmth * 0.12);
|
|
109
|
-
const radius = 430,
|
|
110
|
-
horizontal = radius * Math.cos(elevation);
|
|
111
|
-
return { position: [Math.sin(azimuth) * horizontal, Math.sin(elevation) * radius, -Math.cos(azimuth) * horizontal], color };
|
|
112
|
-
}),
|
|
113
|
-
{ center: false, shine: 0 }
|
|
114
|
-
);
|
|
115
|
-
meshes.set(key, mesh);
|
|
116
|
-
return mesh;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function terrainMesh(theme: GameTheme): Model {
|
|
120
|
-
return cacheGameAsset('chameleon-run/ChameleonRunBackdrop:terrainMesh' + JSON.stringify([theme]), () => terrainMeshUncached(theme));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function terrainMeshUncached(theme: GameTheme): Model {
|
|
124
|
-
const key = `terrain-${theme.mode === 'dark' ? 'night' : 'day'}`;
|
|
125
|
-
let mesh = meshes.get(key);
|
|
126
|
-
if (mesh) return mesh;
|
|
127
|
-
const dark = theme.mode === 'dark';
|
|
128
|
-
const light = lightFor(theme),
|
|
129
|
-
sun = normalize(light.direction),
|
|
130
|
-
lc = light.color ?? [1, 1, 1];
|
|
131
|
-
const haze: RGB = dark ? [0.1, 0.145, 0.21] : [0.65, 0.74, 0.8];
|
|
132
|
-
mesh = createShape(
|
|
133
|
-
surface(96, 128, theme, true, (u, v) => {
|
|
134
|
-
const distance = 8 + v ** 1.3 * 400;
|
|
135
|
-
const x = (u - 0.5) * 2 * (72 + distance * 0.95),
|
|
136
|
-
z = -distance;
|
|
137
|
-
const y = heightAt(x, z);
|
|
138
|
-
const delta = 0.4;
|
|
139
|
-
const normal = normalize([
|
|
140
|
-
-(heightAt(x + delta, z) - heightAt(x - delta, z)) / (2 * delta),
|
|
141
|
-
1,
|
|
142
|
-
-(heightAt(x, z + delta) - heightAt(x, z - delta)) / (2 * delta)
|
|
143
|
-
]);
|
|
144
|
-
const slope = 1 - normal[1];
|
|
145
|
-
const mineral = fbm(x * 0.15, z * 0.13);
|
|
146
|
-
const strata = Math.sin(y * 2.4 + noise(x * 0.09, z * 0.07) * 8) * 0.5 + 0.5;
|
|
147
|
-
let rock = mix([0.34, 0.36, 0.35], [0.56, 0.53, 0.47], mineral * 0.7 + strata * 0.15);
|
|
148
|
-
const vegetation = (1 - smooth(0.15, 0.55, slope)) * (1 - smooth(10, 45, y));
|
|
149
|
-
rock = mix(rock, mix([0.18, 0.28, 0.22], [0.38, 0.43, 0.28], noise(x * 0.23, z * 0.19)), vegetation * 0.8);
|
|
150
|
-
const snow = smooth(34, 67, y + (mineral - 0.5) * 12) * (1 - smooth(0.28, 0.68, slope));
|
|
151
|
-
rock = mix(rock, [0.84, 0.86, 0.86], snow);
|
|
152
|
-
const diffuse = Math.max(0, normal[0] * sun[0] + normal[1] * sun[1] + normal[2] * sun[2]);
|
|
153
|
-
const brightness = light.ambient * (0.6 + 0.4 * (normal[1] * 0.5 + 0.5)) + (1 - light.ambient) * diffuse;
|
|
154
|
-
let color: RGB = [rock[0] * brightness * lc[0], rock[1] * brightness * lc[1], rock[2] * brightness * lc[2]];
|
|
155
|
-
if (dark) color = [color[0] * 0.31, color[1] * 0.39, color[2] * 0.55];
|
|
156
|
-
const air = 1 - Math.exp(-((distance / 280) ** 1.5));
|
|
157
|
-
color = mix(color, haze, air * 0.88);
|
|
158
|
-
return { position: [x, y, z], color };
|
|
159
|
-
}),
|
|
160
|
-
{ center: false, shine: 0 }
|
|
161
|
-
);
|
|
162
|
-
meshes.set(key, mesh);
|
|
163
|
-
return mesh;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export interface Backdrop {
|
|
167
|
-
root: Entity;
|
|
168
|
-
alive: boolean;
|
|
169
|
-
}
|
|
170
|
-
export function spawnBackdrop(world: World, theme: GameTheme): Backdrop {
|
|
171
|
-
const root = world.spawn({ mesh: 'none', pickable: false });
|
|
172
|
-
world.spawn({ mesh: skyMesh(theme), parent: root, position: [0, 3.1, 5.4], pickable: false });
|
|
173
|
-
world.spawn({ mesh: terrainMesh(theme), parent: root, pickable: false });
|
|
174
|
-
return { root, alive: true };
|
|
175
|
-
}
|
|
176
|
-
export function removeBackdrop(world: World, backdrop: Backdrop) {
|
|
177
|
-
if (!backdrop.alive) return;
|
|
178
|
-
backdrop.alive = false;
|
|
179
|
-
world.despawn(backdrop.root);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/** Landscape models depend only on the theme, not a running game. */
|
|
183
|
-
export function* warmAssets(theme: GameTheme): Iterable<() => unknown> {
|
|
184
|
-
yield () => skyMesh(theme);
|
|
185
|
-
yield () => terrainMesh(theme);
|
|
186
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Metres and seconds: gameplay is independent of screen size and camera projection.
|
|
2
|
-
/** Match Penguin Run: a fixed-distance run at a steady pace, with three lives. */
|
|
3
|
-
export const TRACK_LENGTH = 500;
|
|
4
|
-
export const MAX_LIVES = 3;
|
|
5
|
-
export const HURT_INVULNERABLE = 2.2;
|
|
6
|
-
export const RESULTS_DELAY_LOSE = 1700;
|
|
7
|
-
export const RESULTS_DELAY_WIN = 2600;
|
|
8
|
-
export const POINTS_PER_METRE = 1;
|
|
9
|
-
export const DRAG_THRESHOLD = 18;
|
|
10
|
-
export const STEP_SECONDS = 1 / 60;
|
|
11
|
-
export const MAX_FRAME_SECONDS = 0.05;
|
|
12
|
-
export const SCORE_SYNC = 0.1;
|
|
13
|
-
export const STAR_POINTS = 250;
|
|
14
|
-
export const MAX_JUMPS = 2;
|
|
15
|
-
export const JUMP_BUFFER = 0.12;
|
|
16
|
-
export const COYOTE_TIME = 0.1;
|
|
17
|
-
export const COLOR_GRACE = 0.12;
|
|
18
|
-
export const BASE_SPEED = 7;
|
|
19
|
-
|
|
20
|
-
export type RunColor = 'yellow' | 'pink';
|
|
21
|
-
export const RUN_COLORS = { yellow: '#FFD447', pink: '#F653A6' } as const;
|
|
22
|
-
export const COLOR_NAMES = { yellow: 'YELLOW · STRIPES', pink: 'PINK · DOTS' } as const;
|
|
23
|
-
|
|
24
|
-
export interface Config {
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
trackWidth: number;
|
|
28
|
-
lookAhead: number;
|
|
29
|
-
gravity: number;
|
|
30
|
-
jump: number;
|
|
31
|
-
doubleJump: number;
|
|
32
|
-
fallY: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function configFor(width: number, height: number): Config {
|
|
36
|
-
return { width, height, trackWidth: 3.8, lookAhead: 85, gravity: 19, jump: 7.8, doubleJump: 7, fallY: -7 };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const COLORS = {
|
|
40
|
-
STONE: '#496578',
|
|
41
|
-
STONE_DARK: '#304556',
|
|
42
|
-
NEUTRAL: '#D6E9EC',
|
|
43
|
-
STAR: '#FFF09A',
|
|
44
|
-
BELLY: '#FFF5DC',
|
|
45
|
-
EYE: '#16243A',
|
|
46
|
-
RIM: '#F5FCFF'
|
|
47
|
-
} as const;
|