@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 +1 @@
|
|
|
1
|
-
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./ArrowsConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./ArrowsGame.js";import{jsx as
|
|
1
|
+
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./ArrowsConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./ArrowsGame.js";import{jsx as _0x153284}from"react/jsx-runtime";const SFX=GAME_SOUNDS.ARROWS;export const Arrows=engineGame(GAME_IDS.ARROWS,e=>{const[t,r]=useLiveState(0),[s,o]=useLiveState(null),[a,i]=useLiveState(TIME_LIMIT),{game:n,theme:m,status:S,screen:u,gameOver:p}=useEngineGame(e,{gameId:GAME_IDS.ARROWS,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,s)=>{const o=getLayout(t,r,s);return setLayout(e,o),o.boardWidth},tap:tap,sounds:SFX,onStart:e=>e(SFX.START,HapticType.MEDIUM),wire:(e,t)=>{e.onScore=r,e.onTime=i,e.onRemaining=o,e.onClear=()=>t(SFX.CLEAR,HapticType.LIGHT),e.onBlocked=()=>t(SFX.BLOCKED,HapticType.WARNING),e.onWin=()=>t(SFX.WIN,HapticType.SUCCESS),e.onLose=()=>t(SFX.GAME_OVER,HapticType.HEAVY)}});return _0x153284(EngineGameScreen,{...u,light:LIGHT,columns:[scoreColumn(t),textColumn("ARROWS",s??n.remaining),timerColumn(a,m)],subtext:"Clear all the arrows!",gameOver:p({title:"win"===S?"CLEARED!":"TIME UP!",message:"win"===S?"You cleared all the arrows!":"You ran out of time!",scoreLabel:"Score",score:t,buttonText:"win"===S?"Play Again!":"Try Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{extrude,Path,quat,tube}from"@nayan-ui/engine";import{spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{extrude,Path,quat,tube}from"@nayan-ui/engine";import{spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x5ee781}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{ARROW_COLOR,BLOCK_SHAKE,BLOCK_TIME,BLOCKED_COLOR,BLOCKER_COLOR,BLOCKER_TIME,cellCenter,COMPLETION_SCALE,COMPLETION_SPRING,DOT_DELAY,DOT_SPRING,DRAW_IN_STAGGER,DRAW_IN_TIME,EMPTY_DOT_COLOR,ENTRANCE_TIME,FLY_COLOR,tipDistance}from"./ArrowsConstants.js";const Z_BACKDROP=-20,Z_DOTS=.5,HIDDEN=0,toWorld=(e,t,a,o=0)=>[t-e.width/2,e.height/2-a,o],local=(e,[t,a],o)=>[t-e.boardWidth/2,e.boardHeight/2-a,o],arrowZ=e=>e.stroke,flyingZ=e=>3*e.stroke+e.headHalfWidth,meshes=new Map,mesh=(e,t)=>{let a=meshes.get(e);return!a&&(a=cacheGameAsset("arrows/ArrowsScene:"+e,t),meshes.set(e,a)),a},barMesh=()=>mesh("arrow-bar",()=>_0x5ee781(tube([[-.5,0,0],[.5,0,0]],{radius:.5,sides:12,smoothness:1,caps:!1}))),headMesh=()=>mesh("arrow-head",()=>_0x5ee781(tube([[0,0,0],[1,0,0]],{radius:e=>.5*(1-e),sides:16,smoothness:4}))),discMesh=()=>mesh("disc",()=>_0x5ee781(extrude((new Path).addCircle(0,0,.5),{depth:0})));export const arrowColor=e=>toColor("classic"===e.mode?ARROW_COLOR:e.TEXT);const FLY=toColor(FLY_COLOR),BLOCKED=toColor(BLOCKED_COLOR),BLOCKER=toColor(BLOCKER_COLOR),DOT=toColor(EMPTY_DOT_COLOR),withAlpha=(e,t)=>[e[0],e[1],e[2],t],EXIT_X=[0,1,0,-1],EXIT_Y=[-1,0,1,0],exitVector=e=>[EXIT_X[e],EXIT_Y[e]],ANGLES=[Math.PI/2,0,-Math.PI/2,Math.PI],VERTICAL=quat.z(Math.PI/2),HORIZONTAL=quat.z(0);function corners(e){const t=[e[0]];for(let a=1;a<e.length;a++){const o=e[a],s=t[t.length-1];if(o[0]===s[0]&&o[1]===s[1])continue;const n=t[t.length-2];n&&(s[0]-n[0])*(o[1]-s[1])-(s[1]-n[1])*(o[0]-s[0])===0?t[t.length-1]=o:t.push(o)}return t}const segmentLength=(e,t)=>Math.abs(t[0]-e[0])+Math.abs(t[1]-e[1]);function placeBar(e,t,a,o,s,n,r){const i=segmentLength(o,s);i<.01?e.set(a,{scale:0}):e.set(a,{position:local(t,[(o[0]+s[0])/2,(o[1]+s[1])/2],r),rotation:o[0]===s[0]?VERTICAL:HORIZONTAL,scale:[i,n,n]})}function arrowLine(e,t){const a=t.waypoints.map(t=>cellCenter(e,t.row,t.col)),o=a[a.length-1],[s,n]=exitVector(t.exitDir),r=tipDistance(e),i=[o[0]+s*(r-e.headLength),o[1]+n*(r-e.headLength)],l=[o[0]+s*(r-e.headLength/2),o[1]+n*(r-e.headLength/2)];return{centers:a,points:corners([...a,i]),head:l}}const headScale=e=>[e.headLength,2*e.headHalfWidth,2*e.headHalfWidth];export function buildScenery(e,t,a,o){const s=e.spawn({mesh:"none",position:toWorld(t,t.boardLeft+t.boardWidth/2,t.boardTop+t.boardHeight/2),scale:o?.94:1,pickable:!1});return o&&e.animate(s,{scale:1},{duration:ENTRANCE_TIME}),{backdrop:spawnBackdrop(e,t.width,t.height,-20,a),board:s}}export function pulseBoard(e,t){e.animate(t,{scale:COMPLETION_SCALE},{duration:.2}).then(()=>{e.animate(t,{scale:1},{spring:COMPLETION_SPRING})})}export function spawnArrow(e,t,a,o,s,n){const{points:r,head:i}=arrowLine(t,o),l=arrowZ(t),h=t.stroke,p=e.spawn({mesh:"none",parent:a,position:[0,0,0],pickable:!1}),d=[],L=r.reduce((e,t,a)=>a?e+segmentLength(r[a-1],t):0,0)||1,u=DRAW_IN_TIME*(1-DRAW_IN_STAGGER);let g=0;r.forEach((a,o)=>{const i=null===n?0:n+g/L*u,O=e.spawn({mesh:"sphere",parent:p,position:local(t,a,l),scale:null===n?h:0,color:s,pickable:!1});null!==n&&e.animate(O,{scale:h},{duration:.04,delay:i,easing:"linear"}),d.push(O);const m=r[o+1];if(!m)return;const E=segmentLength(a,m),C=e.spawn({mesh:barMesh(),parent:p,color:s,pickable:!1});null===n?placeBar(e,t,C,a,m,h,l):(e.set(C,{position:local(t,a,l),rotation:a[0]===m[0]?VERTICAL:HORIZONTAL,scale:[.001,h,h]}),e.animate(C,{position:local(t,[(a[0]+m[0])/2,(a[1]+m[1])/2],l),scale:[E,h,h]},{duration:E/L*u,delay:i,easing:"linear"})),d.push(C),g+=E});const O=e.spawn({mesh:headMesh(),parent:p,position:local(t,i,l),rotation:quat.z(ANGLES[o.exitDir]),scale:null===n?headScale(t):0,color:s,pickable:!1});return null!==n&&e.animate(O,{scale:headScale(t)},{duration:.25*u,delay:n+.75*u}),d.push(O),{root:p,parts:d}}export function setArrowColor(e,t,a){for(const o of t.parts)e.set(o,{color:a})}export function flashBlocked(e,t,a){e.animate(t.root,{shake:BLOCK_SHAKE},{duration:BLOCK_TIME,easing:"linear"});for(const o of t.parts)e.set(o,{color:BLOCKED}),e.animate(o,{color:a},{duration:.4*BLOCK_TIME,delay:.6*BLOCK_TIME,easing:"linear"})}export function pulseBlocker(e,t,a){for(const o of t.parts)e.animate(o,[{color:BLOCKER,at:.5},{color:a}],{duration:BLOCKER_TIME,easing:"easeInOut"})}export function spawnFlight(e,t,a,o){const{centers:s}=arrowLine(t,o),n=s[s.length-1],[r,i]=exitVector(o.exitDir),l=t.boardWidth+t.boardHeight+t.width+t.height,h=corners([...s,[n[0]+r*l,n[1]+i*l]]),p=[0];for(let e=1;e<h.length;e++)p.push(p[e-1]+segmentLength(h[e-1],h[e]));const d=h[h.length-2],L=p[h.length-2],u=tipDistance(t),g=L+segmentLength(d,n)+u-t.headLength,O=[d[1],t.boardWidth-d[0],t.boardHeight-d[1],d[0]][o.exitDir],m=[t.boardTop,t.width-t.boardLeft-t.boardWidth,t.height-t.boardTop-t.boardHeight,t.boardLeft][o.exitDir],E=1===o.exitDir||3===o.exitDir,C=Math.max(m,4*t.stride,E?.4*t.width:0),f=e.spawn({mesh:"none",parent:a,position:[0,0,0],pickable:!1}),_=(t,a=FLY)=>e.spawn({mesh:t,parent:f,scale:0,color:a,pickable:!1}),T={root:f,bars:h.slice(1).map(()=>_(barMesh())),outside:_(barMesh()),joints:h.map(()=>_("sphere")),head:e.spawn({mesh:headMesh(),parent:f,rotation:quat.z(ANGLES[o.exitDir]),scale:headScale(t),color:FLY,pickable:!1}),points:h,arcs:p,shaft:g,edge:L+O,fade:C,far:l-u,elapsed:0};return placeFlight(e,t,T,0),T}function pointAt(e,t){let a=0;for(;a<e.arcs.length-2&&e.arcs[a+1]<t;)a++;const o=e.points[a],s=e.points[a+1],n=(t-e.arcs[a])/(e.arcs[a+1]-e.arcs[a]);return[o[0]+(s[0]-o[0])*n,o[1]+(s[1]-o[1])*n]}export function stepFlight(e,t,a,o,s){if(a.elapsed+=o,a.elapsed>=s)return e.despawn(a.root),!1;const n=a.elapsed/s;return placeFlight(e,t,a,n*n*a.far),!0}function placeFlight(e,t,a,o){const s=flyingZ(t),n=t.stroke+1,r=o,i=o+a.shaft,l=e=>1-Math.max(0,Math.min(1,(e-a.edge)/a.fade)),h=a.bars.length-1;a.bars.forEach((o,l)=>{const p=Math.max(a.arcs[l],r),d=Math.min(l===h?a.edge:a.arcs[l+1],i);d<=p?e.set(o,{scale:0}):placeBar(e,t,o,pointAt(a,p),pointAt(a,d),n,s)});const p=Math.max(a.edge,r);i<=p?e.set(a.outside,{scale:0}):(placeBar(e,t,a.outside,pointAt(a,p),pointAt(a,i),n,s),e.set(a.outside,{color:withAlpha(FLY,l((p+i)/2))}));const d=a.joints.length-1;a.joints.forEach((o,h)=>{const p=0===h?r:h===d?i:a.arcs[h];p<r||p>i?e.set(o,{scale:0}):e.set(o,{position:local(t,pointAt(a,p),s),scale:n,color:withAlpha(FLY,l(p))})});const L=i+t.headLength/2;e.set(a.head,{position:local(t,pointAt(a,L),s),color:withAlpha(FLY,l(L))})}export function spawnDot(e,t,a,o,s){const n=e.spawn({mesh:discMesh(),parent:a,position:local(t,cellCenter(t,o,s),.5),scale:0,color:DOT,pickable:!1});return e.animate(n,{scale:2*t.dotRadius},{spring:DOT_SPRING,delay:DOT_DELAY}),n}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,timerColumn}from"../shared/EngineHud.js";import{backgroundFor,lightFor}from"../shared/EngineMeadow.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,MAX_LIVES,TIME_LIMIT}from"./BalloonBlasterConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tick,touch}from"./BalloonBlasterGame.js";import{jsx as
|
|
1
|
+
"use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,timerColumn}from"../shared/EngineHud.js";import{backgroundFor,lightFor}from"../shared/EngineMeadow.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,MAX_LIVES,TIME_LIMIT}from"./BalloonBlasterConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tick,touch}from"./BalloonBlasterGame.js";import{jsx as _0x14ccb5}from"react/jsx-runtime";const SFX=GAME_SOUNDS.BALLOON_BLASTER;export const BalloonBlaster=engineGame(GAME_IDS.BALLOON_BLASTER,e=>{const[o,t]=useLiveState(0),[s,r]=useLiveState(MAX_LIVES),[i,a]=useLiveState(TIME_LIMIT),{theme:n,status:m,screen:u,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.BALLOON_BLASTER,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,o,t)=>setLayout(e,getLayout(o,t)),drag:(e,{phase:o,x:t,y:s})=>{"start"===o&&touch(e,t,s)},sounds:SFX,onStart:e=>e(SFX.START),wire:(e,o)=>{e.onScore=t,e.onLives=r,e.onTime=a,e.onPop=()=>o(SFX.POP,HapticType.LIGHT),e.onBomb=()=>o(SFX.BOMB,HapticType.HEAVY),e.onWin=()=>o(GAME_SOUNDS.WELL_DONE),e.onLose=()=>o(SFX.GAME_OVER)}}),p=useMemo(()=>lightFor(n),[n]),E=useMemo(()=>backgroundFor(n),[n]);return _0x14ccb5(EngineGameScreen,{...u,light:p,background:E,columns:[scoreColumn(o),livesColumn(s,MAX_LIVES),timerColumn(i,n)],subtext:"Pop balloons to score!",gameOver:S({title:"win"===m?"TIME UP!":"GAME OVER",message:"win"===m?"Great popping!":"You ran out of lives!",scoreLabel:"Final Score",score:o,buttonText:"Pop Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,lathe,merge,Path,quat,tube}from"@nayan-ui/engine";import{lighten}from"../../services/GamesConstants.js";import{at,facing,pointSize}from"../shared/EngineMeadow.js";import{createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,lathe,merge,Path,quat,tube}from"@nayan-ui/engine";import{lighten}from"../../services/GamesConstants.js";import{at,facing,pointSize}from"../shared/EngineMeadow.js";import{createGameMesh as _0x46df81}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{BALLOON_COLORS,FRAME_TIME,POP_SWELL,POP_TIME,RAINBOW}from"./BalloonBlasterConstants.js";const PER_SECOND=1/FRAME_TIME,PROFILE=[[.001,-.6],[.07,-.57],[.17,-.5],[.3,-.36],[.42,-.17],[.49,.03],[.5,.18],[.47,.34],[.39,.48],[.26,.58],[.12,.622],[.001,.625]],KNOT=[[.001,-.68],[.06,-.66],[.045,-.62],[.02,-.59],[.001,-.585]];let meshes;export function balloonMeshes(){return meshes??={body:_0x46df81(merge([{geometry:lathe(PROFILE,{segments:28})},{geometry:lathe(KNOT,{segments:10})}]),{center:!1,shine:.75}),rainbow:_0x46df81(merge([{geometry:lathe(PROFILE,{segments:28,color:({v:e})=>{const o=toColor(RAINBOW[Math.min(RAINBOW.length-1,Math.floor(e*RAINBOW.length))]);return[o[0],o[1],o[2]]}})},{geometry:lathe(KNOT,{segments:10}),color:toColor(RAINBOW[0])}]),{center:!1,shine:.75}),string:_0x46df81(tube([[0,-.66,0],[.035,-.8,.01],[-.03,-.95,-.01],[.02,-1.08,0],[0,-1.16,0]],{radius:.008,sides:5,smoothness:4,color:[.92,.92,.9]}),{center:!1}),danger:_0x46df81(merge([{geometry:extrude((new Path).addCircle(0,0,.5),{depth:.04,color:[.95,.08,.08]})},{geometry:extrude((new Path).addRoundedRect(-.07,-.3,.14,.38,.06),{depth:.02,color:[1,1,1]}),position:[0,0,.03]},{geometry:extrude((new Path).addCircle(0,.24,.075),{depth:.02,color:[1,1,1]}),position:[0,0,.03]}]),{center:!1,shine:.3})},meshes}const colorOf=e=>toColor(e),BOMB=[.07,.07,.08,1],sparkOf=e=>{const[o,t,n]=e;return[Math.min(1,o+.35),Math.min(1,t+.35),Math.min(1,n+.35)]},BALLOON_SPARKS=new Map(BALLOON_COLORS.map(e=>[e,sparkOf(toColor(e))])),LIFE_SPARKS=[...RAINBOW,"#FFFFFF"].map(e=>toColor(e)),BOMB_BURST=["#1f2937","#374151","#f97316","#fde047"].map(e=>toColor(e)),ORANGE=toColor(lighten("#f97316",.2)),depthOf=(e,o)=>e.playDepth-("bomb"===o.kind?.08:0);export function spawnBalloon(e,o,t,n,s,a,i){const r=balloonMeshes(),l=t.size*pointSize(o,depthOf(o,n)),p=e.spawn({mesh:"none",position:at(o,s,a,depthOf(o,n)),rotation:facing(o,-.1),pickable:!1});e.animate(p,{rotation:facing(o,.1)},{duration:1.6+30*Math.abs(i),easing:"easeInOut",repeat:"forever",yoyo:!0});const m=(o,t,n=[0,0,0],s=l)=>e.spawn({mesh:o,parent:p,position:n,scale:s,color:t,pickable:!1});"life"===n.kind?m(r.rainbow,[1,1,1,1]):m(r.body,"balloon"===n.kind?colorOf(n.color):BOMB);const d=e.spawn({mesh:r.string,parent:p,scale:l,color:[1,1,1,1],rotation:quat.z(-.12),pickable:!1});return e.animate(d,{rotation:quat.z(.12)},{duration:1.1+.6*Math.random(),easing:"easeInOut",repeat:"forever",yoyo:!0}),"bomb"===n.kind&&m(r.danger,[1,1,1,1],[0,.05*l,.47*l],.34*l),p}export function placeBalloon(e,o,t,n,s,a,i){const r=at(o,s,a,depthOf(o,n));i?i.position(t,r[0],r[1],r[2]):e.set(t,{position:r})}export function popBalloon(e,o,t,n,s,a,i){const r=pointSize(o),l=t.size*r,p=at(o,a,i,depthOf(o,s)-.6*l);e.stopAnimation(n),e.set(n,{spin:[0,0,0]}),e.animate(n,[{scale:POP_SWELL,at:.3},{scale:0}],{duration:POP_TIME,easing:"linear"}).then(()=>e.despawn(n));const m=.12*PER_SECOND*PER_SECOND*r;if("bomb"===s.kind){effects.explosion(e,{position:p,count:16,size:.7*l,speed:2.6*l,lifetime:.6,gravity:.5*-m,debris:BOMB_BURST,smoke:[.35,.35,.38,.7],flash:!1});const o=e.spawn({mesh:"puff",position:p,scale:1.2*l,color:[2*ORANGE[0],2*ORANGE[1],2*ORANGE[2],.9],pickable:!1});return void e.animate(o,{scale:3.6*l,color:[2,.9,.2,0]},{duration:.35}).then(()=>e.despawn(o))}const d="life"===s.kind?LIFE_SPARKS:[colorOf(s.color),BALLOON_SPARKS.get(s.color)];"life"===s.kind?effects.sparkle(e,{position:p,count:18,size:.08*l,speed:5.5*l,lifetime:.6,gravity:.5*-m,colors:d}):effects.shatter(e,{position:p,count:10,mesh:"cube",size:.11*l,speed:5.5*l,lifetime:.6,gravity:-m,colors:d,dust:!1})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{block,ellipsoid,lathe,loft,merge,quat,smoothCurve,tube}from"@nayan-ui/engine";import{AXLE_X,wheel}from"../car-racing/CarMeshes.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{block,ellipsoid,lathe,loft,merge,quat,smoothCurve,tube}from"@nayan-ui/engine";import{AXLE_X,wheel}from"../car-racing/CarMeshes.js";import{cacheGameAsset,createGameMesh as _0x5b0fc9}from"../shared/EngineMeshes.js";const TAU=2*Math.PI,SMOKED=[.05,.065,.09],BLACK=[.02,.02,.022],SATIN=[.07,.07,.08],CARBON=[.055,.055,.065],ALUMINIUM=[.68,.7,.73],CHROME=[.82,.83,.86],GOLD=[.86,.62,.16],STEEL=[.55,.56,.58],TITANIUM=[.52,.54,.58],HEADLIGHT=[.95,.97,1],DRL=[1.4,1.4,1.45],TAIL_LIGHT=[.85,.04,.04],AMBER=[1,.55,.08],PLATE=[.9,.9,.88],SPRING=[.95,.75,.1],BURNT=[.3,.26,.3],WHEEL_R=.3,FRONT=-.72,REAR=.72,FAIRING=[{z:-.99,bottom:.64,top:.72,width:.04,square:2.4},{z:-.92,bottom:.6,top:.8,width:.15,square:2.8},{z:-.8,bottom:.63,top:.87,width:.22,square:3},{z:-.68,bottom:.66,top:.9,width:.26,square:3},{z:-.56,bottom:.6,top:.88,width:.27,square:3},{z:-.46,bottom:.47,top:.8,width:.26,square:3.2},{z:-.38,bottom:.26,top:.74,width:.25,square:3.4},{z:-.15,bottom:.21,top:.66,width:.22,square:3.4},{z:.04,bottom:.23,top:.62,width:.18,square:3.2},{z:.16,bottom:.32,top:.58,width:.12,square:3}],TANK=[{z:-.54,bottom:.78,top:.86,width:.1,square:3.4},{z:-.42,bottom:.72,top:.915,width:.16,square:3.6},{z:-.22,bottom:.68,top:.915,width:.17,square:3.6},{z:-.04,bottom:.68,top:.87,width:.13,square:3.4},{z:.1,bottom:.72,top:.83,width:.1,square:3}],TAIL=[{z:.02,bottom:.5,top:.79,width:.15,square:3.4},{z:.2,bottom:.56,top:.82,width:.145,square:3.4},{z:.4,bottom:.68,top:.85,width:.125,square:3.2},{z:.6,bottom:.77,top:.89,width:.1,square:3.2},{z:.85,bottom:.84,top:.925,width:.06,square:3},{z:.985,bottom:.875,top:.92,width:.02,square:2.6}],rod=(o,t,e,s,r=10)=>({geometry:tube([o,t],{radius:e,sides:r,smoothness:1}),color:s}),arc=(o,t,e,s,r,i,a=8)=>Array.from({length:a+1},(n,m)=>{const h=r+(i-r)*m/a;return[o,t+Math.sin(h)*s,e-Math.cos(h)*s]}),disc=(o,t=GOLD)=>lathe([[.001,.004],[o,.004],[o,-.004],[.001,-.004]],{segments:36,color:({u:e,position:[s,,r]})=>{const i=Math.hypot(s,r);return i<.55*o?Math.cos(e*TAU*6)>.3?t:BLACK:Math.cos(e*TAU*20)>.85&&i>.66*o&&i<.92*o?BLACK:STEEL}});export const BIKE_FOOTPRINT={length:2.04,halfWidth:smoothCurve([[-1.02,.06],[-.9,.15],[-.7,.26],[-.47,.34],[-.3,.28],[-.06,.3],[.13,.28],[.4,.17],[.7,.12],[1.02,.08]])};let bike=null;export function bikeMeshes(){return cacheGameAsset("bike-racing/BikeMeshes:bikeMeshes",()=>bikeMeshesUncached())}function bikeMeshesUncached(){if(bike)return bike;const o=_0x5b0fc9(merge([{geometry:loft(FAIRING,{around:40,smoothness:5})},{geometry:loft(TANK,{around:32,smoothness:4})},{geometry:loft(TAIL,{around:28,smoothness:4})}]),{center:!1,shine:.9}),t=_0x5b0fc9(merge([{geometry:ellipsoid([.17,.2,.016],SMOKED,24),position:[0,.93,-.66],rotation:quat.x(.95)}]),{center:!1,shine:.95}),e={rim:.74,spokes:5,rimColor:SATIN,spokeColor:SATIN,gapColor:BLACK},s=[{geometry:wheel(.3,.12,e),position:[0,.3,-.72],rotation:AXLE_X},{geometry:wheel(.3,.19,e),position:[0,.3,.72],rotation:AXLE_X},{geometry:disc(.15,STEEL),position:[.105,.3,.72],rotation:AXLE_X},{geometry:disc(.1,BLACK),position:[-.11,.3,.72],rotation:AXLE_X},{geometry:block(.07,.05,.04,6,BLACK),position:[0,.665,-.965]},{geometry:block(.18,.03,.12,6,ALUMINIUM),position:[0,.885,-.5]},{geometry:block(.26,.06,.4,5,BLACK),position:[0,.83,.25]},{geometry:block(.016,.26,.016,4,CARBON),position:[0,.7,.95]},{geometry:block(.16,.1,.012,6,PLATE),position:[0,.57,.96]},{geometry:block(.08,.025,.02,6,TAIL_LIGHT),position:[0,.895,.975]},{geometry:tube([[0,.42,.2],[0,.68,.12]],{radius:.038,sides:12,smoothness:1,color:({v:o})=>Math.sin(o*TAU*9)>0?SPRING:BLACK})},{geometry:tube(arc(0,.3,-.72,.335,.55,2.3,8),{radius:.06,shape:o=>.25+.75*Math.abs(Math.cos(o*TAU)),sides:12,smoothness:3}),color:CARBON},{geometry:tube(arc(0,.3,.72,.33,.6,1.6,6),{radius:.09,shape:o=>.22+.78*Math.abs(Math.cos(o*TAU)),sides:12,smoothness:3}),color:CARBON},rod([-.11,.37,.06],[-.11,.39,.72],.008,BLACK,6),rod([-.11,.25,.08],[-.11,.21,.72],.008,BLACK,6),{geometry:tube([[.05,.26,-.3],[.08,.25,0],[.12,.26,.2],[.16,.3,.34]],{radius:.025,sides:10,smoothness:4,color:BURNT})},{geometry:tube([[.16,.3,.34],[.185,.4,.52],[.2,.47,.66]],{radius:o=>.048+.008*o,sides:16,smoothness:3,color:TITANIUM,capColor:CARBON})}];for(const o of[-1,1])s.push({geometry:ellipsoid([.075,.016,.05],HEADLIGHT),position:[.07*o,.705,-.925],rotation:quat.y(.45*-o)},{geometry:block(.08,.008,.012,6,DRL),position:[.075*o,.726,-.915],rotation:quat.y(.45*-o)},rod([.085*o,.3,-.72],[.085*o,.56,-.62],.02,CHROME),rod([.085*o,.54,-.63],[.085*o,.9,-.48],.03,GOLD),{geometry:disc(.2),position:[.075*o,.3,-.72],rotation:AXLE_X},{geometry:block(.04,.13,.07,6,GOLD),position:[.11*o,.42,-.64],rotation:quat.x(.5)},...[.46,.52,.58].map(t=>({geometry:block(.012,.018,.16,6,BLACK),position:[.247*o,t,.5*(.52-t)-.33]})),{geometry:block(.03,.26,.24,5,ALUMINIUM),position:[.135*o,.5,.1],rotation:quat.x(-.25)},{geometry:tube([[.12*o,.42,.1],[.12*o,.37,.4],[.115*o,.3,.72]],{radius:.035,shape:o=>.6+.4*Math.abs(Math.sin(o*TAU)),sides:12,smoothness:3,color:ALUMINIUM})},rod([.08*o,.86,-.5],[.28*o,.79,-.47],.016,ALUMINIUM),rod([.27*o,.79,-.47],[.345*o,.785,-.465],.025,BLACK),rod([.14*o,.38,.12],[.27*o,.38,.12],.014,ALUMINIUM),{geometry:block(.01,.12,.09,6,ALUMINIUM),position:[.19*o,.42,.16]},rod([.2*o,.38,.1],[.21*o,.35,-.04],.008,ALUMINIUM,6),rod([.2*o,.84,-.7],[.26*o,.9,-.68],.01,BLACK),{geometry:ellipsoid([.055,.03,.03],BLACK),position:[.28*o,.91,-.68]},{geometry:ellipsoid([.02,.008,.01],AMBER),position:[.3*o,.905,-.7]},rod([0,.64,.95],[.1*o,.64,.95],.008,BLACK),{geometry:ellipsoid([.025,.012,.012],AMBER),position:[.11*o,.64,.95]});const r=_0x5b0fc9(merge(s),{center:!1,shine:.5});return bike={body:o,trim:r,glass:t},bike}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import _0xde77f3,{useCallback,useEffect,useRef,useState}from"react";import{haptics}from"@nayan-ui/engine";import{resolveGameTheme}from"../../services/ThemeService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,textColumn}from"../shared/EngineHud.js";import{GameLoading}from"../shared/GameLoading.js";import{GameLoadingTransition}from"../shared/GameLoadingTransition.js";import{useGameResource}from"../shared/useGameResource.js";import{AUTOPLAY,DAY_LIGHT,EDGE,getCachedAssets,LIVES,loadAssets,NIGHT_LIGHT,NIGHT_SKY,SKY,STEER_WIDTH,TRACK_LENGTH}from"./BikeRacingConstants.js";import{createGame,dispose,setAudible,setNight,start,steer,tick}from"./BikeRacingGame.js";import{jsx as _0x54edda}from"react/jsx-runtime";export{preloadBikeRacing}from"./BikeRacingConstants.js";const RESULTS_DELAY=1200,Run=_0xde77f3.memo(({assets:e,night:t,onRestart:s,settings:a,onSettingsChange:n,onEndGame:r,onReplayGame:o,onShare:i,onShareScreenshot:u,onShowLeaderboard:m,bannerAd:l})=>{const d=useRef(t),g=useGameResource(()=>createGame(e,d.current),e=>()=>{"playing"===e.phase&&b("cancel"),dispose(e)});useEffect(()=>{setNight(g,t)},[g,t]);const f=useRef(1),[S,G]=useState("ready"),[h,E]=useState(!1),[R,T]=useState(0),[p,A]=useState(LIVES),[C,I]=useState(TRACK_LENGTH),_=useRef(!1),L=useRef(r);L.current=r;const b=useCallback(e=>{L.current&&!_.current&&(_.current=!0,L.current({status:e,score:g.score.toString()}))},[g]);useEffect(()=>{haptics.enabled=a.enableHaptics},[a.enableHaptics]),useEffect(()=>{g.onPhase=G,g.onLives=A,g.onDistance=I,g.onScore=T},[g]),useEffect(()=>{if("over"!==S)return;b(g.lives>0?"win":"lose");const e=setTimeout(()=>E(!0),1200);return()=>clearTimeout(e)},[S,g,b]),useEffect(()=>{if(!AUTOPLAY||"playing"===S)return;const e=setTimeout("ready"===S?()=>start(g):s,"ready"===S?1500:3e3);return()=>clearTimeout(e)},[S,g,s]);const k=useCallback(e=>setAudible(g,e),[g]),H=useCallback(e=>tick(g,e),[g]),D=useCallback(({phase:e,dx:t})=>steer(g,e,t,2*EDGE/(STEER_WIDTH*f.current)),[g]),x=useCallback(()=>{_.current=!1,start(g)},[g]),N=useCallback(()=>{b("cancel"),s()},[b,s]),v=useCallback(()=>{o?.(),s()},[o,s]),j=p>0;return _0x54edda(EngineGameScreen,{onAudioChange:k,gameId:GAME_IDS.BIKE_RACING,settings:a,onSettingsChange:n,onShare:u??i,onShowLeaderboard:m,bannerAd:l,source:g.world,feedback:g.hudFeedback,camera:g.camera,light:t?NIGHT_LIGHT:DAY_LIGHT,background:t?NIGHT_SKY:SKY,fog:.0075,onUpdate:H,onDrag:D,onResize:e=>{f.current=e},columns:[scoreColumn(R),livesColumn(p,LIVES),textColumn("TRACK",C+" m")],playing:"playing"===S,subtext:"Dodge traffic to score!",onStart:x,onStop:N,gameOver:h?{title:j?"FINISHED!":"CRASHED!",message:j?"You crossed the finish line! Great riding!":"Out of lives "+(TRACK_LENGTH-C)+" m into the "+TRACK_LENGTH+" m race.",scoreLabel:"Final Score",score:R,buttonText:"Race Again!",onPlayAgain:v,onShare:u}:null})});Run.displayName="BikeRacingRun";export const BikeRacing=engineGame(GAME_IDS.BIKE_RACING,e=>{const t=e.settings,s=resolveGameTheme(t.theme),[a,n]=useState(0),[r,o]=useState(getCachedAssets),[i,u]=useState(null);useEffect(()=>{if(r)return;let e=!0;return loadAssets().then(t=>e&&o(t)).catch(t=>e&&u(t.message)),()=>{e=!1}},[r]);const m=useCallback(()=>n(e=>e+1),[]),l=s.isDark;return _0x54edda(GameLoadingTransition,{ready:!!r,loader:_0x54edda(GameLoading,{gameId:GAME_IDS.BIKE_RACING,theme:t.theme,offset:t.offset,error:!!i,message:i??void 0}),children:r&&_0x54edda(Run,{...e,settings:t,assets:r,night:l,onRestart:m},a)})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{loadAssets as
|
|
1
|
+
"use strict";import{loadAssets as _0x187920}from"../car-racing/CarRacingConstants.js";import{bikeMeshes}from"./BikeMeshes.js";export{AUTOPLAY,CAMERA_FOV,DAY_LIGHT,EDGE,FINISH_CLEAR,LANES,LATERAL_SPEED,NIGHT_LIGHT,NIGHT_SKY,ROAD_HALF,SKY,STEER_RESPONSE,STEER_WIDTH,TRACK_LENGTH,getRacingSounds}from"../car-racing/CarRacingConstants.js";export const LIVES=3;export const POINTS_PER_BIKE_PASSED=500;export const START_SPEED=30;export const TRAFFIC_SPEED=16;export const SPAWN_AHEAD=170;export const CRASH_SLOWDOWN=.5;export const INVULNERABLE=1.6;export const NEAR_MISS_GAP=1.3;export const LEAN=.045;export const MAX_LEAN=.5;export const PLAYER_PAINT=[1,.4,0];export const PAINTS=[[0,.4,1],[0,.85,.4],[1,0,1],[.95,.95,.97],[.12,.12,.14],[1,.82,.1]];export const SUIT=[.11,.12,.15];export const SUIT_TRIM=[.3,.32,.36];export const VISOR=[.05,.06,.09];let assets,cachedAssets=null;export const getCachedAssets=()=>cachedAssets;export function loadAssets(){return assets??=_0x187920().then(s=>{const{body:t,trim:e,glass:o}=bikeMeshes();return{...s,bike:{body:t,trim:e,glass:o,size:[Math.max(t.size[0],e.size[0]),Math.max(t.size[1],e.size[1]),Math.max(t.size[2],e.size[2])]}}}),assets.then(s=>{cachedAssets=s},()=>{}),assets.catch(()=>assets=void 0),assets}export function preloadBikeRacing(){loadAssets().catch(()=>{})}export function*warmAssets(){yield bikeMeshes,yield loadAssets}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{merge,quat,shapeGeometry,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{merge,quat,shapeGeometry,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x340198}from"../shared/EngineMeshes.js";import{SUIT,SUIT_TRIM,VISOR}from"./BikeRacingConstants.js";let riderModel;function riderMesh(){return cacheGameAsset("bike-racing/BikeRacingScene:riderMesh",()=>riderMeshUncached())}function riderMeshUncached(){if(riderModel)return riderModel;const e=(e,o,s,t,i)=>({geometry:tube([e,o],{radius:e=>s+(t-s)*e,sides:12,smoothness:2,caps:!0}),color:i}),o=(e,o,s)=>({geometry:shapeGeometry("sphere"),position:e,scale:o,color:s}),s=[e([0,.86,.26],[0,1.05,-.12],.16,.14,SUIT),o([0,.86,.26],[.3,.26,.28],SUIT),o([0,1.04,-.11],[.32,.24,.24],SUIT),e([0,1.07,-.15],[0,1.1,-.21],.06,.06,SUIT),e([0,.98,.2],[0,1.17,-.08],.035,.03,SUIT_TRIM)];for(const t of[-1,1])s.push(o([.18*t,1.04,-.12],.13,SUIT)),s.push(e([.18*t,1.04,-.12],[.29*t,.93,-.3],.06,.055,SUIT)),s.push(o([.29*t,.93,-.3],.11,SUIT)),s.push(e([.29*t,.93,-.3],[.32*t,.79,-.46],.055,.045,SUIT)),s.push(o([.32*t,.785,-.465],.1,SUIT_TRIM)),s.push(e([.12*t,.84,.26],[.25*t,.78,-.06],.085,.07,SUIT)),s.push(o([.25*t,.78,-.06],.14,SUIT)),s.push(e([.25*t,.78,-.06],[.23*t,.4,.1],.065,.055,SUIT)),s.push(o([.23*t,.38,.13],[.09,.08,.2],SUIT_TRIM));return riderModel=_0x340198(merge(s),{center:!1,shine:.45}),riderModel}export function spawnBike(e,o,s,t,i){const n=o.bike,r=e.spawn({mesh:"none",position:t}),a=e.spawn({mesh:"none",parent:r,position:[0,-n.size[1]/2,0]}),h=o=>e.spawn({parent:a,pickable:!1,...o});h({mesh:n.body,color:s}),h({mesh:n.trim}),h({mesh:n.glass}),h({mesh:riderMesh()}),h({mesh:"sphere",position:[0,1.14,-.29],scale:[.29,.28,.32],color:s}),h({mesh:"sphere",position:[0,1.13,-.39],scale:[.24,.11,.15],color:VISOR});const l={root:r,lean:a,lights:[]};return setBikeNight(e,l,i),l}export function setBikeNight(e,o,s){for(const s of o.lights)e.despawn(s);o.lights.length=0,s&&e.has(o.root)&&o.lights.push(e.spawn({mesh:"sphere",parent:o.lean,pickable:!1,position:[0,.71,-.93],scale:[.24,.05,.05],color:[2,1.95,1.7]}),e.spawn({mesh:"cube",parent:o.lean,pickable:!1,position:[0,.895,.985],scale:[.09,.03,.02],color:[2,.16,.1]}))}const REAR_CONTACT=.73,leanRotation=[0,0,0,1],rollRotation=[0,0,0,1],wheelieRotation=[0,0,0,1],leanPosition=[0,0,0];export function leanBike(e,o,s,t,i=0){quat.multiply(quat.z(-t,rollRotation),quat.x(i,wheelieRotation),leanRotation),leanPosition[1]=s+.73*Math.sin(i),leanPosition[2]=.73*(1-Math.cos(i)),e.set(o,{rotation:leanRotation,position:leanPosition})}export function*warmAssets(){yield riderMesh}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{GAME_DURATION,getLayout,LIGHT}from"./BlockBlastConstants.js";import{createGame,dispose,dragEnd,dragMove,dragStart,reset,setLayout,setTheme,start,tick}from"./BlockBlastGame.js";import{jsx as
|
|
1
|
+
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{GAME_DURATION,getLayout,LIGHT}from"./BlockBlastConstants.js";import{createGame,dispose,dragEnd,dragMove,dragStart,reset,setLayout,setTheme,start,tick}from"./BlockBlastGame.js";import{jsx as _0x4fe6a8}from"react/jsx-runtime";const SFX=GAME_SOUNDS.BLOCK_BLAST;export const BlockBlast=engineGame(GAME_IDS.BLOCK_BLAST,e=>{const[t,r]=useLiveState(0),[a,s]=useLiveState(GAME_DURATION),{theme:o,status:i,screen:n,gameOver:m}=useEngineGame(e,{gameId:GAME_IDS.BLOCK_BLAST,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,a)=>{const s=getLayout(t,r,a);return setLayout(e,s),s.boardSize},drag:(e,{phase:t,x:r,y:a})=>{"start"===t?dragStart(e,r,a):"move"===t?dragMove(e,r,a):dragEnd(e)},onStart:e=>e(SFX.START,HapticType.SUCCESS),onOver:(e,t)=>{"win"===t&&e(SFX.WIN,HapticType.SUCCESS)},wire:(e,t)=>{e.onScore=r,e.onTime=s,e.onPick=()=>t(SFX.PICK,HapticType.LIGHT),e.onInvalid=()=>t(SFX.INVALID,HapticType.WARNING),e.onPlace=()=>t(SFX.PLACE,HapticType.LIGHT),e.onClear=()=>t(SFX.CLEAR,HapticType.SUCCESS),e.onGameOver=()=>t(SFX.GAME_OVER,HapticType.ERROR)}});return _0x4fe6a8(EngineGameScreen,{...n,light:LIGHT,columns:[scoreColumn(t),timerColumn(a,o)],subtext:"Place blocks, clear lines!",gameOver:m({title:"win"===i?"YOU WON!":"GAME OVER",message:"win"===i?"Time completed! Great job!":"No more moves available!",scoreLabel:"Final Score",score:t,buttonText:"Play Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{extrude,Path}from"@nayan-ui/engine";import{spawnBackdrop}from"../shared/EngineBackdrop.js";import{raisedBlockScale,spawnRaisedBlock}from"../shared/EngineBlocks.js";import{createGameMesh as
|
|
1
|
+
"use strict";import{extrude,Path}from"@nayan-ui/engine";import{spawnBackdrop}from"../shared/EngineBackdrop.js";import{raisedBlockScale,spawnRaisedBlock}from"../shared/EngineBlocks.js";import{createGameMesh as _0x5a80e0}from"../shared/EngineMeshes.js";import{CELL_GAP,flat,GRID_SIZE,toColor}from"./BlockBlastConstants.js";const Z_BACKDROP=-20,Z_BOARD=0,Z_EMPTY=1.2,Z_TRAY=2,Z_DRAG=80;export const toWorld=(o,e,t,l=0)=>[e-o.width/2,o.height/2-t,l];export const cellCenter=(o,e,t)=>[o.boardLeft+CELL_GAP+t*o.step+o.cell/2,o.boardTop+CELL_GAP+e*o.step+o.cell/2];const blockZ=o=>1.2+o.depth/2+.4,highlightZ=o=>1.2+o.depth+2,ghostZ=o=>1.2+o.depth+3;export const trayZ=o=>2+o.depth/2;export const dragZ=80;const HIDDEN=0,SHOWN=1,BOARD_RADIUS=8,CELL_RADIUS=4,RIM_WIDTH=1,panels=new Map;function roundedPanel(o,e,t=0){const l=o+":"+e+":"+t;let r=panels.get(l);if(!r){const n=(new Path).addRoundedRect(0,0,o,o,e);t>0&&n.addRoundedRect(t,t,o-2*t,o-2*t,e-t),r=_0x5a80e0(extrude(n,{depth:0,fillRule:"evenodd"})),panels.set(l,r)}return r}export function buildBoard(o,e,t,l){const r=toWorld(e,e.boardLeft+e.boardSize/2,e.boardTop+e.boardSize/2),n=roundedPanel(e.cell,4),s=(e,t)=>o.spawn({mesh:n,position:e,scale:t,color:[1,1,1,0],pickable:!1}),a=o.spawn({mesh:roundedPanel(e.boardSize,8),position:[r[0],r[1],0],pickable:!1}),p=o.spawn({mesh:roundedPanel(e.boardSize,8,1),position:[r[0],r[1],.5],pickable:!1}),i=[],d=[],h=[];for(let o=0;o<GRID_SIZE;o++)for(let t=0;t<GRID_SIZE;t++){const[l,r]=cellCenter(e,o,t);i.push(s(toWorld(e,l,r,1.2),1)),d.push(s(toWorld(e,l,r,highlightZ(e)),0)),h.push(s(toWorld(e,l,r,ghostZ(e)),0))}const u={backdrop:spawnBackdrop(o,e.width,e.height,-20,l),rim:p,panel:a,empties:i,highlights:d,ghosts:h};return colorBoard(o,u,t),u}export function colorBoard(o,e,t){o.set(e.rim,{color:flat(toColor(t.BORDER))}),o.set(e.panel,{color:flat(toColor(t.SURFACE))});const l=flat(toColor(t.CELL_EMPTY));for(const t of e.empties)o.set(t,{color:l})}export function setOverlay(o,e,t){o.set(e,t?{scale:1,color:t}:{scale:0})}const blockSize=o=>[o.cell,o.cell,o.depth],spawnBlockAt=(o,e,t,l,r)=>spawnRaisedBlock(o,{position:t,size:blockSize(e),color:l,parent:r,shadow:!1});export function spawnBlock(o,e,t,l,r){const[n,s]=cellCenter(e,t,l);return spawnBlockAt(o,e,toWorld(e,n,s,blockZ(e)),r)}export function spawnPiece(o,e,t,l,r,n){const s=t.length,a=t[0]?.length??0,p=o.spawn({mesh:"none",position:toWorld(e,r[0],r[1],trayZ(e)),scale:n,pickable:!1});for(let r=0;r<s;r++)for(let n=0;n<a;n++)1===t[r]?.[n]&&spawnBlockAt(o,e,[(n-(a-1)/2)*e.step,-(r-(s-1)/2)*e.step,0],l,p);return p}export const blockScale=o=>raisedBlockScale(blockSize(o));export function blockBurst(o,e,t,l){const[r,n]=cellCenter(o,e,t),s=toWorld(o,r,n,blockZ(o));return{position:[s[0],s[1],s[2]+2*o.depth],size:o.cell,color:l,glowZ:1.5}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,LIVES,TIME_LIMIT}from"./BlockBreakerConstants.js";import{createGame,dispose,dragMove,dragStart,reset,setLayout,setTheme,start,tick}from"./BlockBreakerGame.js";import{jsx as
|
|
1
|
+
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,LIVES,TIME_LIMIT}from"./BlockBreakerConstants.js";import{createGame,dispose,dragMove,dragStart,reset,setLayout,setTheme,start,tick}from"./BlockBreakerGame.js";import{jsx as _0x3a10a3}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.BLOCK_BREAKER;export const BlockBreaker=engineGame(GAME_IDS.BLOCK_BREAKER,e=>{const[t,r]=useLiveState(0),[a,s]=useLiveState(LIVES),[o,i]=useLiveState(TIME_LIMIT),{theme:S,status:n,screen:m,gameOver:p}=useEngineGame(e,{gameId:GAME_IDS.BLOCK_BREAKER,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,a)=>{const s=getLayout(t,r,a);return setLayout(e,s),s.boardWidth},drag:(e,{phase:t,dx:r})=>{"start"===t?dragStart(e):"move"===t&&dragMove(e,r)},sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(null,HapticType.MEDIUM),wire:(e,t)=>{e.onScore=r,e.onLives=s,e.onTime=i,e.onWall=()=>t(SOUNDS.WALL,HapticType.LIGHT),e.onPaddle=()=>t(SOUNDS.PADDLE,HapticType.LIGHT),e.onBrickHit=()=>t(SOUNDS.HIT,HapticType.LIGHT),e.onBrickBreak=()=>t(SOUNDS.DESTROY,HapticType.MEDIUM),e.onCombo=()=>t(SOUNDS.COMBO,HapticType.MEDIUM),e.onPowerUp=()=>t(SOUNDS.POWER_UP,HapticType.SUCCESS),e.onLaunch=()=>t(SOUNDS.LAUNCH,HapticType.LIGHT),e.onLoseLife=()=>t(SOUNDS.LOSE_LIFE,HapticType.ERROR),e.onWin=()=>t(SOUNDS.WIN,HapticType.SUCCESS),e.onLose=()=>t(SOUNDS.GAME_OVER,HapticType.ERROR)}});return _0x3a10a3(EngineGameScreen,{...m,light:LIGHT,columns:[scoreColumn(t),livesColumn(a,LIVES),timerColumn(o,S)],subtext:"Break all bricks!",gameOver:p({title:"win"===n?"YOU WON!":"GAME OVER",message:"win"===n?"All bricks destroyed!":"Great breaking!",scoreLabel:"Final Score",score:t,buttonText:"Break Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{extrude,Path}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popAndBurst}from"../shared/EngineBlasts.js";import{raisedBlockScale,spawnRaisedBlock}from"../shared/EngineBlocks.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{extrude,Path}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popAndBurst}from"../shared/EngineBlasts.js";import{raisedBlockScale,spawnRaisedBlock}from"../shared/EngineBlocks.js";import{cacheGameAsset,createGameMesh as _0x11eb9e}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{BALL_COLOR,BALL_RADIUS,BALL_SPAWN_SPRING,BRICK_COLORS,BRICK_DROP,BRICK_INTRO_SPRING,BUMP_SPRING,BUMP_TIME,CLASSIC_BOARD,CLASSIC_BORDER,CLASSIC_RADIUS,PADDLE_COLOR,PADDLE_WIDTH_TIME,POWER_UP_COLORS,POWER_UP_SIZE,PULSE_TIME,THEMED_RADIUS,TRAIL,TRAIL_COLOR}from"./BlockBreakerConstants.js";const Z_BACKDROP=-20,Z_BOARD=0,Z_RIM=.2,Z_TRAIL=1,HIDDEN=0;export const toWorld=(e,o,t,r=0)=>[e.boardLeft+o-e.width/2,e.height/2-(e.boardTop+t),r];const brickDepth=e=>.7*e.brickHeight,brickZ=e=>.2+brickDepth(e)/2+1,brickSize=e=>[e.brickWidth,e.brickHeight,brickDepth(e)],brickScale=e=>raisedBlockScale(brickSize(e)),paddleDepth=e=>.9*e.paddleHeight,paddleZ=e=>.2+paddleDepth(e)/2+1,powerUpZ=()=>POWER_UP_SIZE+2,ballZ=()=>BALL_RADIUS+POWER_UP_SIZE+4,meshes=new Map,mesh=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("block-breaker/BlockBreakerScene:"+e,o),meshes.set(e,t)),t},discMesh=()=>mesh("disc",()=>_0x11eb9e(extrude((new Path).addCircle(0,0,.5),{depth:0}))),panelMesh=(e,o,t,r=0)=>mesh("panel:"+e+":"+o+":"+t+":"+r,()=>{const a=(new Path).addRoundedRect(0,0,e,o,t);return r>0&&a.addRoundedRect(r,r,e-2*r,o-2*r,t-r),_0x11eb9e(extrude(a,{depth:0,fillRule:"evenodd"}),{center:!1})}),BRICKS=BRICK_COLORS.map(e=>toColor(e));export const brickColor=e=>BRICKS[e%BRICKS.length];export function pieceColors(e){if("light"===e.mode){const o=toColor(e.TEXT);return{ball:o,trail:o,paddle:o}}return{ball:toColor(BALL_COLOR),trail:toColor(TRAIL_COLOR),paddle:toColor(PADDLE_COLOR)}}function spawnBoard(e,o,t){const r="classic"===t.mode,a=r?CLASSIC_RADIUS:THEMED_RADIUS;return[e.spawn({mesh:panelMesh(o.boardWidth,o.boardHeight,a),position:toWorld(o,0,0,0),color:toColor(r?CLASSIC_BOARD:t.BOARD.SURFACE),pickable:!1}),e.spawn({mesh:panelMesh(o.boardWidth,o.boardHeight,a,1.5),position:toWorld(o,0,0,.2),color:toColor(r?CLASSIC_BORDER:t.BOARD.BORDER),pickable:!1})]}export function buildScenery(e,o,t){return{backdrop:spawnBackdrop(e,o.width,o.height,-20,t),parts:spawnBoard(e,o,t)}}export function removeScenery(e,o){e.despawn(o.backdrop);for(const t of o.parts)e.despawn(t)}export function setSceneryTheme(e,o,t,r){setBackdropTheme(e,t.backdrop,r);for(const o of t.parts)e.despawn(o);t.parts=spawnBoard(e,o,r)}export function spawnBrick(e,o,t,r,a,i){const n=t+o.brickWidth/2,l=r+o.brickHeight/2,s=brickScale(o),p=spawnRaisedBlock(e,{position:toWorld(o,n,null===i?l:l-BRICK_DROP,brickZ(o)),size:brickSize(o),color:brickColor(a),grow:null===i?1:0});return null!==i&&(e.animate(p,{position:toWorld(o,n,l,brickZ(o))},{spring:BRICK_INTRO_SPRING,delay:i}),e.animate(p,{scale:s},{duration:.15,delay:i})),p}export function breakBrick(e,o,t,r,a,i){const n=toWorld(o,r+o.brickWidth/2,a+o.brickHeight/2,brickZ(o));popAndBurst(e,t,{scale:brickScale(o),color:brickColor(i),duration:.45},{position:[n[0],n[1],n[2]+brickDepth(o)],size:1.6*o.brickHeight,color:brickColor(i),glowZ:.5}).then(()=>{e.despawn(t)})}export function hitBrick(e,o){e.animate(o,{shake:2},{duration:.15})}export function spawnPaddle(e,o,t,r,a){const i=e.spawn({mesh:"none",position:toWorld(o,t,o.paddleTop+o.paddleHeight/2,paddleZ(o)),pickable:!1});return{root:i,body:e.spawn({mesh:"roundedBox",parent:i,scale:[r,o.paddleHeight,paddleDepth(o)],color:a,pickable:!1})}}export function placePaddle(e,o,t,r){e.set(t.root,{position:toWorld(o,r,o.paddleTop+o.paddleHeight/2,paddleZ(o))})}export function setPaddleWidth(e,o,t,r,a){const i=[r,o.paddleHeight,paddleDepth(o)];a?e.animate(t.body,{scale:i},{duration:PADDLE_WIDTH_TIME}):(e.stopAnimation(t.body),e.set(t.body,{scale:i}))}export function bumpPaddle(e,o,t){e.animate(o.root,{scale:[1+.06*t,1-.22*t,1]},{duration:BUMP_TIME,easing:"linear"}).then(()=>{e.animate(o.root,{scale:1},{spring:BUMP_SPRING})})}export function spawnBall(e,o,t,r,a){const i=e.spawn({mesh:"sphere",position:toWorld(o,t,r,ballZ()),scale:0,color:a.ball,pickable:!1});return e.animate(i,{scale:2*BALL_RADIUS},{spring:BALL_SPAWN_SPRING}),{ball:i,trail:TRAIL.map(i=>e.spawn({mesh:discMesh(),position:toWorld(o,t,r,1),scale:2*BALL_RADIUS*i.r,color:withAlpha(a.trail,i.o),pickable:!1}))}}const withAlpha=(e,o)=>[e[0],e[1],e[2],o];export function placeBall(e,o,t,r,a,i,n){e.set(t.ball,{position:toWorld(o,r,a,ballZ())}),t.trail.forEach((t,l)=>e.set(t,{position:toWorld(o,r-i*TRAIL[l].k,a-n*TRAIL[l].k,1)}))}export function colorBall(e,o,t){e.set(o.ball,{color:t.ball}),o.trail.forEach((o,r)=>e.set(o,{color:withAlpha(t.trail,TRAIL[r].o)}))}export function removeBall(e,o){e.despawn(o.ball);for(const t of o.trail)e.despawn(t)}export function spawnPowerUp(e,o,t,r,a){const i=toColor(POWER_UP_COLORS[t]),n=e.spawn({mesh:"none",position:toWorld(o,r,a,powerUpZ()),scale:0,pickable:!1});e.animate(n,{scale:1},{spring:BALL_SPAWN_SPRING}),e.spawn({mesh:"sphere",parent:n,scale:1.4*POWER_UP_SIZE,color:i,pickable:!1});const l=e.spawn({mesh:discMesh(),parent:n,position:[0,0,-POWER_UP_SIZE],scale:1.8*POWER_UP_SIZE,color:[i[0],i[1],i[2],.25],pickable:!1});return e.animate(l,{scale:2.3*POWER_UP_SIZE},{duration:PULSE_TIME,easing:"easeInOut",repeat:"forever",yoyo:!0}),n}export function placePowerUp(e,o,t,r,a){e.set(t,{position:toWorld(o,r,a,powerUpZ())})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS,isTablet}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{toRgb}from"../shared/EngineUtils.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{GAME_DURATION,getConfig,LIGHT}from"./BlukConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./BlukGame.js";import{skyFor}from"./BlukScene.js";import{jsx as
|
|
1
|
+
"use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS,isTablet}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{toRgb}from"../shared/EngineUtils.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{GAME_DURATION,getConfig,LIGHT}from"./BlukConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./BlukGame.js";import{skyFor}from"./BlukScene.js";import{jsx as _0x553475}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.BLUK,FEEDBACK={jump:{sound:SOUNDS.JUMP,haptic:HapticType.LIGHT},land:{sound:SOUNDS.LAND,haptic:HapticType.MEDIUM},perfect:{sound:SOUNDS.PERFECT,haptic:HapticType.SUCCESS},fall:{sound:SOUNDS.FALL,haptic:HapticType.ERROR},gameOver:{sound:SOUNDS.GAME_OVER,haptic:HapticType.ERROR}};export const Bluk=engineGame(GAME_IDS.BLUK,e=>{const[t,s]=useLiveState(0),[r,i]=useLiveState(GAME_DURATION),{theme:o,status:a,screen:n,gameOver:m}=useEngineGame(e,{gameId:GAME_IDS.BLUK,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s)=>setLayout(e,getConfig(t,s,isTablet)),drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(null,HapticType.MEDIUM),onOver:(e,t)=>{"win"===t&&e(SOUNDS.WIN,HapticType.SUCCESS)},wire:(e,t)=>{e.onScore=s,e.onTime=i,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}}),S=skyFor(o).stops[0],p=useMemo(()=>toRgb(S),[S]);return _0x553475(EngineGameScreen,{...n,light:LIGHT,background:p,columns:[scoreColumn(t),timerColumn(r,o)],subtext:"Drag, release and jump!",gameOver:m({title:"win"===a?"YOU WIN!":"GAME OVER",message:"win"===a?"You survived 2 minutes!":"Nice jumping!",scoreLabel:"Final Score",score:t,buttonText:"Jump Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,merge,Path,quat,recolor,shapeGeometry,tube}from"@nayan-ui/engine";import{noise}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x50bbe2}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{BLOCK_COLORS,COLORS,PITCH,SKIES,SKY_POSITIONS,TRAJECTORY_DOTS,YAW}from"./BlukConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("bluk/BlukScene:"+e,o),meshes.set(e,t)),t},EYE_DISTANCE=300,SKY_DEPTH=220,TOWER_DEPTH=150,FLAT_UP=quat.x(-Math.PI/2),rgb=e=>{const[o,t,s]=toColor(e);return[o,t,s]};export function skyFor(e){if("classic"===e.mode)return SKIES.classic;const o=SKIES[e.isDark?"dark":"light"],t=o.stops[0]===o.stops[o.stops.length-1]?o.stops[0]:null;return{...o,stops:o.stops.map(o=>o===t?e.BACKGROUND:o)}}const skyMesh=e=>cached("bluk-sky:"+e.stops.join(","),()=>{const o=e.stops.map(rgb),t=recolor(extrude((new Path).addRect(-.5,-.5,1,1),{depth:0}),({position:e})=>{const t=Math.min(1,Math.max(0,.5-e[1]));let s=0;for(;s<SKY_POSITIONS.length-2&&t>SKY_POSITIONS[s+1];)s++;const r=SKY_POSITIONS[s],i=(t-r)/(SKY_POSITIONS[s+1]-r||1),n=o[s],a=o[s+1];return[n[0]+(a[0]-n[0])*i,n[1]+(a[1]-n[1])*i,n[2]+(a[2]-n[2])*i,1]});return _0x50bbe2(t,{center:!1})}),bodyMesh=()=>cached("bluk-body-v2",()=>{const e=e=>({geometry:tube([[.13*e,.68,0],[.19*e,.6,.01]],{radius:.055,sides:12,caps:!0})});return _0x50bbe2(merge([{geometry:tube([[0,.42,0],[0,.56,0],[0,.7,0]],{radius:e=>.1+.035*Math.sin(Math.PI*Math.min(1,1.3*e)),sides:18,caps:!0}),scale:[1.25,1,.85]},e(-1),e(1)]),{center:!1,shine:.3})}),headMesh=()=>cached("bluk-head-v2",()=>{const e=toColor(COLORS.SKIN),o=[.2,.26,.42,1],t=[.16,.12,.1,1],s=[.24,.15,.09,1],r=(e,o,t,s)=>({geometry:tube([e,o],{radius:t,sides:12,caps:!0}),color:s}),i=Array.from({length:9},(e,o)=>{const t=1.2*Math.PI+.6*Math.PI*o/8;return[.05*Math.cos(t),.835+.035*Math.sin(t),.15]}),n=[r([-.055,.44,0],[-.065,.07,.01],.05,o),r([.055,.44,0],[.065,.07,.01],.05,o),{geometry:shapeGeometry("roundedBox"),position:[0,.43,0],scale:[.25,.04,.2],color:[.18,.14,.12,1]},{geometry:shapeGeometry("roundedBox"),position:[-.068,.035,.03],scale:[.09,.07,.16],color:t},{geometry:shapeGeometry("roundedBox"),position:[.068,.035,.03],scale:[.09,.07,.16],color:t},r([-.19,.6,.01],[-.22,.47,.03],.04,e),r([.19,.6,.01],[.22,.47,.03],.04,e),{geometry:shapeGeometry("sphere"),position:[-.225,.45,.035],scale:.075,color:e},{geometry:shapeGeometry("sphere"),position:[.225,.45,.035],scale:.075,color:e},r([0,.7,0],[0,.76,0],.04,e),{geometry:shapeGeometry("sphere"),position:[0,.86,0],scale:[.27,.3,.27],color:e},{geometry:shapeGeometry("sphere"),position:[-.135,.86,0],scale:[.05,.08,.05],color:e},{geometry:shapeGeometry("sphere"),position:[.135,.86,0],scale:[.05,.08,.05],color:e},{geometry:shapeGeometry("sphere"),position:[0,.855,.135],scale:[.04,.05,.04],color:[.92*e[0],.86*e[1],.82*e[2],1]},{geometry:shapeGeometry("sphere"),position:[0,.92,-.015],scale:[.29,.22,.29],color:s},{geometry:shapeGeometry("roundedBox"),position:[.02,.965,.11],scale:[.2,.05,.06],color:s},...[-1,1].flatMap(e=>[{geometry:shapeGeometry("sphere"),position:[.05*e,.885,.118],scale:[.055,.06,.03],color:[1,1,1,1]},{geometry:shapeGeometry("sphere"),position:[.05*e,.882,.13],scale:[.034,.038,.015],color:[.27,.45,.62,1]},{geometry:shapeGeometry("sphere"),position:[.05*e,.882,.137],scale:[.018,.02,.01],color:toColor(COLORS.PUPIL)},{geometry:shapeGeometry("sphere"),position:[.05*e+.008,.89,.142],scale:.008,color:[1.4,1.4,1.4,1]},{geometry:shapeGeometry("roundedBox"),position:[.05*e,.925,.125],rotation:quat.z(-.15*e),scale:[.05,.011,.012],color:s}]),{geometry:tube(i,{radius:.007,sides:6,caps:!0}),color:toColor(COLORS.SMILE)}];return _0x50bbe2(merge(n),{center:!1,shine:.25})}),ringMesh=()=>cached("bluk-ring",()=>_0x50bbe2(extrude((new Path).addCircle(0,0,.5).addCircle(0,0,.42),{depth:0,fillRule:"evenodd"}),{center:!1})),rockMesh=()=>cached("bluk-rock",()=>{const e=[];for(let o=0;o<26;o++){const t=-(o+.5)/26,s=.12*(noise(3.1*o,1.7)-.5),r=.12*(noise(2.3*o,8.9)-.5),i=.78+.3*noise(1.9*o,4.2);e.push({geometry:shapeGeometry("roundedBox"),position:[.3*s,t,.3*r],scale:[1+s,1/26-.004,1+r],color:[i,i,i,1]}),e.push({geometry:shapeGeometry("cube"),position:[0,t-.5/26,0],scale:[.97,.004,.97],color:[.45,.45,.45,1]})}return _0x50bbe2(merge(e),{center:!1,shine:.12})}),capMesh=()=>cached("bluk-cap",()=>{const e=toColor(COLORS.GRASS),o=toColor(COLORS.GRASS_DARK),t=toColor(COLORS.MOSS),s=[{geometry:shapeGeometry("roundedBox"),position:[0,.5,0],scale:[1.06,1,1.06],color:e},{geometry:shapeGeometry("roundedBox"),position:[0,-.1,0],scale:[1.02,.4,1.02],color:t}];for(let t=0;t<9;t++){const r=.115*t-.46,i=.5+.9*noise(2.7*t,3.3);s.push({geometry:shapeGeometry("roundedBox"),position:[r,-i/2+.1,.5],scale:[.09,i,.06],color:t%2?o:e})}for(const t of[-1,1])for(let r=0;r<6;r++){const i=.16*r-.4,n=.4+.8*noise(3.9*r+t,7.1);s.push({geometry:shapeGeometry("roundedBox"),position:[.52*t,-n/2+.1,i],scale:[.06,n,.1],color:r%2?e:o})}return _0x50bbe2(merge(s),{center:!1,shine:.08})}),cloudMesh=()=>cached("bluk-cloud",()=>_0x50bbe2(merge([[0,0,.5],[-.28,-.06,.38],[.3,-.05,.4],[-.12,.12,.42],[.14,.14,.36],[.45,-.1,.26],[-.48,-.1,.26]].map(([e,o,t])=>({geometry:shapeGeometry("sphere"),position:[e,o,0],scale:[t,.75*t,.6*t]}))),{center:!1,shine:0}));export const toWorld=(e,o,t=0)=>[e,-o,t];function spawnPillar(e,o,t){const s=o.height+400-t.topY,r=.85*t.width,i=e.spawn({mesh:"none",position:toWorld(t.worldX,t.topY),pickable:!1}),n=o=>e.spawn({parent:i,pickable:!1,...o});return n({mesh:rockMesh(),position:[0,-3,0],scale:[t.width,s,r],color:toColor(COLORS.ROCK)}),n({mesh:capMesh(),position:[0,-5,0],scale:[t.width,6,r],color:[1,1,1,1]}),n({mesh:"roundedBox",position:[0,1.2,0],scale:[o.sweetSpotWidth+8,1.2,.62*r],color:toColor(COLORS.SWEET_RECESS)}),n({mesh:"roundedBox",position:[0,1.8,0],scale:[o.sweetSpotWidth,1,.42*r],color:[1.5,1.3,.25,1]}),{root:i}}export function buildScene(e,o,t,s,r,i){const n=skyFor(t),a=e.spawn({mesh:skyMesh(n),scale:[2.4*o.width,1.8*o.height,1],pickable:!1});if(n.stars){let t=7;const s=()=>{const e=43758.5453*Math.sin(12.9898*t++);return e-Math.floor(e)};for(let t=0;t<48;t++){const t=.4+.9*s();e.spawn({mesh:"sphere",parent:a,position:[.9*(s()-.5),(.4-.64*s())/1.8,.5],scale:[(1.2+2.4*s())/(2.4*o.width),(1.2+2.4*s())/(1.8*o.height),.01],color:[1.4*t,1.3*t,1.6*t,1],pickable:!1})}}const l=[],h=toColor(n.tower);for(let t=0;t<10;t++){const s=t/10*o.width*1.8-.2*o.width,r=o.height*(.3+37*t%11*.025),i=22+53*t%20,n=1.3*o.height-r,a=t%2==0,p=a?1:.85,d=e.spawn({mesh:rockMesh(),position:[s,-r,-150*(a?1:.7)],scale:[i,n,i],color:[h[0]*p,h[1]*p,h[2]*p,1],pickable:!1});l.push({entity:d,x:s,y:-r,z:-150*(a?1:.7)})}const p=n.stars?[.55,.52,.75,.35]:[1,1,1,.85];for(let t=0;t<6;t++){const s=t/6*o.width*1.8-.2*o.width,r=o.height*(.1+29*t%7*.04),i=60+41*t%50,n=e.spawn({mesh:cloudMesh(),position:[s,-r,-60],scale:[i,.6*i,.5*i],color:p,pickable:!1});l.push({entity:n,x:s,y:-r,z:-60})}const d={sky:a,towers:l,pillars:new Map,block:e.spawn({mesh:"none",position:toWorld(r[0],r[1]),pickable:!1}),figure:0,body:0,dots:[],ring:e.spawn({mesh:ringMesh(),rotation:FLAT_UP,scale:0,color:[1.6,1.4,.3,0],pickable:!1})};d.figure=e.spawn({mesh:"none",parent:d.block,position:[0,-o.blockSize/2,0],scale:o.blockSize,pickable:!1}),d.body=e.spawn({mesh:bodyMesh(),parent:d.figure,color:toColor(BLOCK_COLORS[i]),pickable:!1}),e.spawn({mesh:headMesh(),parent:d.figure,pickable:!1});const m=toColor(COLORS.TRAJECTORY);for(let o=0;o<=TRAJECTORY_DOTS;o++)d.dots.push(e.spawn({mesh:"sphere",scale:0,color:[1.4*m[0],1.4*m[1],1.4*m[2],.92],pickable:!1}));return syncPillars(e,o,d,s),d}export function removeScene(e,o){for(const t of[o.sky,...o.towers.map(e=>e.entity),...Array.from(o.pillars.values(),e=>e.root),o.block,...o.dots,o.ring])e.despawn(t)}export function syncPillars(e,o,t,s){const r=new Set(s.map(e=>e.id));for(const[o,s]of t.pillars)!r.has(o)&&(e.despawn(s.root),t.pillars.delete(o));for(const r of s)t.pillars.has(r.id)||t.pillars.set(r.id,spawnPillar(e,o,r))}export function frame(e,o,t,s,r){if(t.frameX===r&&t.frameWidth===o.width&&t.frameHeight===o.height)return;t.frameX=r,t.frameWidth=o.width,t.frameHeight=o.height;const i=e.transforms,n=r+o.width/2,a=-o.height/2,l=Math.cos(PITCH);s.target=[n,a,0],s.eye=[n+Math.sin(YAW)*l*300,a+300*Math.sin(PITCH),Math.cos(YAW)*l*300],s.ortho=o.height/2,i.position(t.sky,n-220*Math.sin(YAW),a+.1*o.height-220*Math.sin(PITCH),-220);for(const e of t.towers){const t=1.8*o.width;let s=e.x+.9*r;s=r-.2*o.width+((s-r+.2*o.width)%t+t)%t,i.position(e.entity,s-150*Math.sin(YAW)*.6,e.y,e.z)}i.flush()}export function placeBlock(e,o,t,s,r){e.set(o.block,{position:toWorld(t,s),rotation:quat.z(-r)})}export function squash(e,o,t,s){const r=o.blockSize;e.set(t.figure,{scale:[r*(1-.6*s),r*(1+s),r*(1-.6*s)]})}const squashed=(e,o)=>[e.blockSize*(1-.6*o),e.blockSize*(1+o),e.blockSize*(1-.6*o)];export function stretch(e,o,t){e.animate(t.figure,[{scale:squashed(o,.14),at:.26},{scale:squashed(o,0)}],{duration:.35,easing:"easeInOut"})}export function relax(e,o,t){e.animate(t.figure,{scale:squashed(o,0)},{duration:.16,easing:"easeOut"})}export function land(e,o,t,s,r,i,n){e.animate(t.block,{rotation:[0,0,0,1]},{duration:.22,easing:"easeOut"}),e.animate(t.figure,[{scale:squashed(o,-.2),at:.2},{scale:squashed(o,0)}],{duration:.36,easing:"back"}),e.set(t.body,{color:toColor(BLOCK_COLORS[n])}),effects.dust(e,{position:toWorld(s,r,6),count:10,size:.22*o.blockSize,speed:1.6*o.blockSize,lifetime:.48,direction:[0,1,0],spread:1.3,color:[.85,.9,.95,.6],endSize:1.8}),i&&(e.stopAnimation(t.ring),e.set(t.ring,{position:toWorld(s,r-1.5),scale:.4*o.blockSize,color:[1.6,1.4,.3,.9]}),e.animate(t.ring,{scale:2.6*o.blockSize,color:[1.6,1.4,.3,0]},{duration:.56,easing:"easeOut"}),effects.sparkle(e,{position:toWorld(s,r-4,6),count:20,size:.08*o.blockSize,speed:3*o.blockSize,lifetime:.6,gravity:4*-o.blockSize,colors:[[1,.83,.17,1],[1,1,1,1]]}))}export function fall(e,o,t,s){const r=toColor(BLOCK_COLORS[s]);e.animate(o.block,{rotation:quat.z(-(t+1.6))},{duration:.42,easing:"easeIn"}),e.animate(o.body,{color:[r[0],r[1],r[2],0]},{duration:.3}),e.animate(o.figure,{scale:.01},{duration:.3,delay:.1,easing:"easeIn"})}export function resetBlock(e,o,t,s){for(const o of[t.block,t.figure,t.body,t.ring])e.stopAnimation(o);e.set(t.block,{rotation:[0,0,0,1]}),e.set(t.figure,{scale:squashed(o,0)}),e.set(t.body,{color:toColor(BLOCK_COLORS[s])}),e.set(t.ring,{scale:0})}export function showArc(e,o,t,s){const r=s.length/2;for(let i=0;i<t.dots.length;i++)if(i<r){const n=o.blockSize*(.16-.08*i/Math.max(1,r));e.set(t.dots[i],{position:toWorld(s[2*i],s[2*i+1],4),scale:n})}else e.set(t.dots[i],{scale:0})}export const hideArc=(e,o,t)=>showArc(e,o,t,[]);
|
|
1
|
+
"use strict";import{effects,extrude,merge,Path,quat,recolor,shapeGeometry,tube}from"@nayan-ui/engine";import{noise}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x4fab0e}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{BLOCK_COLORS,COLORS,PITCH,SKIES,SKY_POSITIONS,TRAJECTORY_DOTS,YAW}from"./BlukConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("bluk/BlukScene:"+e,o),meshes.set(e,t)),t},EYE_DISTANCE=300,SKY_DEPTH=220,TOWER_DEPTH=150,FLAT_UP=quat.x(-Math.PI/2),rgb=e=>{const[o,t,s]=toColor(e);return[o,t,s]};export function skyFor(e){if("classic"===e.mode)return SKIES.classic;const o=SKIES[e.isDark?"dark":"light"],t=o.stops[0]===o.stops[o.stops.length-1]?o.stops[0]:null;return{...o,stops:o.stops.map(o=>o===t?e.BACKGROUND:o)}}const skyMesh=e=>cached("bluk-sky:"+e.stops.join(","),()=>{const o=e.stops.map(rgb),t=recolor(extrude((new Path).addRect(-.5,-.5,1,1),{depth:0}),({position:e})=>{const t=Math.min(1,Math.max(0,.5-e[1]));let s=0;for(;s<SKY_POSITIONS.length-2&&t>SKY_POSITIONS[s+1];)s++;const r=SKY_POSITIONS[s],i=(t-r)/(SKY_POSITIONS[s+1]-r||1),a=o[s],n=o[s+1];return[a[0]+(n[0]-a[0])*i,a[1]+(n[1]-a[1])*i,a[2]+(n[2]-a[2])*i,1]});return _0x4fab0e(t,{center:!1})}),bodyMesh=()=>cached("bluk-body-v2",()=>{const e=e=>({geometry:tube([[.13*e,.68,0],[.19*e,.6,.01]],{radius:.055,sides:12,caps:!0})});return _0x4fab0e(merge([{geometry:tube([[0,.42,0],[0,.56,0],[0,.7,0]],{radius:e=>.1+.035*Math.sin(Math.PI*Math.min(1,1.3*e)),sides:18,caps:!0}),scale:[1.25,1,.85]},e(-1),e(1)]),{center:!1,shine:.3})}),headMesh=()=>cached("bluk-head-v2",()=>{const e=toColor(COLORS.SKIN),o=[.2,.26,.42,1],t=[.16,.12,.1,1],s=[.24,.15,.09,1],r=(e,o,t,s)=>({geometry:tube([e,o],{radius:t,sides:12,caps:!0}),color:s}),i=Array.from({length:9},(e,o)=>{const t=1.2*Math.PI+.6*Math.PI*o/8;return[.05*Math.cos(t),.835+.035*Math.sin(t),.15]}),a=[r([-.055,.44,0],[-.065,.07,.01],.05,o),r([.055,.44,0],[.065,.07,.01],.05,o),{geometry:shapeGeometry("roundedBox"),position:[0,.43,0],scale:[.25,.04,.2],color:[.18,.14,.12,1]},{geometry:shapeGeometry("roundedBox"),position:[-.068,.035,.03],scale:[.09,.07,.16],color:t},{geometry:shapeGeometry("roundedBox"),position:[.068,.035,.03],scale:[.09,.07,.16],color:t},r([-.19,.6,.01],[-.22,.47,.03],.04,e),r([.19,.6,.01],[.22,.47,.03],.04,e),{geometry:shapeGeometry("sphere"),position:[-.225,.45,.035],scale:.075,color:e},{geometry:shapeGeometry("sphere"),position:[.225,.45,.035],scale:.075,color:e},r([0,.7,0],[0,.76,0],.04,e),{geometry:shapeGeometry("sphere"),position:[0,.86,0],scale:[.27,.3,.27],color:e},{geometry:shapeGeometry("sphere"),position:[-.135,.86,0],scale:[.05,.08,.05],color:e},{geometry:shapeGeometry("sphere"),position:[.135,.86,0],scale:[.05,.08,.05],color:e},{geometry:shapeGeometry("sphere"),position:[0,.855,.135],scale:[.04,.05,.04],color:[.92*e[0],.86*e[1],.82*e[2],1]},{geometry:shapeGeometry("sphere"),position:[0,.92,-.015],scale:[.29,.22,.29],color:s},{geometry:shapeGeometry("roundedBox"),position:[.02,.965,.11],scale:[.2,.05,.06],color:s},...[-1,1].flatMap(e=>[{geometry:shapeGeometry("sphere"),position:[.05*e,.885,.118],scale:[.055,.06,.03],color:[1,1,1,1]},{geometry:shapeGeometry("sphere"),position:[.05*e,.882,.13],scale:[.034,.038,.015],color:[.27,.45,.62,1]},{geometry:shapeGeometry("sphere"),position:[.05*e,.882,.137],scale:[.018,.02,.01],color:toColor(COLORS.PUPIL)},{geometry:shapeGeometry("sphere"),position:[.05*e+.008,.89,.142],scale:.008,color:[1.4,1.4,1.4,1]},{geometry:shapeGeometry("roundedBox"),position:[.05*e,.925,.125],rotation:quat.z(-.15*e),scale:[.05,.011,.012],color:s}]),{geometry:tube(i,{radius:.007,sides:6,caps:!0}),color:toColor(COLORS.SMILE)}];return _0x4fab0e(merge(a),{center:!1,shine:.25})}),ringMesh=()=>cached("bluk-ring",()=>_0x4fab0e(extrude((new Path).addCircle(0,0,.5).addCircle(0,0,.42),{depth:0,fillRule:"evenodd"}),{center:!1})),rockMesh=()=>cached("bluk-rock",()=>{const e=[];for(let o=0;o<26;o++){const t=-(o+.5)/26,s=.12*(noise(3.1*o,1.7)-.5),r=.12*(noise(2.3*o,8.9)-.5),i=.78+.3*noise(1.9*o,4.2);e.push({geometry:shapeGeometry("roundedBox"),position:[.3*s,t,.3*r],scale:[1+s,1/26-.004,1+r],color:[i,i,i,1]}),e.push({geometry:shapeGeometry("cube"),position:[0,t-.5/26,0],scale:[.97,.004,.97],color:[.45,.45,.45,1]})}return _0x4fab0e(merge(e),{center:!1,shine:.12})}),capMesh=()=>cached("bluk-cap",()=>{const e=toColor(COLORS.GRASS),o=toColor(COLORS.GRASS_DARK),t=toColor(COLORS.MOSS),s=[{geometry:shapeGeometry("roundedBox"),position:[0,.5,0],scale:[1.06,1,1.06],color:e},{geometry:shapeGeometry("roundedBox"),position:[0,-.1,0],scale:[1.02,.4,1.02],color:t}];for(let t=0;t<9;t++){const r=.115*t-.46,i=.5+.9*noise(2.7*t,3.3);s.push({geometry:shapeGeometry("roundedBox"),position:[r,-i/2+.1,.5],scale:[.09,i,.06],color:t%2?o:e})}for(const t of[-1,1])for(let r=0;r<6;r++){const i=.16*r-.4,a=.4+.8*noise(3.9*r+t,7.1);s.push({geometry:shapeGeometry("roundedBox"),position:[.52*t,-a/2+.1,i],scale:[.06,a,.1],color:r%2?e:o})}return _0x4fab0e(merge(s),{center:!1,shine:.08})}),cloudMesh=()=>cached("bluk-cloud",()=>_0x4fab0e(merge([[0,0,.5],[-.28,-.06,.38],[.3,-.05,.4],[-.12,.12,.42],[.14,.14,.36],[.45,-.1,.26],[-.48,-.1,.26]].map(([e,o,t])=>({geometry:shapeGeometry("sphere"),position:[e,o,0],scale:[t,.75*t,.6*t]}))),{center:!1,shine:0}));export const toWorld=(e,o,t=0)=>[e,-o,t];function spawnPillar(e,o,t){const s=o.height+400-t.topY,r=.85*t.width,i=e.spawn({mesh:"none",position:toWorld(t.worldX,t.topY),pickable:!1}),a=o=>e.spawn({parent:i,pickable:!1,...o});return a({mesh:rockMesh(),position:[0,-3,0],scale:[t.width,s,r],color:toColor(COLORS.ROCK)}),a({mesh:capMesh(),position:[0,-5,0],scale:[t.width,6,r],color:[1,1,1,1]}),a({mesh:"roundedBox",position:[0,1.2,0],scale:[o.sweetSpotWidth+8,1.2,.62*r],color:toColor(COLORS.SWEET_RECESS)}),a({mesh:"roundedBox",position:[0,1.8,0],scale:[o.sweetSpotWidth,1,.42*r],color:[1.5,1.3,.25,1]}),{root:i}}export function buildScene(e,o,t,s,r,i){const a=skyFor(t),n=e.spawn({mesh:skyMesh(a),scale:[2.4*o.width,1.8*o.height,1],pickable:!1});if(a.stars){let t=7;const s=()=>{const e=43758.5453*Math.sin(12.9898*t++);return e-Math.floor(e)};for(let t=0;t<48;t++){const t=.4+.9*s();e.spawn({mesh:"sphere",parent:n,position:[.9*(s()-.5),(.4-.64*s())/1.8,.5],scale:[(1.2+2.4*s())/(2.4*o.width),(1.2+2.4*s())/(1.8*o.height),.01],color:[1.4*t,1.3*t,1.6*t,1],pickable:!1})}}const l=[],h=toColor(a.tower);for(let t=0;t<10;t++){const s=t/10*o.width*1.8-.2*o.width,r=o.height*(.3+37*t%11*.025),i=22+53*t%20,a=1.3*o.height-r,n=t%2==0,p=n?1:.85,d=e.spawn({mesh:rockMesh(),position:[s,-r,-150*(n?1:.7)],scale:[i,a,i],color:[h[0]*p,h[1]*p,h[2]*p,1],pickable:!1});l.push({entity:d,x:s,y:-r,z:-150*(n?1:.7)})}const p=a.stars?[.55,.52,.75,.35]:[1,1,1,.85];for(let t=0;t<6;t++){const s=t/6*o.width*1.8-.2*o.width,r=o.height*(.1+29*t%7*.04),i=60+41*t%50,a=e.spawn({mesh:cloudMesh(),position:[s,-r,-60],scale:[i,.6*i,.5*i],color:p,pickable:!1});l.push({entity:a,x:s,y:-r,z:-60})}const d={sky:n,towers:l,pillars:new Map,block:e.spawn({mesh:"none",position:toWorld(r[0],r[1]),pickable:!1}),figure:0,body:0,dots:[],ring:e.spawn({mesh:ringMesh(),rotation:FLAT_UP,scale:0,color:[1.6,1.4,.3,0],pickable:!1})};d.figure=e.spawn({mesh:"none",parent:d.block,position:[0,-o.blockSize/2,0],scale:o.blockSize,pickable:!1}),d.body=e.spawn({mesh:bodyMesh(),parent:d.figure,color:toColor(BLOCK_COLORS[i]),pickable:!1}),e.spawn({mesh:headMesh(),parent:d.figure,pickable:!1});const m=toColor(COLORS.TRAJECTORY);for(let o=0;o<=TRAJECTORY_DOTS;o++)d.dots.push(e.spawn({mesh:"sphere",scale:0,color:[1.4*m[0],1.4*m[1],1.4*m[2],.92],pickable:!1}));return syncPillars(e,o,d,s),d}export function removeScene(e,o){for(const t of[o.sky,...o.towers.map(e=>e.entity),...Array.from(o.pillars.values(),e=>e.root),o.block,...o.dots,o.ring])e.despawn(t)}export function syncPillars(e,o,t,s){const r=new Set(s.map(e=>e.id));for(const[o,s]of t.pillars)!r.has(o)&&(e.despawn(s.root),t.pillars.delete(o));for(const r of s)t.pillars.has(r.id)||t.pillars.set(r.id,spawnPillar(e,o,r))}export function frame(e,o,t,s,r){if(t.frameX===r&&t.frameWidth===o.width&&t.frameHeight===o.height)return;t.frameX=r,t.frameWidth=o.width,t.frameHeight=o.height;const i=e.transforms,a=r+o.width/2,n=-o.height/2,l=Math.cos(PITCH);s.target=[a,n,0],s.eye=[a+Math.sin(YAW)*l*300,n+300*Math.sin(PITCH),Math.cos(YAW)*l*300],s.ortho=o.height/2,i.position(t.sky,a-220*Math.sin(YAW),n+.1*o.height-220*Math.sin(PITCH),-220);for(const e of t.towers){const t=1.8*o.width;let s=e.x+.9*r;s=r-.2*o.width+((s-r+.2*o.width)%t+t)%t,i.position(e.entity,s-150*Math.sin(YAW)*.6,e.y,e.z)}i.flush()}export function placeBlock(e,o,t,s,r){e.set(o.block,{position:toWorld(t,s),rotation:quat.z(-r)})}export function squash(e,o,t,s){const r=o.blockSize;e.set(t.figure,{scale:[r*(1-.6*s),r*(1+s),r*(1-.6*s)]})}const squashed=(e,o)=>[e.blockSize*(1-.6*o),e.blockSize*(1+o),e.blockSize*(1-.6*o)];export function stretch(e,o,t){e.animate(t.figure,[{scale:squashed(o,.14),at:.26},{scale:squashed(o,0)}],{duration:.35,easing:"easeInOut"})}export function relax(e,o,t){e.animate(t.figure,{scale:squashed(o,0)},{duration:.16,easing:"easeOut"})}export function land(e,o,t,s,r,i,a){e.animate(t.block,{rotation:[0,0,0,1]},{duration:.22,easing:"easeOut"}),e.animate(t.figure,[{scale:squashed(o,-.2),at:.2},{scale:squashed(o,0)}],{duration:.36,easing:"back"}),e.set(t.body,{color:toColor(BLOCK_COLORS[a])}),effects.dust(e,{position:toWorld(s,r,6),count:10,size:.22*o.blockSize,speed:1.6*o.blockSize,lifetime:.48,direction:[0,1,0],spread:1.3,color:[.85,.9,.95,.6],endSize:1.8}),i&&(e.stopAnimation(t.ring),e.set(t.ring,{position:toWorld(s,r-1.5),scale:.4*o.blockSize,color:[1.6,1.4,.3,.9]}),e.animate(t.ring,{scale:2.6*o.blockSize,color:[1.6,1.4,.3,0]},{duration:.56,easing:"easeOut"}),effects.sparkle(e,{position:toWorld(s,r-4,6),count:20,size:.08*o.blockSize,speed:3*o.blockSize,lifetime:.6,gravity:4*-o.blockSize,colors:[[1,.83,.17,1],[1,1,1,1]]}))}export function fall(e,o,t,s){const r=toColor(BLOCK_COLORS[s]);e.animate(o.block,{rotation:quat.z(-(t+1.6))},{duration:.42,easing:"easeIn"}),e.animate(o.body,{color:[r[0],r[1],r[2],0]},{duration:.3}),e.animate(o.figure,{scale:.01},{duration:.3,delay:.1,easing:"easeIn"})}export function resetBlock(e,o,t,s){for(const o of[t.block,t.figure,t.body,t.ring])e.stopAnimation(o);e.set(t.block,{rotation:[0,0,0,1]}),e.set(t.figure,{scale:squashed(o,0)}),e.set(t.body,{color:toColor(BLOCK_COLORS[s])}),e.set(t.ring,{scale:0})}export function showArc(e,o,t,s){const r=s.length/2;for(let i=0;i<t.dots.length;i++)if(i<r){const a=o.blockSize*(.16-.08*i/Math.max(1,r));e.set(t.dots[i],{position:toWorld(s[2*i],s[2*i+1],4),scale:a})}else e.set(t.dots[i],{scale:0})}export const hideArc=(e,o,t)=>showArc(e,o,t,[]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./BubbleShooterConstants.js";import{aimAt,createGame,dispose,fire,reset,setLayout,setTheme,start,tick}from"./BubbleShooterGame.js";import{jsx as
|
|
1
|
+
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./BubbleShooterConstants.js";import{aimAt,createGame,dispose,fire,reset,setLayout,setTheme,start,tick}from"./BubbleShooterGame.js";import{jsx as _0x42530e}from"react/jsx-runtime";const SFX=GAME_SOUNDS.BUBBLE_SHOOTER;export const BubbleShooter=engineGame(GAME_IDS.BUBBLE_SHOOTER,e=>{const[t,s]=useLiveState(0),[r,o]=useLiveState(0),[i,a]=useLiveState(TIME_LIMIT),{theme:n,status:m,screen:S,gameOver:u}=useEngineGame(e,{gameId:GAME_IDS.BUBBLE_SHOOTER,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,r)=>{const o=getLayout(t,s,r);return setLayout(e,o),o.boardWidth},drag:(e,{phase:t,x:s,y:r,cancelled:o})=>{"end"!==t?aimAt(e,s,r):o||fire(e)},tap:(e,t,s)=>{aimAt(e,t,s),fire(e)},sounds:SFX,onStart:e=>e(SFX.START,HapticType.SUCCESS),wire:(e,t)=>{e.onScore=s,e.onTime=a,e.onBubbles=o,e.onShoot=()=>t(SFX.SHOOT,HapticType.LIGHT),e.onPop=()=>t(SFX.POP,HapticType.SUCCESS),e.onWin=()=>t(SFX.WIN,HapticType.SUCCESS),e.onLose=()=>t(SFX.GAME_OVER,HapticType.ERROR)}});return _0x42530e(EngineGameScreen,{...S,light:LIGHT,columns:[scoreColumn(t),scoreColumn(r,"BUBBLES"),timerColumn(i,n)],subtext:"Match three colored bubbles!",gameOver:u({title:"win"===m?"YOU WON!":"GAME OVER",message:"win"===m?"All bubbles cleared!":"Great shooting!",scoreLabel:"Final Score",score:t,buttonText:"Shoot Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{extrude,Path,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popAndBurst}from"../shared/EngineBlasts.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{extrude,Path,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popAndBurst}from"../shared/EngineBlasts.js";import{cacheGameAsset,createGameMesh as _0x251eca}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{AIM_ALPHA_FAR,AIM_ALPHA_NEAR,AIM_DOT_COUNT,BUBBLE_COLORS,BUBBLE_SHINE,BURST_TIME,CLASSIC_AIM,CLASSIC_BOARD,CLASSIC_BORDER,CLASSIC_RADIUS,THEMED_RADIUS,TOP_BOUNDARY}from"./BubbleShooterConstants.js";const Z_BACKDROP=-20,Z_BOARD=0,Z_RIM=.2,Z_AIM=.5,HIDDEN=0;export const toWorld=(e,o,t,s=0)=>[e.boardLeft+o-e.width/2,e.height/2-(e.boardTop+t),s];const bubbleZ=e=>e.radius+1;export const bubblePosition=(e,o,t)=>toWorld(e,o,t,bubbleZ(e));export const bubbleSize=e=>2*e.radius;const meshes=new Map,mesh=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("bubble-shooter/BubbleShooterScene:"+e,o),meshes.set(e,t)),t},bubbleMesh=()=>mesh("dot",()=>_0x251eca(shapeGeometry("sphere"),{shine:BUBBLE_SHINE})),discMesh=()=>mesh("disc",()=>_0x251eca(extrude((new Path).addCircle(0,0,.5),{depth:0}))),panelMesh=(e,o,t,s=0)=>mesh("panel:"+e+":"+o+":"+t+":"+s,()=>{const r=(new Path).addRoundedRect(0,0,e,o,t);return s>0&&r.addRoundedRect(s,s,e-2*s,o-2*s,t-s),_0x251eca(extrude(r,{depth:0,fillRule:"evenodd"}),{center:!1})}),BUBBLES=BUBBLE_COLORS.map(e=>toColor(e));export const bubbleColor=e=>BUBBLES[e%BUBBLES.length];export const aimColor=e=>toColor("classic"===e.mode?CLASSIC_AIM:e.TEXT);function spawnBoard(e,o,t){const s="classic"===t.mode,r=s?CLASSIC_RADIUS:THEMED_RADIUS,n=e=>toWorld(o,0,0,e);return[e.spawn({mesh:panelMesh(o.boardWidth,o.boardHeight,r),position:n(0),color:toColor(s?CLASSIC_BOARD:t.BOARD.SURFACE),pickable:!1}),e.spawn({mesh:panelMesh(o.boardWidth,o.boardHeight,r,1.5),position:n(.2),color:toColor(s?CLASSIC_BORDER:t.BOARD.BORDER),pickable:!1})]}export function buildScenery(e,o,t){return{backdrop:spawnBackdrop(e,o.width,o.height,-20,t),parts:spawnBoard(e,o,t)}}export function removeScenery(e,o){e.despawn(o.backdrop);for(const t of o.parts)e.despawn(t)}export function setSceneryTheme(e,o,t,s){setBackdropTheme(e,t.backdrop,s);for(const o of t.parts)e.despawn(o);t.parts=spawnBoard(e,o,s)}export function spawnBubble(e,o,t,s,r,n=1){return e.spawn({mesh:bubbleMesh(),position:bubblePosition(o,s,r),scale:bubbleSize(o)*n,color:bubbleColor(t),pickable:!1})}export function popBubble(e,o,t,s,r,n){const a=bubblePosition(o,r,n);popAndBurst(e,t,{scale:bubbleSize(o),color:bubbleColor(s),duration:BURST_TIME},{position:[a[0],a[1],a[2]+o.radius],size:bubbleSize(o),color:bubbleColor(s),glowZ:.5}).then(()=>e.despawn(t))}export function spawnAimDots(e){return Array.from({length:AIM_DOT_COUNT},()=>e.spawn({mesh:discMesh(),scale:0,pickable:!1}))}export function placeAimDots(e,o,t,s,r){const n=Math.max(1,o.shooterY-TOP_BOUNDARY);t.forEach((t,a)=>{if(3*a>=s.length)return void e.set(t,{scale:0});const i=s[3*a],p=s[3*a+1],b=Math.max(0,Math.min(1,(o.shooterY-p)/n));e.set(t,{position:toWorld(o,i,p,.5),scale:2*s[3*a+2],color:[r[0],r[1],r[2],AIM_ALPHA_NEAR+(AIM_ALPHA_FAR-AIM_ALPHA_NEAR)*b]})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./CandyCrushConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tick,touchEnd,touchMove,touchStart}from"./CandyCrushGame.js";import{jsx as
|
|
1
|
+
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./CandyCrushConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tick,touchEnd,touchMove,touchStart}from"./CandyCrushGame.js";import{jsx as _0x12afbf}from"react/jsx-runtime";const SFX=GAME_SOUNDS.CANDY_CRUSH,scoreFormatter=e=>""+e;export const CandyCrush=engineGame(GAME_IDS.CANDY_CRUSH,e=>{const[t,r]=useLiveState(0),[s,o]=useLiveState(TIME_LIMIT),{theme:a,screen:i,gameOver:n}=useEngineGame(e,{gameId:GAME_IDS.CANDY_CRUSH,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,s)=>{const o=getLayout(t,r,s);return setLayout(e,o),o.boardSize},drag:(e,{phase:t,x:r,y:s,dx:o,dy:a,cancelled:i})=>{"start"===t?touchStart(e,r,s):"move"===t?touchMove(e,o,a):touchEnd(e,o,a,i)},outcome:()=>"win",sounds:SFX,onStart:e=>e(SFX.START,HapticType.MEDIUM),wire:(e,t)=>{e.onScore=r,e.onTime=o,e.onSelect=()=>t(SFX.SELECT,HapticType.LIGHT),e.onSwap=()=>t(SFX.SWAP,HapticType.MEDIUM),e.onInvalid=()=>t(SFX.INVALID_SWAP,HapticType.WARNING),e.onMatch=e=>t(e>1?SFX.COMBO:SFX.MATCH,e>1?HapticType.HEAVY:HapticType.MEDIUM),e.onBomb=()=>t(SFX.BOMB,HapticType.HEAVY),e.onBlast=()=>t(SFX.BLAST,HapticType.HEAVY),e.onWarning=e=>t(SFX.WARNING,e<=10?HapticType.HEAVY:HapticType.MEDIUM),e.onTimeUp=()=>t(SFX.TIME_UP,HapticType.HEAVY)}});return _0x12afbf(EngineGameScreen,{...i,light:LIGHT,columns:[scoreColumn(t),timerColumn(s,a,0)],subtext:"Match 3 or more",gameOver:n({title:"TIME UP!",message:"Great crushing!",scoreLabel:"Final Score",score:t,formatter:scoreFormatter,buttonText:"Crush Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{extrude,loft,Path,quat}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popAndBurst}from"../shared/EngineBlasts.js";import{spawnRaisedBlock}from"../shared/EngineBlocks.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{extrude,loft,Path,quat}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popAndBurst}from"../shared/EngineBlasts.js";import{spawnRaisedBlock}from"../shared/EngineBlocks.js";import{cacheGameAsset,createGameMesh as _0xc3a8f3}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{BOMB,CANDY_COLORS,CELL_GAP,cellCenter,CLASSIC_BOARD,CLASSIC_BORDER,CLASSIC_CELL,CLASSIC_RADIUS,GRID_SIZE,THEMED_RADIUS}from"./CandyCrushConstants.js";const Z_BACKDROP=-20,Z_BOARD=0,Z_CELLS=.2,Z_RIM=.4;export const toWorld=(e,o,t,n=0)=>[o-e.width/2,e.height/2-t,n];const candyDepth=e=>.4*e.cell,candyZ=e=>.4+candyDepth(e)/2+1;export const dragZ=e=>candyZ(e)+2*candyDepth(e);export const candyPosition=(e,o,t,n=candyZ(e))=>{const[a,s]=cellCenter(e,o,t);return toWorld(e,a,s,n)};const meshes=new Map,mesh=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("candy-crush/CandyCrushScene:"+e,o),meshes.set(e,t)),t},panelMesh=(e,o,t=0)=>mesh("panel:"+e+":"+o+":"+t,()=>{const n=(new Path).addRoundedRect(0,0,e,e,o);return t>0&&n.addRoundedRect(t,t,e-2*t,e-2*t,o-t),_0xc3a8f3(extrude(n,{depth:0,fillRule:"evenodd"}),{center:!1})}),cellsMesh=e=>mesh("candy-cells:"+e.cell,()=>{const o=new Path;for(let t=0;t<GRID_SIZE;t++)for(let n=0;n<GRID_SIZE;n++)o.addRoundedRect(CELL_GAP+n*e.step,CELL_GAP+t*e.step,e.cell,e.cell,.2*e.cell);return _0xc3a8f3(extrude(o,{depth:0}),{center:!1})});function spawnBoard(e,o,t){const n="classic"===t.mode,a=n?CLASSIC_RADIUS:THEMED_RADIUS,s=(t,n,a)=>{return e.spawn({mesh:t,position:(s=n,toWorld(o,o.boardLeft,o.boardTop,s)),color:toColor(a),pickable:!1});var s};return[s(panelMesh(o.boardSize,a),0,n?CLASSIC_BOARD:t.BOARD.SURFACE),s(cellsMesh(o),.2,n?CLASSIC_CELL:t.BOARD.CELL_EMPTY),s(panelMesh(o.boardSize,a,1.5),.4,n?CLASSIC_BORDER:t.BOARD.BORDER)]}export function buildScenery(e,o,t){return{backdrop:spawnBackdrop(e,o.width,o.height,-20,t),parts:spawnBoard(e,o,t)}}export function removeScenery(e,o){e.despawn(o.backdrop);for(const t of o.parts)e.despawn(t)}export function setSceneryTheme(e,o,t,n){setBackdropTheme(e,t.backdrop,n);for(const o of t.parts)e.despawn(o);t.parts=spawnBoard(e,o,n)}const BODY=CANDY_COLORS.map(e=>toColor(e)),WHITE=[1,1,1,1],BOMB_BURST=[1,.85,.4,1],WHITE_HOT=[2,2,2,1],blocks=new Map;export const candyColor=e=>e===BOMB?BOMB_BURST:BODY[e%BODY.length];let bomb=null;function bombMesh(){if(bomb)return bomb;const e=e=>BODY[e%BODY.length],[o,t,n,a]=[e(0),e(1),e(2),e(3)],s=(e,o,t)=>[e[0]+(o[0]-e[0])*t,e[1]+(o[1]-e[1])*t,e[2]+(o[2]-e[2])*t,1];return bomb=_0xc3a8f3(loft([{z:-.5,bottom:-.5,top:.5,width:.5,square:7},{z:.2,bottom:-.5,top:.5,width:.5,square:7},{z:.4,bottom:-.465,top:.465,width:.465,square:6.5},{z:.5,bottom:-.39,top:.39,width:.39,square:5.5}],{around:64,smoothness:3,color:([e,r])=>{const l=Math.max(0,Math.min(1,e+.5)),d=Math.max(0,Math.min(1,r+.5));return s(s(a,n,l),s(o,t,l),d)}}),{center:!1}),bomb}export function spawnCandy(e,o,t,n,a){const s=o.cell-4,r=candyDepth(o),l=e.spawn({mesh:"none",position:n,scale:a,pickable:!1});if(t!==BOMB)return blocks.set(l,spawnRaisedBlock(e,{parent:l,position:[0,0,0],size:[s,s,r],color:candyColor(t),gloss:!1,shadow:!1})),l;const d=e.spawn({mesh:bombMesh(),parent:l,scale:[s,s,r],color:WHITE,pickable:!1});return blocks.set(l,d),e.animate(d,{scale:[1.07*s,1.07*s,r]},{duration:.5,repeat:"forever",yoyo:!0,easing:"easeInOut"}),l}export function popInBomb(e,o){e.animate(o,[{scale:.3},{scale:1.25,at:.6},{scale:1}],{duration:.35,easing:"easeOut"})}export function zap(e,o,t,n,a,s){const r=n[0]-t[0],l=n[1]-t[1],d=Math.atan2(l,r),p=Math.hypot(r,l),[i,h,u]=a===BOMB?[1,1,1]:candyColor(a),m=t[2]+candyDepth(o);e.after(s,()=>{const a=e.spawn({mesh:"cube",position:[(t[0]+n[0])/2,(t[1]+n[1])/2,m],rotation:quat.z(d),scale:[p,.08*o.cell,1],color:[i,h,u,.9],pickable:!1});e.animate(a,{scale:[p,.01,1],color:[i,h,u,0]},{duration:.3}).then(()=>{e.has(a)&&e.despawn(a)})})}export function crushCandy(e,o,t,n,a,s,r=0){const l=n===BOMB?BOMB_BURST:candyColor(n),d=blocks.get(t);return blocks.delete(t),null!=d&&e.animate(d,[{color:WHITE_HOT,at:.33},{color:n===BOMB?WHITE:l}],{duration:.3*s,delay:r}),popAndBurst(e,t,{scale:1,delay:r,duration:s},{position:[a[0],a[1],a[2]+candyDepth(o)],size:o.cell,color:l,glowZ:.4+.2})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{block,ellipsoid,lathe,loft,merge,quat,smoothCurve,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{block,ellipsoid,lathe,loft,merge,quat,smoothCurve,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x2ff915}from"../shared/EngineMeshes.js";const TAU=2*Math.PI,GLASS=[.05,.065,.09],TREAD=[.035,.035,.04],SIDEWALL=[.07,.07,.075],GUNMETAL=[.14,.14,.16],SPOKE=[.72,.73,.77],DISC=[.32,.32,.34],CALIPER=[.85,.08,.06],CARBON=[.055,.055,.065],BLACK=[.025,.025,.03],HEADLIGHT=[.95,.97,1],DRL=[1.4,1.4,1.45],TAIL_LIGHT=[.8,.03,.03],TAIL_LED=[1.2,.08,.06],CHROME=[.8,.81,.84];export const AXLE_X=[0,0,Math.SQRT1_2,Math.SQRT1_2];export function wheel(t,o,e={}){const r=o/2,s=t*(e.rim??.7),i=e.spokes??10,n=e.rimColor??GUNMETAL,a=e.spokeColor??SPOKE,h=e.gapColor??DISC;return lathe([[.001,.45*r],[.18*s,.5*r],[.92*s,.86*r],[1.02*s,.98*r],[1.04*s,r],[.94*t,.97*r],[.995*t,.7*r],[1.005*t,0],[.995*t,.7*-r],[.94*t,.97*-r],[1.04*s,-r],[1.02*s,.98*-r],[.92*s,.86*-r],[.18*s,.5*-r],[.001,.45*-r]],{segments:48,color:({u:o,position:[r,,m]})=>{const p=Math.hypot(r,m);return p>.97*t?TREAD:p>1.05*s?SIDEWALL:p>.94*s?a:p<.14*s?BLACK:p<.26*s?n:Math.cos(o*TAU*i)>.55?a:e.caliper&&p>.58*s&&p<.86*s&&r>0&&m<0&&Math.atan2(r,-m)>.35&&Math.atan2(r,-m)<1.2?CALIPER:p>.42*s?h:n}})}const WHEEL_R=.36,FRONT_AXLE=-1.36,REAR_AXLE=1.38,ARCH_R=.41,SKIRT=.17,topLine=smoothCurve([[-2.18,.48],[-2.06,.58],[-1.75,.69],[-1.36,.8],[-1.05,.78],[-.3,.8],[.55,.86],[1.38,.92],[1.9,.92],[2.1,.86],[2.18,.78]]),halfWidth=smoothCurve([[-2.18,.84],[-2.02,1.04],[-1.6,1.15],[-1.36,1.17],[-.95,1.11],[-.15,1.06],[.6,1.12],[1.1,1.19],[1.4,1.2],[1.85,1.16],[2.18,1]]),floorAt=t=>{let o=smoothCurve([[-2.18,.24],[-1.95,.17],[1.95,.17],[2.18,.3]])(t);for(const e of[-1.36,1.38]){const r=t-e;Math.abs(r)<.41&&(o=Math.max(o,.36+Math.sqrt(.41*.41-r*r)))}return o};function bodySections(){const t=new Set;for(let o=-2.18;o<2.18;o+=.1)t.add(Math.round(1e3*o)/1e3);t.add(2.18);for(const o of[-1.36,1.38])for(let e=0;e<=20;e++)t.add(Math.round(1e3*(o-.41*Math.cos(e/20*Math.PI)))/1e3);for(const o of[-1.36,1.38])for(const e of[-.425,.425])t.add(Math.round(1e3*(o+e))/1e3);return[...t].sort((t,o)=>t-o).map(sectionAt)}function sectionAt(t){const o=topLine(t),e=Math.min(floorAt(t),o-.06),r=halfWidth(t);return{z:t,bottom:e,top:o,width:r,topWidth:.86*r,square:3+1.8*Math.max(0,Math.min(1,(t+2.18)/.3))}}function surfaceX(t,o){const{bottom:e,top:r,width:s,topWidth:i=s,square:n=4}=sectionAt(t),a=Math.max(-1,Math.min(1,(o-(e+r)/2)/((r-e)/2)));return(1-Math.abs(a)**n)**(1/n)*(a>0?s+(i-s)*a:s)}const MIRROR_Z=-.9,MIRROR_BASE_Y=.7,mirrorBase=t=>[t*(surfaceX(-.9,.7)-.02),.7,-.9],mirrorCap=t=>[t*(surfaceX(-.9,.7)+.15),.7+.08,-.86],CABIN=[{z:-1.06,bottom:.55,top:.79,width:.82,topWidth:.78},{z:-.72,bottom:.55,top:.95,width:.8,topWidth:.62},{z:-.3,bottom:.55,top:1.09,width:.79,topWidth:.55},{z:.05,bottom:.55,top:1.12,width:.78,topWidth:.53},{z:.45,bottom:.55,top:1.1,width:.79,topWidth:.55},{z:.95,bottom:.6,top:1,width:.8,topWidth:.62},{z:1.4,bottom:.7,top:.93,width:.86,topWidth:.8}],ROOF=[{z:-.36,bottom:1.07,top:1.09,width:.44,square:6},{z:-.2,bottom:1.09,top:1.13,width:.52,square:6},{z:.42,bottom:1.09,top:1.125,width:.53,square:6},{z:.66,bottom:1.05,top:1.07,width:.46,square:6}];function wingGeometry(t,o,e){const r=[-1,-.92,0,.92,1].map(r=>({z:r*t/2,bottom:-e/2,top:e/2,width:o/2*(Math.abs(r)>.95?.94:1),square:2.6}));return loft(r,{around:20,smoothness:2,color:CARBON})}let car=null;export function carMeshes(){return cacheGameAsset("car-racing/CarMeshes:carMeshes",()=>carMeshesUncached())}function carMeshesUncached(){if(car)return car;const t=[{geometry:loft(bodySections(),{around:56,smoothness:2,color:([,t])=>{const o=.62+.38*Math.max(0,Math.min(1,(t-.18)/.34));return[o,o,o]}})},{geometry:loft(ROOF,{around:32,smoothness:3})}];for(const o of[-1,1])t.push({geometry:ellipsoid([.09,.05,.12]),position:mirrorCap(o)});const o=_0x2ff915(merge(t),{center:!1,shine:.9}),e=_0x2ff915(loft(CABIN,{around:40,smoothness:4,color:GLASS}),{center:!1,shine:.95}),r=[],s=wheel(.36,.26,{rim:.76,spokes:10,caliper:!0}),i=wheel(.36,.31,{rim:.76,spokes:10,caliper:!0}),n=lathe([[.001,.01],[.39,.01],[.39,-.01],[.001,-.01]],{segments:24,color:BLACK}),a=t=>topLine(t)+.004;for(const t of[-1,1]){r.push({geometry:s,position:[.98*t,.36,-1.36],rotation:AXLE_X},{geometry:i,position:[.97*t,.36,1.38],rotation:AXLE_X},{geometry:n,position:[.8*t,.39,-1.36],rotation:AXLE_X},{geometry:n,position:[.78*t,.39,1.38],rotation:AXLE_X},{geometry:ellipsoid([.3,.05,.09],BLACK),position:[.64*t,.555,-2.04],rotation:quat.y(.32*t)},{geometry:ellipsoid([.26,.034,.08],HEADLIGHT),position:[.64*t,.555,-2.06],rotation:quat.y(.32*t)},{geometry:block(.32,.012,.02,6,DRL),position:[.62*t,.585,-2.08],rotation:quat.y(.32*t)},{geometry:block(.46,.14,.08,6,BLACK),position:[.52*t,.34,-2.14],rotation:quat.y(.15*t)},{geometry:block(.3,.012,.16,6,BLACK),position:[.36*t,a(-1.58),-1.58],rotation:quat.x(-.27)},...[.47,.53,.59].map(o=>({geometry:block(.016,.022,.2,6,BLACK),position:[t*(halfWidth(-.84)-.01),o,.4*(o-.53)-.84]})),{geometry:ellipsoid([.02,.08,.3],BLACK),position:[1.115*t,.58,.72]},{geometry:block(.06,.06,2,6,CARBON),position:[1.05*t,.2,.01]},{geometry:tube([mirrorBase(t),[t*(surfaceX(-.9,.7)+.05),.76,-.88],mirrorCap(t)],{radius:.02,sides:8,smoothness:3}),color:CARBON},{geometry:block(.012,.16,.34,6,CARBON),position:[.87*t,1.07,1.98]},{geometry:tube([[.42*t,.93,2.04],[.42*t,1.08,1.96],[.42*t,1.115,1.99]],{radius:.018,shape:t=>.45+.55*Math.abs(Math.cos(t*TAU)),sides:10,smoothness:4}),color:CARBON},{geometry:tube([[.62*t,.79,2.17],[.86*t,.79,2.15],[.96*t,.72,2.11],[.94*t,.62,2.09]],{radius:.022,sides:8,smoothness:4}),color:TAIL_LED});for(const o of[.2,.34])r.push({geometry:tube([[t*o,.3,2.04],[t*o,.3,2.2]],{radius:.042,sides:14,smoothness:1,color:CHROME,capColor:BLACK})})}r.push({geometry:wingGeometry(1.74,.3,.035),position:[0,1.1,1.98],rotation:quat.multiply(quat.x(.08),quat.y(Math.PI/2))},{geometry:block(1.85,.035,.26,8,CARBON),position:[0,.19,-2.04]},{geometry:block(.5,.09,.06,6,BLACK),position:[0,.31,-2.18]},{geometry:block(1.24,.03,.04,8,TAIL_LIGHT),position:[0,.79,2.18]},{geometry:block(1.1,.08,.03,6,BLACK),position:[0,.5,2.18]},{geometry:block(1.62,.13,.26,6,CARBON),position:[0,.24,2.06]},{geometry:block(1.84,.12,3.5,4,BLACK),position:[0,.22,0]});for(let t=-2;t<=2;t++)r.push({geometry:block(.02,.1,.22,4,BLACK),position:[.28*t,.25,2.08]});for(let t=0;t<6;t++)r.push({geometry:block(.9,.012,.035,4,BLACK),position:[0,.93,1.48+.075*t]});const h=_0x2ff915(merge(r),{center:!1,shine:.4});return car={body:o,glass:e,trim:h},car}export const CAR_FOOTPRINT={length:4.36,halfWidth:t=>Math.max(0,halfWidth(t)-.03)};export const CAR_LAMPS={headlights:[-.64,.64].map(t=>[t,.555,-2.08]),headlightSize:[.46,.06,.04],tail:[0,.79,2.2],tailSize:[1.9,.04,.03]};const BARK=[.45,.3,.18],NEEDLES_DARK=[.25,.6,.3],NEEDLES=[.32,.7,.35];let tree=null;export function treeMesh(){return cacheGameAsset("car-racing/CarMeshes:treeMesh",()=>treeMeshUncached())}function treeMeshUncached(){if(tree)return tree;const t=lathe([[.001,.4],[.07,.4],[.09,0],[.001,0]],{segments:8,color:BARK}),o=(t,o,e,r)=>({geometry:lathe([[.001,o],[e,t],[.001,t]],{segments:7,color:r})});return tree=_0x2ff915(merge([{geometry:t},o(.22,.72,.75,NEEDLES_DARK),o(.5,.98,.56,NEEDLES),o(.76,1.2,.36,NEEDLES_DARK)]),{center:!1}),tree}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import _0x2741fc,{useCallback,useEffect,useRef,useState}from"react";import{haptics}from"@nayan-ui/engine";import{resolveGameTheme}from"../../services/ThemeService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,textColumn}from"../shared/EngineHud.js";import{GameLoading}from"../shared/GameLoading.js";import{GameLoadingTransition}from"../shared/GameLoadingTransition.js";import{useGameResource}from"../shared/useGameResource.js";import{AUTOPLAY,DAY_LIGHT,EDGE,getCachedAssets,LIVES,loadAssets,NIGHT_LIGHT,NIGHT_SKY,SKY,STEER_WIDTH,TRACK_LENGTH}from"./CarRacingConstants.js";import{createGame,dispose,setAudible,setNight,start,steer,tick}from"./CarRacingGame.js";import{jsx as _0x7ee096}from"react/jsx-runtime";export{preloadRacing as preloadCarRacing}from"./CarRacingConstants.js";const RESULTS_DELAY=1200,Run=_0x2741fc.memo(({assets:e,night:t,onRestart:s,settings:a,onSettingsChange:r,onEndGame:n,onReplayGame:o,onShare:i,onShareScreenshot:u,onShowLeaderboard:m,bannerAd:l})=>{const g=useRef(t),d=useGameResource(()=>createGame(e,g.current),e=>()=>{"playing"===e.phase&&I("cancel"),dispose(e)});useEffect(()=>{setNight(d,t)},[d,t]);const f=useRef(1),[S,G]=useState("ready"),[h,C]=useState(!1),[R,E]=useState(0),[T,A]=useState(LIVES),[p,_]=useState(TRACK_LENGTH),L=useRef(!1),b=useRef(n);b.current=n;const I=useCallback(e=>{b.current&&!L.current&&(L.current=!0,b.current({status:e,score:d.score.toString()}))},[d]);useEffect(()=>{haptics.enabled=a.enableHaptics},[a.enableHaptics]),useEffect(()=>{d.onPhase=G,d.onLives=A,d.onDistance=_,d.onScore=E},[d]),useEffect(()=>{if("over"!==S)return;I(d.lives>0?"win":"lose");const e=setTimeout(()=>C(!0),1200);return()=>clearTimeout(e)},[S,d,I]),useEffect(()=>{if(!AUTOPLAY||"playing"===S)return;const e=setTimeout("ready"===S?()=>start(d):s,"ready"===S?1500:3e3);return()=>clearTimeout(e)},[S,d,s]);const H=useCallback(e=>setAudible(d,e),[d]),D=useCallback(e=>tick(d,e),[d]),x=useCallback(({phase:e,dx:t})=>steer(d,e,t,2*EDGE/(STEER_WIDTH*f.current)),[d]),k=useCallback(()=>{L.current=!1,start(d)},[d]),v=useCallback(()=>{I("cancel"),s()},[I,s]),N=useCallback(()=>{o?.(),s()},[o,s]),j=T>0;return _0x7ee096(EngineGameScreen,{onAudioChange:H,gameId:GAME_IDS.CAR_RACING,settings:a,onSettingsChange:r,onShare:u??i,onShowLeaderboard:m,bannerAd:l,source:d.world,feedback:d.hudFeedback,camera:d.camera,light:t?NIGHT_LIGHT:DAY_LIGHT,background:t?NIGHT_SKY:SKY,fog:.0075,onUpdate:D,onDrag:x,onResize:e=>{f.current=e},columns:[scoreColumn(R),livesColumn(T,LIVES),textColumn("TRACK",p+" m")],playing:"playing"===S,subtext:"Dodge traffic to score!",onStart:k,onStop:v,gameOver:h?{title:j?"FINISHED!":"CRASHED!",message:j?"You crossed the finish line! Great driving!":"Out of lives "+(TRACK_LENGTH-p)+" m into the "+TRACK_LENGTH+" m race.",scoreLabel:"Final Score",score:R,buttonText:"Race Again!",onPlayAgain:N,onShare:u}:null})});Run.displayName="CarRacingRun";export const CarRacing=engineGame(GAME_IDS.CAR_RACING,e=>{const t=e.settings,s=resolveGameTheme(t.theme),[a,r]=useState(0),[n,o]=useState(getCachedAssets),[i,u]=useState(null);useEffect(()=>{if(n)return;let e=!0;return loadAssets().then(t=>e&&o(t)).catch(t=>e&&u(t.message)),()=>{e=!1}},[n]);const m=useCallback(()=>r(e=>e+1),[]),l=s.isDark;return _0x7ee096(GameLoadingTransition,{ready:!!n,loader:_0x7ee096(GameLoading,{gameId:GAME_IDS.CAR_RACING,theme:t.theme,offset:t.offset,error:!!i,message:i??void 0}),children:n&&_0x7ee096(Run,{...e,settings:t,assets:n,night:l,onRestart:m},a)})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{block,merge,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x59d587}from"../shared/EngineMeshes.js";import{CAR_LAMPS}from"./CarMeshes.js";import{BEHIND,LAMP,LAMP_LIT,LANE_W,LINE,RAIL,ROAD_HALF,RS,SEG_LEN,SEGMENTS}from"./CarRacingConstants.js";import{sceneryMeshes}from"./CarRacingScenery.js";export const rand=(e,o)=>e+Math.random()*(o-e);export const pick=e=>e[Math.floor(Math.random()*e.length)];export const clamp=(e,o,s)=>Math.max(o,Math.min(s,e));const fadeIn=e=>Math.min(1,Math.max(0,(e-60)/200)),curvature=e=>(.0052*Math.sin(e/95)+.0034*Math.sin(e/41+1.3))*fadeIn(e),elevation=e=>(7*Math.sin(e/150)+2.5*Math.sin(e/57+.7))*fadeIn(e);export const newSample=()=>({x:0,y:0,z:0,heading:0,pitch:0});export class Track{xs=[0];zs=[0];hs=[0];ensure(e){for(let o=this.xs.length;o<=e+1;o++){const e=this.hs[o-1]+curvature(o);this.hs.push(e),this.xs.push(this.xs[o-1]+Math.sin(e)),this.zs.push(this.zs[o-1]-Math.cos(e))}}sample(e,o){if(e<0)return o.x=0,o.y=0,o.z=-e,o.heading=0,o.pitch=0,o;const s=e;this.ensure(s);const t=Math.floor(s),n=s-t;return o.x=this.xs[t]+(this.xs[t+1]-this.xs[t])*n,o.z=this.zs[t]+(this.zs[t+1]-this.zs[t])*n,o.heading=this.hs[t]+(this.hs[t+1]-this.hs[t])*n,o.y=elevation(s),o.pitch=Math.atan(elevation(s+.5)-elevation(s-.5)),o}}export const forwardOf=e=>[Math.sin(e),0,-Math.cos(e)];export const rightOf=e=>[Math.cos(e),0,Math.sin(e)];export function placeAt(e,o,s,t){return t[0]=e.x+Math.cos(e.heading)*o,t[1]=e.y+s,t[2]=e.z+Math.sin(e.heading)*o,t}export function orient(e,o,s=0,t=0,n=[0,0,0,1]){const i=-(e+s)/2,r=Math.sin(i),a=Math.cos(i),h=Math.sin(o/2),p=Math.cos(o/2),l=Math.sin(t/2),m=Math.cos(t/2),d=a*h,S=r*p,f=-r*h,R=a*p;return n[0]=d*m+S*l,n[1]=-d*l+S*m,n[2]=R*l+f*m,n[3]=R*m-f*l,n}export function spawnCar(e,o,s,t,n){const i=o.car,r=e.spawn({mesh:"none",position:t}),a=[0,-i.size[1]/2,0],h={root:r,body:e.spawn({mesh:i.body,parent:r,position:a,color:s}),glass:e.spawn({mesh:i.glass,parent:r,position:a}),trim:e.spawn({mesh:i.trim,parent:r,position:a}),lights:[]};return setCarNight(e,h,n,i.size[1]),h}export function setCarNight(e,o,s,t){for(const s of o.lights)e.despawn(s);if(o.lights.length=0,!s||!e.has(o.root))return;const n=-t/2;for(const[s,t,i]of CAR_LAMPS.headlights)o.lights.push(e.spawn({mesh:"cube",parent:o.root,position:[s,n+t,i],scale:CAR_LAMPS.headlightSize,color:[2,1.95,1.7],pickable:!1}));const[i,r,a]=CAR_LAMPS.tail;o.lights.push(e.spawn({mesh:"cube",parent:o.root,position:[i,n+r,a],scale:CAR_LAMPS.tailSize,color:[2,.16,.1],pickable:!1}))}const segmentSample=newSample();export function buildRoad(e,o){const s=[];for(let t=0;t<SEGMENTS;t++){const n=e.spawn({mesh:"none",physics:{type:"fixed",size:[90,.4,SEG_LEN+.4],layer:4,mask:0,friction:.7}}),i=(o,s,t,i,r)=>e.spawn({mesh:o,parent:n,position:s,scale:t,color:i,texture:r,pickable:!1}),r=t%2*.004,a=SEG_LEN+.35;i("cube",[0,RS-.05+r,0],[2*ROAD_HALF+.6,.1,a],[1,1,1],o.asphalt);for(const e of[-1,1]){i(o.scenery.grassGround,[e*(ROAD_HALF+31),RS-.04+r,0],[62,1,SEG_LEN+4],t%2?[1,1,1]:[.94,.97,.92],o.grass);for(const o of[-SEG_LEN/4,SEG_LEN/4])i("cube",[e*(ROAD_HALF+.2),RS+.01+r,o],[.5,.08,SEG_LEN/2],(2*t+(o>0?1:0))%2==0?[.85,.12,.1]:[.95,.95,.95]);i("cube",[e*(ROAD_HALF-.12),RS+.004+r,0],[.14,.02,a],LINE),i("cube",[e*(LANE_W/2),RS+.004+r,0],[.14,.02,2.6],LINE),i("cube",[e*(ROAD_HALF+1.1),RS+.55,0],[.1,.26,a],RAIL),i("cube",[e*(ROAD_HALF+1.15),RS+.3,0],[.12,.6,.12],[.45,.46,.5])}s.push({root:n,s:(t-BEHIND)*SEG_LEN,props:[],lights:[]})}return s}export function buildHorizon(e,o){const s=e.spawn({mesh:"none"});for(let o=0;o<26;o++){const t=o/26*Math.PI*2+rand(-.08,.08),n=rand(150,210),i=rand(40,75);e.spawn({mesh:"sphere",parent:s,position:[Math.sin(t)*n,.32*-i,-Math.cos(t)*n],scale:[1.6*i,.9*i,1.6*i],color:[.3+rand(0,.06),.52+rand(0,.08),.24],pickable:!1})}for(let o=0;o<18;o++){const t=o/18*Math.PI*2+rand(-.1,.1),n=rand(45,80);e.spawn({mesh:"cone",parent:s,position:[330*Math.sin(t),.35*n-10,330*-Math.cos(t)],scale:[1.7*n,n,1.7*n],color:[.45+rand(0,.08),.55+rand(0,.06),.68],pickable:!1})}return setHorizonNight(e,s,o),s}const nightSkies=new WeakMap;export function setHorizonNight(e,o,s){let t=nightSkies.get(e);!t&&(t=new Map,nightSkies.set(e,t));const n=t.get(o)??[];for(const o of n)e.despawn(o);n.length=0;for(let t=0;t<5;t++){const i=1.256*t+.7;n.push(e.spawn({mesh:sceneryMeshes().cloud,parent:o,position:[160*Math.sin(i),35+t%3*8,160*-Math.cos(i)],scale:[1.4+t%2*.5,1,1.1],color:s?[.55,.58,.68]:[1.4,1.43,1.45],pickable:!1}))}if(s){n.push(e.spawn({mesh:"sphere",parent:o,position:[-120,120,-230],scale:26,color:[2,1.95,1.8],pickable:!1}));for(let s=0;s<70;s++){const s=rand(0,2*Math.PI);n.push(e.spawn({mesh:"sphere",parent:o,position:[280*Math.sin(s),rand(50,190),280*-Math.cos(s)],scale:rand(.6,1.4),color:[2,2,2.2],pickable:!1}))}}t.set(o,n)}export function placeSegment(e,o){const s=e.track.sample(o.s,segmentSample);e.world.set(o.root,{position:[s.x,s.y-RS,s.z],rotation:orient(s.heading,s.pitch)})}const zoneAt=e=>["city","suburb","country"][Math.floor(Math.max(0,e+300)/600)%3],HOUSE_WALLS=[[.95,.9,.78],[.86,.9,.95],[.95,.82,.75],[.9,.93,.82]],ROOFS=[[.62,.2,.15],[.35,.25,.2],[.3,.32,.38]];export function spawnProps(e,o){const{world:s,assets:t}=e,n=e=>{const t=s.spawn({parent:o.root,pickable:!1,...e});return o.props.push(t),t},i=(s,t,i)=>{const r=n({...s,color:e.night?i:t});o.lights.push({entity:r,day:t,night:i})},r=Math.round(o.s/SEG_LEN),a=zoneAt(o.s),h=()=>rand(-SEG_LEN/2,SEG_LEN/2),p=Math.abs(r),l=t.scenery,m=(e,o,s,t,r,a)=>{n({mesh:l.podium,position:[e,RS,o],scale:[s,1,r]}),n({mesh:l.roofs[a%2],position:[e,RS+t,o],scale:[s,1,r]}),n({mesh:l.facades[a%3],position:[e,RS+t/2,o],scale:[s,t,r]}),i({mesh:l.windows,position:[e,RS+t/2,o],scale:[s,t,r]},[1,1,1,0],[1,1,1])};for(const e of[-1,1]){if(Math.random()<.55&&n({mesh:"sphere",position:[e*(ROAD_HALF+rand(2.2,3.4)),RS+.25,h()],scale:[rand(1,1.8),rand(.7,1.1),rand(1,1.8)],color:[.18+rand(0,.08),.4+rand(0,.12),.14]}),"city"===a){if(n({mesh:l.pavement,position:[e*(ROAD_HALF+3.2),RS+.05,0]}),(r+(e>0?1:0))%2==0){const o=rand(14,42),s=rand(.72,1),i=e*(ROAD_HALF+rand(10,15)),r=rand(-1,1),a=rand(8,12),h=rand(8,11);if(n({mesh:"cube",texture:t.facade,position:[i,RS+o/2,r],scale:[a,o,h],color:[s,s*rand(.92,1),s*rand(.86,1)]}),m(i,r,a,o,h,p+(e>0?1:0)),Math.random()<.5){const o=rand(20,55);n({mesh:"cube",texture:t.facade,position:[e*(ROAD_HALF+rand(24,32)),RS+o/2,rand(-2,2)],scale:[rand(9,14),o,rand(9,12)],color:[.8,.82,.88]})}}const o=p+(e>0?2:0),s=e*(ROAD_HALF+3.2);o%5==1?(n({mesh:l.planter,position:[s,RS+.1,0]}),n({mesh:"cylinder",position:[s,RS+1.7,0],scale:[.28,2.7,.28],color:[.35,.26,.16]}),n({mesh:"sphere",position:[s,RS+3.6,0],scale:[2.1,2.7,2],color:[.23,.41,.19]}),n({mesh:"sphere",position:[s+.45*e,RS+3.2,.35],scale:[1.5,1.8,1.5],color:[.27,.44,.2]})):o%5==3&&(n({mesh:l.planter,position:[s,RS+.1,0]}),n({mesh:l.flowers,position:[s,RS+.67,0],scale:[1.3,1.2,1.3]})),o%9==4&&(n({mesh:l.bench,position:[s,RS+.12,0],rotation:[0,Math.sin(e*Math.PI/4),0,Math.cos(e*Math.PI/4)]}),n({mesh:l.bin,position:[s,RS+.12,1.8]})),o%19==8&&n({mesh:l.shelter,position:[s,RS+.12,0]})}else if("suburb"===a)if((r+(e>0?1:0))%3==0){const t=e*(ROAD_HALF+rand(10,14)),i=pick(HOUSE_WALLS),r=t-2.52*e;n({mesh:"cube",position:[t,RS+1.6,0],scale:[5,3.2,5.6],color:i}),n({mesh:l.house,position:[t,RS,0]}),n({mesh:l.flowers,position:[r-.45*e,RS,-1],scale:[.8,1,1.4]}),n({mesh:"cube",position:[e*(ROAD_HALF+7.3),RS-.005,.9],scale:[4.5,.035,1.8],color:[.48,.49,.46]}),n({mesh:"cube",position:[r,RS+.95,.9],scale:[.06,1.9,.9],color:[.35,.22,.14]});for(const e of[-1.4,2.2])n({mesh:"cube",position:[r,RS+2,e],scale:[.06,.8,.9],color:[.55,.7,.85]});const a=s.spawn({mesh:"none",parent:o.root,pickable:!1,position:[t,RS+3.2,0],scale:[1,.55,1]});o.props.push(a),o.props.push(s.spawn({mesh:"cube",parent:a,pickable:!1,rotation:[0,0,Math.sin(Math.PI/8),Math.cos(Math.PI/8)],scale:[4,4,6.2],color:pick(ROOFS)})),n({mesh:"cube",position:[e*(ROAD_HALF+6.5),RS+.35,0],scale:[.08,.6,SEG_LEN],color:[.95,.95,.95]})}else{const o=e*(ROAD_HALF+rand(7,16)),s=h(),t=rand(1.6,2.6);n({mesh:"cylinder",position:[o,RS+t/2,s],scale:[.35,t,.35],color:[.42,.29,.17]}),n({mesh:"sphere",position:[o,RS+t+1.1,s],scale:rand(2.6,3.6),color:[.24+rand(0,.08),.5+rand(0,.12),.2]})}else{for(let o=0;o<3;o++)n({mesh:t.tree,position:[e*(ROAD_HALF+rand(5,28)),RS,h()],scale:rand(2.4,4.2),color:[1,1,1]});Math.random()<.35&&n({mesh:"sphere",position:[e*(ROAD_HALF+rand(4,12)),RS,h()],scale:[rand(.8,1.8),rand(.5,.9),rand(.8,1.6)],color:[.52,.5,.48]});for(const o of[.45,.85])n({mesh:"cube",position:[e*(ROAD_HALF+4.2),RS+o,0],scale:[.07,.1,SEG_LEN+.3],color:[.48,.34,.2]});n({mesh:"cube",position:[e*(ROAD_HALF+4.2),RS+.5,0],scale:[.12,1,.12],color:[.4,.28,.16]}),r%6==(e>0?0:3)&&(n({mesh:"cylinder",position:[e*(ROAD_HALF+7),RS+4.5,0],scale:[.22,9,.22],color:[.38,.27,.18]}),n({mesh:"cube",position:[e*(ROAD_HALF+7),RS+8.4,0],scale:[2.2,.14,.14],color:[.38,.27,.18]}))}if(p%2==0){const o=e*(ROAD_HALF+("city"===a?1.8:3.2));n({mesh:l.grass,position:[o,RS-.025,-1.6],scale:"city"===a?.8:1.4}),"city"!==a&&n({mesh:l.grass,position:[o+.8*e,RS-.025,1.6],scale:1.1})}"country"===a&&p%4==1&&n({mesh:l.flowers,position:[e*(ROAD_HALF+3.1),RS-.02,0],scale:1.1}),"city"===a&&p%3==0&&n({mesh:l.drain,position:[e*(ROAD_HALF-.4),RS+.008,0]}),p%2==1&&i({mesh:"cube",position:[e*(ROAD_HALF+1.04),RS+.61,0],scale:[.1,.08,.07]},[.9,.88,.75],[1.45,1.3,.8])}const d=r%2?1:-1;if(r%("city"===a?2:4)==0&&(n({mesh:"cylinder",position:[d*(ROAD_HALF+1.7),RS+3.2,0],scale:[.16,6.4,.16],color:[.35,.36,.4]}),n({mesh:"cube",position:[d*(ROAD_HALF+.8),RS+6.35,0],scale:[1.9,.1,.12],color:[.35,.36,.4]}),i({mesh:"cube",position:[d*(ROAD_HALF-.05),RS+6.25,0],scale:[.7,.1,.32]},LAMP,LAMP_LIT)),p%17==7){const e=d*(ROAD_HALF+4.6);for(const o of[-1.65,1.65])n({mesh:"cylinder",position:[e+o,RS+2,0],scale:[.1,4,.1],color:[.4,.44,.42]});n({mesh:l.routeSign,position:[e,RS+4.15,0]}),i({text:"city"===a?"CITY":"suburb"===a?"HILLS":"FOREST",font:t.font,position:[e-.35,RS+3.92,.09],scale:.48,letterSpacing:.04},[.94,.95,.88],[1.4,1.4,1.25])}if(r%11==5){const e=-d*(ROAD_HALF+6);for(const o of[-2.2,2.2])n({mesh:"cylinder",position:[e+o,RS+2.5,0],scale:[.25,5,.25],color:[.3,.3,.34]});i({mesh:"cube",texture:pick(t.ads),position:[e,RS+6,0],scale:[7.5,3.6,.25],rotation:[0,Math.sin(.35*d/2),0,Math.cos(.35*d/2)]},[1,1,1],[1.7,1.7,1.7])}}export function recycleRoad(e,o,s){for(const t of o)if(!(t.s>=s-SEG_LEN*BEHIND)){t.s+=SEGMENTS*SEG_LEN,placeSegment(e,t);for(const o of t.props)e.world.despawn(o);t.props.length=0,t.lights.length=0,spawnProps(e,t)}}const FLASH=[2,1.95,1.7,.9],FIREBALL=[[2,1.7,.8,.6],[2,1.45,.5,.6],[2,1.2,.35,.6]],FLAME_CORE=[[2,1.85,1.1,.5],[2,1.7,.75,.5]],FLAME=[[2,1.6,.55,.42],[2,1.35,.38,.42],[2,1.1,.25,.42]],COOLED=[2,.35,.08,0],SMOKE=[[.1,.095,.09,.5],[.14,.13,.12,.45],[.18,.17,.16,.4]],SMOKE_END=[.45,.44,.43,0],EMBER=[[2,1.4,.5],[2,1,.25]],DEBRIS=[[.06,.06,.07],[.18,.18,.2]];export const burning=(e,o)=>({root:e,until:o,flame:0,smoke:0,ember:0});export function explode(e,o){const s=[0,1,0];e.burst({position:o,mesh:"flame",count:3,size:3.2,speed:.5,lifetime:.22,gravity:0,color:FLASH,endSize:1.8,endColor:[2,1.4,.4,0]}),e.burst({position:o,mesh:"flame",count:30,size:1.1,speed:4.5,lifetime:.85,gravity:3,color:FIREBALL,endSize:2.2,endColor:COOLED}),e.burst({position:[o[0],o[1]+.4,o[2]],mesh:"flame",count:14,size:.9,speed:5.5,lifetime:.9,gravity:5,direction:s,spread:.55,color:FLAME,endSize:1.4,endColor:COOLED}),e.burst({position:o,mesh:"flame",count:30,size:.16,speed:14,lifetime:.7,gravity:-9.81,color:EMBER,endSize:.3,endColor:[2,.3,.05,0]}),e.burst({position:o,count:10,size:.14,speed:8,lifetime:1.4,gravity:-9.81,direction:s,spread:1.2,color:DEBRIS}),e.burst({position:[o[0],o[1]+1.4,o[2]],mesh:"puff",count:6,size:1,speed:2,lifetime:2,gravity:2,direction:s,spread:.6,color:SMOKE,endSize:3,endColor:SMOKE_END})}const firePosition=[0,0,0],wreckVelocity=[0,0,0],FLAMES_PER_SECOND=120,SMOKE_PER_SECOND=10,EMBERS_PER_SECOND=14,FIRE_MIN_DISTANCE=5;export function burn(e,o,s,t,n){const{eye:i,target:r}=o,a=r[0]-i[0],h=r[1]-i[1],p=r[2]-i[2],l=Math.hypot(a,h,p)||1;for(let o=s.length-1;o>=0;o--){const r=s[o],m=e.worldPosition(r.root,firePosition);if(!m||t>r.until){s.splice(o,1);continue}if(((m[0]-i[0])*a+(m[1]-i[1])*h+(m[2]-i[2])*p)/l<5)continue;const d=e.velocity(r.root,wreckVelocity)??[0,0,0],S=(o,s,t,n,i)=>{const r=[d[0],d[1]+o,d[2]],a=Math.hypot(r[0],r[1],r[2]);e.burst({position:[m[0]+rand(-t,t),m[1]+s,m[2]+rand(-n,n)],mesh:i.mesh,count:1,size:i.size,speed:a,lifetime:i.lifetime,gravity:1.5*o,direction:[r[0]/a,r[1]/a,r[2]/a],spread:i.spread,color:i.color,endSize:i.endSize,endColor:i.endColor})};for(r.flame+=120*n;r.flame>=1;)r.flame-=1,S(4.2,.8,.75,1.5,{mesh:"flame",size:rand(.8,1.1),lifetime:rand(.45,.65),color:FLAME,endSize:.25,endColor:COOLED,spread:.2}),Math.random()<.5&&S(1.5,.7,.55,1.2,{mesh:"flame",size:rand(.7,.95),lifetime:rand(.18,.28),color:FLAME_CORE,endSize:.7,endColor:[2,1.4,.4,0],spread:.2});for(r.smoke+=10*n;r.smoke>=1;)r.smoke-=1,S(2.6,2,.5,1,{mesh:"puff",size:rand(1,1.3),lifetime:rand(1.6,2.1),color:SMOKE,endSize:3,endColor:SMOKE_END,spread:.35});for(r.ember+=14*n;r.ember>=1;)r.ember-=1,S(4.5,1,.6,1.3,{mesh:"flame",size:.14,lifetime:rand(.8,1.3),color:EMBER,endSize:.3,endColor:[2,.3,.05,0],spread:.6})}}const GANTRY_X=ROAD_HALF+1.7,GANTRY_H=6.4,BANNER_Y=5.5,markerMeshes=new Map,markerMesh=(e,o)=>{let s=markerMeshes.get(e);return s||markerMeshes.set(e,s=cacheGameAsset("car-racing/CarRacingScene:"+e,o)),s};function gantryParts(e,o){const s=[];for(const o of[-1,1])s.push({geometry:block(.55,6.4,.55,6),position:[o*GANTRY_X,3.2,0],color:e}),s.push({geometry:block(.9,.3,.9,6),position:[o*GANTRY_X,.15,0],color:e});return s.push({geometry:block(2*GANTRY_X+.9,.45,.6),position:[0,6.5,0],color:e},{geometry:block(2*GANTRY_X-1.4,1.25,.12),position:[0,5.5,.08],color:o},{geometry:block(2*GANTRY_X-2.2,.08,.04),position:[0,5,.15],color:[1,.9,.5]},{geometry:block(2*GANTRY_X-2.2,.08,.04),position:[0,6,.15],color:[1,.9,.5]}),s}const finishMesh=()=>markerMesh("finish",()=>{const e=[],o=.7,s=Math.ceil((2*ROAD_HALF+.6)/o);for(let t=0;t<s;t++)for(let n=0;n<2;n++)e.push({geometry:block(o,.03,o,8),position:[(t-(s-1)/2)*o,.016,(n-.5)*o],color:(t+n)%2?[.96,.96,.94]:[.08,.08,.1]});const t=[-4,-2,0,2,4].map((e,o)=>({geometry:tube([[e,6.25,.32],[e+.06,6.4-.8,.33]],{radius:e=>.2*(1-e),shape:e=>.2+.8*Math.abs(Math.cos(e*Math.PI*2)),sides:6}),color:[[.2,.5,.95],[1,.8,.15],[.2,.75,.3]][o%3]}));return _0x59d587(merge([...e,...gantryParts([.95,.72,.2],[.85,.12,.14]),...t]),{center:!1,shine:.5})}),startMesh=()=>markerMesh("start",()=>_0x59d587(merge([{geometry:block(2*ROAD_HALF+.4,.03,.5,8),position:[0,.016,0],color:[.96,.96,.92]}]),{center:!1,shine:.3})),markerSample=newSample(),markerAt=[0,0,0];export function spawnRaceMarkers(e,o,s,t,n){const i=(s,t,i)=>{const r=o.sample(t,markerSample);placeAt(r,0,0,markerAt);const a=e.spawn({mesh:s,position:[markerAt[0],markerAt[1],markerAt[2]],rotation:orient(r.heading,r.pitch),pickable:!1});return i?(e.spawn({text:i,font:n,parent:a,position:[0,5.14,.16],scale:.78,color:[1,1,1],letterSpacing:.12,pickable:!1}),a):a};return{start:i(startMesh(),s),finish:i(finishMesh(),t,"FINISH")}}export function*warmAssets(){yield finishMesh,yield startMesh}
|
|
1
|
+
"use strict";import{block,merge,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x6fd5e1}from"../shared/EngineMeshes.js";import{CAR_LAMPS}from"./CarMeshes.js";import{BEHIND,LAMP,LAMP_LIT,LANE_W,LINE,RAIL,ROAD_HALF,RS,SEG_LEN,SEGMENTS}from"./CarRacingConstants.js";import{sceneryMeshes}from"./CarRacingScenery.js";export const rand=(e,o)=>e+Math.random()*(o-e);export const pick=e=>e[Math.floor(Math.random()*e.length)];export const clamp=(e,o,s)=>Math.max(o,Math.min(s,e));const fadeIn=e=>Math.min(1,Math.max(0,(e-60)/200)),curvature=e=>(.0052*Math.sin(e/95)+.0034*Math.sin(e/41+1.3))*fadeIn(e),elevation=e=>(7*Math.sin(e/150)+2.5*Math.sin(e/57+.7))*fadeIn(e);export const newSample=()=>({x:0,y:0,z:0,heading:0,pitch:0});export class Track{xs=[0];zs=[0];hs=[0];ensure(e){for(let o=this.xs.length;o<=e+1;o++){const e=this.hs[o-1]+curvature(o);this.hs.push(e),this.xs.push(this.xs[o-1]+Math.sin(e)),this.zs.push(this.zs[o-1]-Math.cos(e))}}sample(e,o){if(e<0)return o.x=0,o.y=0,o.z=-e,o.heading=0,o.pitch=0,o;const s=e;this.ensure(s);const t=Math.floor(s),n=s-t;return o.x=this.xs[t]+(this.xs[t+1]-this.xs[t])*n,o.z=this.zs[t]+(this.zs[t+1]-this.zs[t])*n,o.heading=this.hs[t]+(this.hs[t+1]-this.hs[t])*n,o.y=elevation(s),o.pitch=Math.atan(elevation(s+.5)-elevation(s-.5)),o}}export const forwardOf=e=>[Math.sin(e),0,-Math.cos(e)];export const rightOf=e=>[Math.cos(e),0,Math.sin(e)];export function placeAt(e,o,s,t){return t[0]=e.x+Math.cos(e.heading)*o,t[1]=e.y+s,t[2]=e.z+Math.sin(e.heading)*o,t}export function orient(e,o,s=0,t=0,n=[0,0,0,1]){const i=-(e+s)/2,r=Math.sin(i),a=Math.cos(i),h=Math.sin(o/2),p=Math.cos(o/2),l=Math.sin(t/2),m=Math.cos(t/2),d=a*h,S=r*p,f=-r*h,R=a*p;return n[0]=d*m+S*l,n[1]=-d*l+S*m,n[2]=R*l+f*m,n[3]=R*m-f*l,n}export function spawnCar(e,o,s,t,n){const i=o.car,r=e.spawn({mesh:"none",position:t}),a=[0,-i.size[1]/2,0],h={root:r,body:e.spawn({mesh:i.body,parent:r,position:a,color:s}),glass:e.spawn({mesh:i.glass,parent:r,position:a}),trim:e.spawn({mesh:i.trim,parent:r,position:a}),lights:[]};return setCarNight(e,h,n,i.size[1]),h}export function setCarNight(e,o,s,t){for(const s of o.lights)e.despawn(s);if(o.lights.length=0,!s||!e.has(o.root))return;const n=-t/2;for(const[s,t,i]of CAR_LAMPS.headlights)o.lights.push(e.spawn({mesh:"cube",parent:o.root,position:[s,n+t,i],scale:CAR_LAMPS.headlightSize,color:[2,1.95,1.7],pickable:!1}));const[i,r,a]=CAR_LAMPS.tail;o.lights.push(e.spawn({mesh:"cube",parent:o.root,position:[i,n+r,a],scale:CAR_LAMPS.tailSize,color:[2,.16,.1],pickable:!1}))}const segmentSample=newSample();export function buildRoad(e,o){const s=[];for(let t=0;t<SEGMENTS;t++){const n=e.spawn({mesh:"none",physics:{type:"fixed",size:[90,.4,SEG_LEN+.4],layer:4,mask:0,friction:.7}}),i=(o,s,t,i,r)=>e.spawn({mesh:o,parent:n,position:s,scale:t,color:i,texture:r,pickable:!1}),r=t%2*.004,a=SEG_LEN+.35;i("cube",[0,RS-.05+r,0],[2*ROAD_HALF+.6,.1,a],[1,1,1],o.asphalt);for(const e of[-1,1]){i(o.scenery.grassGround,[e*(ROAD_HALF+31),RS-.04+r,0],[62,1,SEG_LEN+4],t%2?[1,1,1]:[.94,.97,.92],o.grass);for(const o of[-SEG_LEN/4,SEG_LEN/4])i("cube",[e*(ROAD_HALF+.2),RS+.01+r,o],[.5,.08,SEG_LEN/2],(2*t+(o>0?1:0))%2==0?[.85,.12,.1]:[.95,.95,.95]);i("cube",[e*(ROAD_HALF-.12),RS+.004+r,0],[.14,.02,a],LINE),i("cube",[e*(LANE_W/2),RS+.004+r,0],[.14,.02,2.6],LINE),i("cube",[e*(ROAD_HALF+1.1),RS+.55,0],[.1,.26,a],RAIL),i("cube",[e*(ROAD_HALF+1.15),RS+.3,0],[.12,.6,.12],[.45,.46,.5])}s.push({root:n,s:(t-BEHIND)*SEG_LEN,props:[],lights:[]})}return s}export function buildHorizon(e,o){const s=e.spawn({mesh:"none"});for(let o=0;o<26;o++){const t=o/26*Math.PI*2+rand(-.08,.08),n=rand(150,210),i=rand(40,75);e.spawn({mesh:"sphere",parent:s,position:[Math.sin(t)*n,.32*-i,-Math.cos(t)*n],scale:[1.6*i,.9*i,1.6*i],color:[.3+rand(0,.06),.52+rand(0,.08),.24],pickable:!1})}for(let o=0;o<18;o++){const t=o/18*Math.PI*2+rand(-.1,.1),n=rand(45,80);e.spawn({mesh:"cone",parent:s,position:[330*Math.sin(t),.35*n-10,330*-Math.cos(t)],scale:[1.7*n,n,1.7*n],color:[.45+rand(0,.08),.55+rand(0,.06),.68],pickable:!1})}return setHorizonNight(e,s,o),s}const nightSkies=new WeakMap;export function setHorizonNight(e,o,s){let t=nightSkies.get(e);!t&&(t=new Map,nightSkies.set(e,t));const n=t.get(o)??[];for(const o of n)e.despawn(o);n.length=0;for(let t=0;t<5;t++){const i=1.256*t+.7;n.push(e.spawn({mesh:sceneryMeshes().cloud,parent:o,position:[160*Math.sin(i),35+t%3*8,160*-Math.cos(i)],scale:[1.4+t%2*.5,1,1.1],color:s?[.55,.58,.68]:[1.4,1.43,1.45],pickable:!1}))}if(s){n.push(e.spawn({mesh:"sphere",parent:o,position:[-120,120,-230],scale:26,color:[2,1.95,1.8],pickable:!1}));for(let s=0;s<70;s++){const s=rand(0,2*Math.PI);n.push(e.spawn({mesh:"sphere",parent:o,position:[280*Math.sin(s),rand(50,190),280*-Math.cos(s)],scale:rand(.6,1.4),color:[2,2,2.2],pickable:!1}))}}t.set(o,n)}export function placeSegment(e,o){const s=e.track.sample(o.s,segmentSample);e.world.set(o.root,{position:[s.x,s.y-RS,s.z],rotation:orient(s.heading,s.pitch)})}const zoneAt=e=>["city","suburb","country"][Math.floor(Math.max(0,e+300)/600)%3],HOUSE_WALLS=[[.95,.9,.78],[.86,.9,.95],[.95,.82,.75],[.9,.93,.82]],ROOFS=[[.62,.2,.15],[.35,.25,.2],[.3,.32,.38]];export function spawnProps(e,o){const{world:s,assets:t}=e,n=e=>{const t=s.spawn({parent:o.root,pickable:!1,...e});return o.props.push(t),t},i=(s,t,i)=>{const r=n({...s,color:e.night?i:t});o.lights.push({entity:r,day:t,night:i})},r=Math.round(o.s/SEG_LEN),a=zoneAt(o.s),h=()=>rand(-SEG_LEN/2,SEG_LEN/2),p=Math.abs(r),l=t.scenery,m=(e,o,s,t,r,a)=>{n({mesh:l.podium,position:[e,RS,o],scale:[s,1,r]}),n({mesh:l.roofs[a%2],position:[e,RS+t,o],scale:[s,1,r]}),n({mesh:l.facades[a%3],position:[e,RS+t/2,o],scale:[s,t,r]}),i({mesh:l.windows,position:[e,RS+t/2,o],scale:[s,t,r]},[1,1,1,0],[1,1,1])};for(const e of[-1,1]){if(Math.random()<.55&&n({mesh:"sphere",position:[e*(ROAD_HALF+rand(2.2,3.4)),RS+.25,h()],scale:[rand(1,1.8),rand(.7,1.1),rand(1,1.8)],color:[.18+rand(0,.08),.4+rand(0,.12),.14]}),"city"===a){if(n({mesh:l.pavement,position:[e*(ROAD_HALF+3.2),RS+.05,0]}),(r+(e>0?1:0))%2==0){const o=rand(14,42),s=rand(.72,1),i=e*(ROAD_HALF+rand(10,15)),r=rand(-1,1),a=rand(8,12),h=rand(8,11);if(n({mesh:"cube",texture:t.facade,position:[i,RS+o/2,r],scale:[a,o,h],color:[s,s*rand(.92,1),s*rand(.86,1)]}),m(i,r,a,o,h,p+(e>0?1:0)),Math.random()<.5){const o=rand(20,55);n({mesh:"cube",texture:t.facade,position:[e*(ROAD_HALF+rand(24,32)),RS+o/2,rand(-2,2)],scale:[rand(9,14),o,rand(9,12)],color:[.8,.82,.88]})}}const o=p+(e>0?2:0),s=e*(ROAD_HALF+3.2);o%5==1?(n({mesh:l.planter,position:[s,RS+.1,0]}),n({mesh:"cylinder",position:[s,RS+1.7,0],scale:[.28,2.7,.28],color:[.35,.26,.16]}),n({mesh:"sphere",position:[s,RS+3.6,0],scale:[2.1,2.7,2],color:[.23,.41,.19]}),n({mesh:"sphere",position:[s+.45*e,RS+3.2,.35],scale:[1.5,1.8,1.5],color:[.27,.44,.2]})):o%5==3&&(n({mesh:l.planter,position:[s,RS+.1,0]}),n({mesh:l.flowers,position:[s,RS+.67,0],scale:[1.3,1.2,1.3]})),o%9==4&&(n({mesh:l.bench,position:[s,RS+.12,0],rotation:[0,Math.sin(e*Math.PI/4),0,Math.cos(e*Math.PI/4)]}),n({mesh:l.bin,position:[s,RS+.12,1.8]})),o%19==8&&n({mesh:l.shelter,position:[s,RS+.12,0]})}else if("suburb"===a)if((r+(e>0?1:0))%3==0){const t=e*(ROAD_HALF+rand(10,14)),i=pick(HOUSE_WALLS),r=t-2.52*e;n({mesh:"cube",position:[t,RS+1.6,0],scale:[5,3.2,5.6],color:i}),n({mesh:l.house,position:[t,RS,0]}),n({mesh:l.flowers,position:[r-.45*e,RS,-1],scale:[.8,1,1.4]}),n({mesh:"cube",position:[e*(ROAD_HALF+7.3),RS-.005,.9],scale:[4.5,.035,1.8],color:[.48,.49,.46]}),n({mesh:"cube",position:[r,RS+.95,.9],scale:[.06,1.9,.9],color:[.35,.22,.14]});for(const e of[-1.4,2.2])n({mesh:"cube",position:[r,RS+2,e],scale:[.06,.8,.9],color:[.55,.7,.85]});const a=s.spawn({mesh:"none",parent:o.root,pickable:!1,position:[t,RS+3.2,0],scale:[1,.55,1]});o.props.push(a),o.props.push(s.spawn({mesh:"cube",parent:a,pickable:!1,rotation:[0,0,Math.sin(Math.PI/8),Math.cos(Math.PI/8)],scale:[4,4,6.2],color:pick(ROOFS)})),n({mesh:"cube",position:[e*(ROAD_HALF+6.5),RS+.35,0],scale:[.08,.6,SEG_LEN],color:[.95,.95,.95]})}else{const o=e*(ROAD_HALF+rand(7,16)),s=h(),t=rand(1.6,2.6);n({mesh:"cylinder",position:[o,RS+t/2,s],scale:[.35,t,.35],color:[.42,.29,.17]}),n({mesh:"sphere",position:[o,RS+t+1.1,s],scale:rand(2.6,3.6),color:[.24+rand(0,.08),.5+rand(0,.12),.2]})}else{for(let o=0;o<3;o++)n({mesh:t.tree,position:[e*(ROAD_HALF+rand(5,28)),RS,h()],scale:rand(2.4,4.2),color:[1,1,1]});Math.random()<.35&&n({mesh:"sphere",position:[e*(ROAD_HALF+rand(4,12)),RS,h()],scale:[rand(.8,1.8),rand(.5,.9),rand(.8,1.6)],color:[.52,.5,.48]});for(const o of[.45,.85])n({mesh:"cube",position:[e*(ROAD_HALF+4.2),RS+o,0],scale:[.07,.1,SEG_LEN+.3],color:[.48,.34,.2]});n({mesh:"cube",position:[e*(ROAD_HALF+4.2),RS+.5,0],scale:[.12,1,.12],color:[.4,.28,.16]}),r%6==(e>0?0:3)&&(n({mesh:"cylinder",position:[e*(ROAD_HALF+7),RS+4.5,0],scale:[.22,9,.22],color:[.38,.27,.18]}),n({mesh:"cube",position:[e*(ROAD_HALF+7),RS+8.4,0],scale:[2.2,.14,.14],color:[.38,.27,.18]}))}if(p%2==0){const o=e*(ROAD_HALF+("city"===a?1.8:3.2));n({mesh:l.grass,position:[o,RS-.025,-1.6],scale:"city"===a?.8:1.4}),"city"!==a&&n({mesh:l.grass,position:[o+.8*e,RS-.025,1.6],scale:1.1})}"country"===a&&p%4==1&&n({mesh:l.flowers,position:[e*(ROAD_HALF+3.1),RS-.02,0],scale:1.1}),"city"===a&&p%3==0&&n({mesh:l.drain,position:[e*(ROAD_HALF-.4),RS+.008,0]}),p%2==1&&i({mesh:"cube",position:[e*(ROAD_HALF+1.04),RS+.61,0],scale:[.1,.08,.07]},[.9,.88,.75],[1.45,1.3,.8])}const d=r%2?1:-1;if(r%("city"===a?2:4)==0&&(n({mesh:"cylinder",position:[d*(ROAD_HALF+1.7),RS+3.2,0],scale:[.16,6.4,.16],color:[.35,.36,.4]}),n({mesh:"cube",position:[d*(ROAD_HALF+.8),RS+6.35,0],scale:[1.9,.1,.12],color:[.35,.36,.4]}),i({mesh:"cube",position:[d*(ROAD_HALF-.05),RS+6.25,0],scale:[.7,.1,.32]},LAMP,LAMP_LIT)),p%17==7){const e=d*(ROAD_HALF+4.6);for(const o of[-1.65,1.65])n({mesh:"cylinder",position:[e+o,RS+2,0],scale:[.1,4,.1],color:[.4,.44,.42]});n({mesh:l.routeSign,position:[e,RS+4.15,0]}),i({text:"city"===a?"CITY":"suburb"===a?"HILLS":"FOREST",font:t.font,position:[e-.35,RS+3.92,.09],scale:.48,letterSpacing:.04},[.94,.95,.88],[1.4,1.4,1.25])}if(r%11==5){const e=-d*(ROAD_HALF+6);for(const o of[-2.2,2.2])n({mesh:"cylinder",position:[e+o,RS+2.5,0],scale:[.25,5,.25],color:[.3,.3,.34]});i({mesh:"cube",texture:pick(t.ads),position:[e,RS+6,0],scale:[7.5,3.6,.25],rotation:[0,Math.sin(.35*d/2),0,Math.cos(.35*d/2)]},[1,1,1],[1.7,1.7,1.7])}}export function recycleRoad(e,o,s){for(const t of o)if(!(t.s>=s-SEG_LEN*BEHIND)){t.s+=SEGMENTS*SEG_LEN,placeSegment(e,t);for(const o of t.props)e.world.despawn(o);t.props.length=0,t.lights.length=0,spawnProps(e,t)}}const FLASH=[2,1.95,1.7,.9],FIREBALL=[[2,1.7,.8,.6],[2,1.45,.5,.6],[2,1.2,.35,.6]],FLAME_CORE=[[2,1.85,1.1,.5],[2,1.7,.75,.5]],FLAME=[[2,1.6,.55,.42],[2,1.35,.38,.42],[2,1.1,.25,.42]],COOLED=[2,.35,.08,0],SMOKE=[[.1,.095,.09,.5],[.14,.13,.12,.45],[.18,.17,.16,.4]],SMOKE_END=[.45,.44,.43,0],EMBER=[[2,1.4,.5],[2,1,.25]],DEBRIS=[[.06,.06,.07],[.18,.18,.2]];export const burning=(e,o)=>({root:e,until:o,flame:0,smoke:0,ember:0});export function explode(e,o){const s=[0,1,0];e.burst({position:o,mesh:"flame",count:3,size:3.2,speed:.5,lifetime:.22,gravity:0,color:FLASH,endSize:1.8,endColor:[2,1.4,.4,0]}),e.burst({position:o,mesh:"flame",count:30,size:1.1,speed:4.5,lifetime:.85,gravity:3,color:FIREBALL,endSize:2.2,endColor:COOLED}),e.burst({position:[o[0],o[1]+.4,o[2]],mesh:"flame",count:14,size:.9,speed:5.5,lifetime:.9,gravity:5,direction:s,spread:.55,color:FLAME,endSize:1.4,endColor:COOLED}),e.burst({position:o,mesh:"flame",count:30,size:.16,speed:14,lifetime:.7,gravity:-9.81,color:EMBER,endSize:.3,endColor:[2,.3,.05,0]}),e.burst({position:o,count:10,size:.14,speed:8,lifetime:1.4,gravity:-9.81,direction:s,spread:1.2,color:DEBRIS}),e.burst({position:[o[0],o[1]+1.4,o[2]],mesh:"puff",count:6,size:1,speed:2,lifetime:2,gravity:2,direction:s,spread:.6,color:SMOKE,endSize:3,endColor:SMOKE_END})}const firePosition=[0,0,0],wreckVelocity=[0,0,0],FLAMES_PER_SECOND=120,SMOKE_PER_SECOND=10,EMBERS_PER_SECOND=14,FIRE_MIN_DISTANCE=5;export function burn(e,o,s,t,n){const{eye:i,target:r}=o,a=r[0]-i[0],h=r[1]-i[1],p=r[2]-i[2],l=Math.hypot(a,h,p)||1;for(let o=s.length-1;o>=0;o--){const r=s[o],m=e.worldPosition(r.root,firePosition);if(!m||t>r.until){s.splice(o,1);continue}if(((m[0]-i[0])*a+(m[1]-i[1])*h+(m[2]-i[2])*p)/l<5)continue;const d=e.velocity(r.root,wreckVelocity)??[0,0,0],S=(o,s,t,n,i)=>{const r=[d[0],d[1]+o,d[2]],a=Math.hypot(r[0],r[1],r[2]);e.burst({position:[m[0]+rand(-t,t),m[1]+s,m[2]+rand(-n,n)],mesh:i.mesh,count:1,size:i.size,speed:a,lifetime:i.lifetime,gravity:1.5*o,direction:[r[0]/a,r[1]/a,r[2]/a],spread:i.spread,color:i.color,endSize:i.endSize,endColor:i.endColor})};for(r.flame+=120*n;r.flame>=1;)r.flame-=1,S(4.2,.8,.75,1.5,{mesh:"flame",size:rand(.8,1.1),lifetime:rand(.45,.65),color:FLAME,endSize:.25,endColor:COOLED,spread:.2}),Math.random()<.5&&S(1.5,.7,.55,1.2,{mesh:"flame",size:rand(.7,.95),lifetime:rand(.18,.28),color:FLAME_CORE,endSize:.7,endColor:[2,1.4,.4,0],spread:.2});for(r.smoke+=10*n;r.smoke>=1;)r.smoke-=1,S(2.6,2,.5,1,{mesh:"puff",size:rand(1,1.3),lifetime:rand(1.6,2.1),color:SMOKE,endSize:3,endColor:SMOKE_END,spread:.35});for(r.ember+=14*n;r.ember>=1;)r.ember-=1,S(4.5,1,.6,1.3,{mesh:"flame",size:.14,lifetime:rand(.8,1.3),color:EMBER,endSize:.3,endColor:[2,.3,.05,0],spread:.6})}}const GANTRY_X=ROAD_HALF+1.7,GANTRY_H=6.4,BANNER_Y=5.5,markerMeshes=new Map,markerMesh=(e,o)=>{let s=markerMeshes.get(e);return s||markerMeshes.set(e,s=cacheGameAsset("car-racing/CarRacingScene:"+e,o)),s};function gantryParts(e,o){const s=[];for(const o of[-1,1])s.push({geometry:block(.55,6.4,.55,6),position:[o*GANTRY_X,3.2,0],color:e}),s.push({geometry:block(.9,.3,.9,6),position:[o*GANTRY_X,.15,0],color:e});return s.push({geometry:block(2*GANTRY_X+.9,.45,.6),position:[0,6.5,0],color:e},{geometry:block(2*GANTRY_X-1.4,1.25,.12),position:[0,5.5,.08],color:o},{geometry:block(2*GANTRY_X-2.2,.08,.04),position:[0,5,.15],color:[1,.9,.5]},{geometry:block(2*GANTRY_X-2.2,.08,.04),position:[0,6,.15],color:[1,.9,.5]}),s}const finishMesh=()=>markerMesh("finish",()=>{const e=[],o=.7,s=Math.ceil((2*ROAD_HALF+.6)/o);for(let t=0;t<s;t++)for(let n=0;n<2;n++)e.push({geometry:block(o,.03,o,8),position:[(t-(s-1)/2)*o,.016,(n-.5)*o],color:(t+n)%2?[.96,.96,.94]:[.08,.08,.1]});const t=[-4,-2,0,2,4].map((e,o)=>({geometry:tube([[e,6.25,.32],[e+.06,6.4-.8,.33]],{radius:e=>.2*(1-e),shape:e=>.2+.8*Math.abs(Math.cos(e*Math.PI*2)),sides:6}),color:[[.2,.5,.95],[1,.8,.15],[.2,.75,.3]][o%3]}));return _0x6fd5e1(merge([...e,...gantryParts([.95,.72,.2],[.85,.12,.14]),...t]),{center:!1,shine:.5})}),startMesh=()=>markerMesh("start",()=>_0x6fd5e1(merge([{geometry:block(2*ROAD_HALF+.4,.03,.5,8),position:[0,.016,0],color:[.96,.96,.92]}]),{center:!1,shine:.3})),markerSample=newSample(),markerAt=[0,0,0];export function spawnRaceMarkers(e,o,s,t,n){const i=(s,t,i)=>{const r=o.sample(t,markerSample);placeAt(r,0,0,markerAt);const a=e.spawn({mesh:s,position:[markerAt[0],markerAt[1],markerAt[2]],rotation:orient(r.heading,r.pitch),pickable:!1});return i?(e.spawn({text:i,font:n,parent:a,position:[0,5.14,.16],scale:.78,color:[1,1,1],letterSpacing:.12,pickable:!1}),a):a};return{start:i(startMesh(),s),finish:i(finishMesh(),t,"FINISH")}}export function*warmAssets(){yield finishMesh,yield startMesh}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,textColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{backgroundFor,lightFor}from"./ChameleonRunBackdrop.js";import{MAX_LIVES,RESULTS_DELAY_LOSE,RESULTS_DELAY_WIN,TRACK_LENGTH}from"./ChameleonRunConstants.js";import{changeColor,createGame,dispose,INITIAL_HUD,reset,setActive,setLayout,setTheme,start,steer,tick}from"./ChameleonRunGame.js";import{jsx as
|
|
1
|
+
"use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,textColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{backgroundFor,lightFor}from"./ChameleonRunBackdrop.js";import{MAX_LIVES,RESULTS_DELAY_LOSE,RESULTS_DELAY_WIN,TRACK_LENGTH}from"./ChameleonRunConstants.js";import{changeColor,createGame,dispose,INITIAL_HUD,reset,setActive,setLayout,setTheme,start,steer,tick}from"./ChameleonRunGame.js";import{jsx as _0x1e8d49}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.CHAMELEON_RUN,FEEDBACK={jump:{sound:SOUNDS.JUMP,haptic:HapticType.LIGHT},land:{sound:SOUNDS.LAND,haptic:HapticType.LIGHT},swap:{sound:SOUNDS.SWAP,haptic:HapticType.LIGHT},star:{sound:SOUNDS.STAR,haptic:HapticType.SUCCESS},hurt:{sound:SOUNDS.HURT,haptic:HapticType.HEAVY},fall:{sound:SOUNDS.GAME_OVER,haptic:HapticType.ERROR},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS}};export const ChameleonRun=engineGame(GAME_IDS.CHAMELEON_RUN,e=>{const[t,s]=useLiveState(0),[o,r]=useLiveState(0),[a,i]=useLiveState(0),[n,S]=useLiveState(MAX_LIVES),[m,u]=useLiveState(INITIAL_HUD,0),{game:p,theme:E,status:T,screen:L,gameOver:A}=useEngineGame(e,{gameId:GAME_IDS.CHAMELEON_RUN,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,setActive:setActive,resize:setLayout,tap:changeColor,drag:steer,reportScore:e=>e.run?.score??0,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(void 0,HapticType.MEDIUM),resultsDelay:e=>"win"===e?RESULTS_DELAY_WIN:RESULTS_DELAY_LOSE,wire:(e,t)=>{e.onScore=s,e.onStars=r,e.onDistance=i,e.onLives=S,e.onHud=u,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}}),l=useMemo(()=>lightFor(E),[E]),d=useMemo(()=>backgroundFor(E),[E]),h="color"===m.failure?"Match your color to the platform before landing.":"Use the second jump to save a long leap.";return _0x1e8d49(EngineGameScreen,{...L,light:l,background:d,fog:0,columns:[scoreColumn(t),livesColumn(n,MAX_LIVES),textColumn("TRACK",TRACK_LENGTH-a+" m")],subtext:"Change colors and jump!",gameOver:A({title:"win"===T?"YOU MADE IT!":"OUT OF LIVES!",message:"win"===T?"Finished "+TRACK_LENGTH+" m with "+o+" stars! Best streak \xd7"+(p.run?.bestCombo??0)+".":"Out of lives after "+a+" of "+TRACK_LENGTH+" m. "+h,scoreLabel:"Run Score",score:t,buttonText:"win"===T?"Run Again!":"Try Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{cacheGameAsset,createGameMesh as _0x3dbdfb}from"../shared/EngineMeshes.js";const DAY_LIGHT={direction:[-.6,.75,.25],ambient:.48,color:[1.04,1.02,1],shadows:!0,shadowExtent:28},NIGHT_LIGHT={direction:[-.25,.75,.45],ambient:.6,color:[.78,.86,1.05],shadows:!0,shadowExtent:28};export const lightFor=e=>"dark"===e.mode?NIGHT_LIGHT:DAY_LIGHT;export const backgroundFor=e=>"dark"===e.mode?[.055,.085,.13]:[.63,.73,.81];const meshes=new Map,clamp=(e,t=0,o=1)=>Math.max(t,Math.min(o,e)),mix=(e,t,o)=>[e[0]+(t[0]-e[0])*o,e[1]+(t[1]-e[1])*o,e[2]+(t[2]-e[2])*o],smooth=(e,t,o)=>{const n=clamp((o-e)/(t-e));return n*n*(3-2*n)},normalize=e=>{const t=Math.hypot(...e)||1;return[e[0]/t,e[1]/t,e[2]/t]},hash=(e,t)=>{const o=43758.5453*Math.sin(127.1*e+311.7*t);return o-Math.floor(o)};function noise(e,t){const o=Math.floor(e),n=Math.floor(t),s=smooth(0,1,e-o),r=smooth(0,1,t-n),a=hash(o,n),i=hash(o+1,n),h=hash(o,n+1);return a+(i-a)*s+(h-a)*r+(a-i-h+hash(o+1,n+1))*s*r}const fbm=(e,t)=>.55*noise(e,t)+.28*noise(2.13*e+7,2.13*t)+.12*noise(4.57*e,4.57*t+11)+.05*noise(9.1*e,9.1*t);function heightAt(e,t){const o=-t,n=12*Math.sin(.014*o)+7*Math.sin(.027*o+1),s=1-Math.exp(-((Math.abs(e-n)/(48+.14*o))**1.8)),r=19*(fbm(.014*e+9,.011*t)-.5);return s*(28+(1-Math.abs(2*noise(.018*(e+r),.014*t+13)-1))**3*88+12*(1-Math.abs(2*noise(.047*e+5,.033*t)-1)))-44+smooth(210,405,o)*(20+46*fbm(.022*e+30,.017*t))+(fbm(.11*e,.09*t)-.5)*s*5}function surface(e,t,o,n,s){const r=lightFor(o),a=normalize(r.direction),i=r.ambient*(.6+.4*(.5*a[1]+.5))+1-r.ambient,h=r.color??[1,1,1],m=new Float32Array((e+1)*(t+1)*11),d=new Uint32Array(e*t*6);let l=0,M=0;for(let o=0;o<=e;o++)for(let r=0;r<=t;r++){const{position:u,color:f}=s(r/t,o/e);if(m.set([u[0],u[1],u[2],a[0],a[1],a[2],f[0]/(i*h[0]),f[1]/(i*h[1]),f[2]/(i*h[2]),0,0],l),l+=11,o===e||r===t)continue;const p=o*(t+1)+r,b=p+t+1;d.set(n?[p,p+1,b,p+1,b+1,b]:[p,b,p+1,p+1,b,b+1],M),M+=6}return{vertices:m,indices:d}}function skyMesh(e){return cacheGameAsset("chameleon-run/ChameleonRunBackdrop:skyMesh"+JSON.stringify([e]),()=>skyMeshUncached(e))}function skyMeshUncached(e){const t="sky-"+("dark"===e.mode?"night":"day");let o=meshes.get(t);if(o)return o;const n="dark"===e.mode,s=n?[.12,.17,.24]:[.76,.82,.85],r=n?[.018,.035,.075]:[.25,.43,.65];return o=_0x3dbdfb(surface(48,96,e,!1,(e,t)=>{const o=3.2*(e-.5),a=.95-1.8*t;let i=mix(s,r,smooth(-.04,.82,a));const h=smooth(.08,.23,a)*(1-smooth(.56,.76,a)),m=smooth(.52,.82,fbm(2*o+3*a,33*a));i=mix(i,n?[.22,.28,.36]:[.91,.92,.91],m*h*.5);const d=Math.exp(-((o+.6)**2/.5+(a-.18)**2/.04));n||(i=mix(i,[.93,.87,.73],.12*d));const l=430*Math.cos(a);return{position:[Math.sin(o)*l,430*Math.sin(a),-Math.cos(o)*l],color:i}}),{center:!1,shine:0}),meshes.set(t,o),o}function terrainMesh(e){return cacheGameAsset("chameleon-run/ChameleonRunBackdrop:terrainMesh"+JSON.stringify([e]),()=>terrainMeshUncached(e))}function terrainMeshUncached(e){const t="terrain-"+("dark"===e.mode?"night":"day");let o=meshes.get(t);if(o)return o;const n="dark"===e.mode,s=lightFor(e),r=normalize(s.direction),a=s.color??[1,1,1],i=n?[.1,.145,.21]:[.65,.74,.8];return o=_0x3dbdfb(surface(96,128,e,!0,(e,t)=>{const o=8+t**1.3*400,h=2*(e-.5)*(72+.95*o),m=-o,d=heightAt(h,m),l=.4,M=normalize([-(heightAt(h+l,m)-heightAt(h-l,m))/.8,1,-(heightAt(h,m+l)-heightAt(h,m-l))/.8]),u=1-M[1],f=fbm(.15*h,.13*m),p=.5*Math.sin(2.4*d+8*noise(.09*h,.07*m))+.5;let b=mix([.34,.36,.35],[.56,.53,.47],.7*f+.15*p);const x=(1-smooth(.15,.55,u))*(1-smooth(10,45,d));b=mix(b,mix([.18,.28,.22],[.38,.43,.28],noise(.23*h,.19*m)),.8*x);const k=smooth(34,67,d+12*(f-.5))*(1-smooth(.28,.68,u));b=mix(b,[.84,.86,.86],k);const g=Math.max(0,M[0]*r[0]+M[1]*r[1]+M[2]*r[2]),y=s.ambient*(.6+.4*(.5*M[1]+.5))+(1-s.ambient)*g;let A=[b[0]*y*a[0],b[1]*y*a[1],b[2]*y*a[2]];n&&(A=[.31*A[0],.39*A[1],.55*A[2]]);const w=1-Math.exp(-((o/280)**1.5));return A=mix(A,i,.88*w),{position:[h,d,m],color:A}}),{center:!1,shine:0}),meshes.set(t,o),o}export function spawnBackdrop(e,t){const o=e.spawn({mesh:"none",pickable:!1});return e.spawn({mesh:skyMesh(t),parent:o,position:[0,3.1,5.4],pickable:!1}),e.spawn({mesh:terrainMesh(t),parent:o,pickable:!1}),{root:o,alive:!0}}export function removeBackdrop(e,t){t.alive&&(t.alive=!1,e.despawn(t.root))}export function*warmAssets(e){yield()=>skyMesh(e),yield()=>terrainMesh(e)}
|