@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{formatTime,GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{textColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./NutsAndBoltsConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./NutsAndBoltsGame.js";import{jsx as
|
|
1
|
+
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{formatTime,GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{textColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./NutsAndBoltsConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./NutsAndBoltsGame.js";import{jsx as _0x483f68}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.NUTS_AND_BOLTS,CLASSIC_TEXT="#FFFFFF",FEEDBACK={select:{sound:SOUNDS.SELECT,haptic:HapticType.LIGHT},place:{sound:SOUNDS.PLACE,haptic:HapticType.MEDIUM},complete:{sound:SOUNDS.COMPLETE,haptic:HapticType.SUCCESS}};export const NutsAndBolts=engineGame(GAME_IDS.NUTS_AND_BOLTS,e=>{const[t,s]=useLiveState(0),[a,o]=useLiveState(TIME_LIMIT),[i,n]=useLiveState(null),{game:r,theme:m,status:S,screen:p,gameOver:u}=useEngineGame(e,{gameId:GAME_IDS.NUTS_AND_BOLTS,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,a)=>{const o=getLayout(t,s,a);return setLayout(e,o),o.boardWidth},tap:tap,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>{"win"!==t&&e(SOUNDS.GAME_OVER,HapticType.HEAVY)},wire:(e,t)=>{e.onScore=s,e.onTime=o,e.onPlanks=n,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}}),E="classic"===m.mode?"#FFFFFF":void 0;return _0x483f68(EngineGameScreen,{...p,light:LIGHT,columns:[textColumn("PLANKS",i??r.planks.length,E),textColumn("SCORE",t.toLocaleString(),E),textColumn("TIMER",formatTime(a),E)],subtext:"Unscrew the planks!",gameOver:u({title:"win"===S?"PUZZLE SOLVED!":"TIME UP!",message:"win"===S?"All bolts matched!":"You ran out of time!",scoreLabel:"win"===S?"Puzzle Solved!":"Game Over",score:t,buttonText:"win"===S?"Play Again!":"Try Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,lathe,merge,Path,quat,recolor,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,lathe,merge,Path,quat,recolor,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x2478e5}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{CLASSIC_BOARD,CLASSIC_SEPARATOR,FALL_TIME,LIFT_TIME,MOVE_TIME,pointAt,separatorY,swapAt}from"./NutsAndBoltsConstants.js";import{getPlankPositions}from"./NutsAndBoltsRules.js";const meshes=new Map,cached=(t,o)=>{let e=meshes.get(t);return!e&&(e=cacheGameAsset("nuts-and-bolts/NutsAndBoltsScene:"+t,o),meshes.set(t,e)),e},STAND_UP=quat.x(Math.PI/2),ACROSS=quat.z(0),DOWN=quat.z(Math.PI/2),BOARD_DEPTH=10,BACKDROP_DEPTH=25,PLANK_PAD=10,PLANK_WIDTH=26,PLANK_DEPTH=10,PLANK_CAP=1.6,PLANK_TOP=11.6,PLANK_STEP=4,WOOD=toColor("#8B4513"),METAL=toColor("#B8BEC6"),SILVER=[.78,.8,.84,1],GOLD=toColor("#FFD700");export const holeRadius=t=>Math.min(18,.3*t.cell);export const boltRadius=t=>Math.min(16,.27*t.cell);const plankZ=t=>4*(t.zIndex-1);export const boltRest=(t,o,e)=>t.reduce((t,a)=>getPlankPositions(a).some(t=>t.row===o&&t.col===e)?Math.max(t,plankZ(a)+11.6):t,0);const panelMesh=(t,o,e)=>cached("nb-panel:"+t.toFixed(1)+"x"+o.toFixed(1)+":"+e,()=>_0x2478e5(extrude((new Path).addRoundedRect(-t/2,-o/2,t,o,e),{depth:10}),{shine:.2})),cube=()=>shapeGeometry("cube"),faceShade=(t,o)=>e=>recolor(e,({normal:e})=>{const a=e[2]>.6?t:e[2]<-.6?.6*o:o;return[a,a,a,1]}),plankMesh=(t,o,e,a)=>cached("nb-plank-v2:"+(a?"m":"w")+":"+t+":"+o.toFixed(2)+":"+e.toFixed(1),()=>{const n=(t-1)*o,s=n+20+26,i=.62*e,r=e=>{const a=(new Path).addRoundedRect(-s/2+e,-13+e,s-2*e,26-2*e,13-e);for(let s=0;s<t;s++)a.addCircle(-n/2+s*o,0,i+e);return a},l=Array.from({length:t},(t,e)=>-n/2+e*o),p=[{geometry:faceShade(.82,.62)(extrude(r(0),{depth:10,fillRule:"evenodd"}))},{geometry:faceShade(1,.8)(extrude(r(1.6),{depth:1.6,fillRule:"evenodd"})),position:[0,0,5.8]}],d=6.6+.05;return(a?[-7.5,-3,4,8.5]:[-8.5,-5.5,-2.5,3,6,9]).forEach((t,o)=>{const e=s/2-13+Math.sqrt(Math.max(0,121-t*t)),n=[];for(const o of l)if(Math.abs(t)<i+3){const e=Math.sqrt((i+3)**2-t*t);n.push([o-e,o+e])}let r=-e;for(const[s,i]of[...n,[e,e]]){if(s-r>2){const e=a?1.18:.62+o%3*.06;p.push({geometry:cube(),position:[(r+s)/2,t,d],scale:[s-r,a?.35:.6+o%2*.4,.1],color:[e,e,e,1]})}r=i}}),_0x2478e5(merge(p),{center:!1,shine:a?.8:.2})}),nutSocketMesh=()=>cached("nb-socket-nut",()=>{const t=new Path;for(let o=0;o<6;o++){const e=o/6*Math.PI*2+Math.PI/6;0===o?t.moveTo(.48*Math.cos(e),.48*Math.sin(e)):t.lineTo(.48*Math.cos(e),.48*Math.sin(e))}t.close().addCircle(0,0,.24);const o=toColor("#2E9E5B"),e=toColor("#6FD39A"),a=toColor("#16301F");return _0x2478e5(merge([{geometry:extrude(t,{depth:.18,fillRule:"evenodd"}),rotation:quat.x(-Math.PI/2),position:[0,.09,0],color:[o[0],o[1],o[2],1]},{geometry:lathe([[.24,.17],[.3,.181]],{segments:48}),color:[e[0],e[1],e[2],1]},{geometry:lathe([[.001,-.06],[.24,-.06],[.24,.17]],{segments:40,displace:(t,o)=>o>.5?.02*Math.sin((t+5*o)*Math.PI*2):0}),color:[a[0],a[1],a[2],1]}]),{center:!1,shine:.6})}),socketMesh=t=>t?nutSocketMesh():cached("nb-socket-"+(t?"swap":"grid"),()=>{const[o,e,a]=t?["#3CB371","#228B22","#90EE90"]:["#D2B48C","#B8956A","#F5DEB3"],n=toColor(o),s=toColor(e),i=toColor(a);return _0x2478e5(lathe([[.001,.04],[.26,.05],[.38,.1],[.46,.2],[.5,.24],[.56,.18],[.6,0]],{segments:28,color:({position:t})=>{const o=Math.hypot(t[0],t[2]),e=o<.3?i:o<.45?s:n;return[e[0],e[1],e[2]]}}),{center:!1,shine:.3})}),boltMesh=()=>cached("nb-bolt-v2",()=>{const t=lathe([[.001,.4],[.3,.4],[.38,.35],[.38,.12],[.36,.1]],{segments:6}),o=lathe([[.36,.12],[.48,.1],[.5,.06],[.5,.02],[.47,0],[.14,0]],{segments:48}),e=lathe([[.15,0],[.15,-.62],[.1,-.7],[.001,-.7]],{segments:32,displace:(t,o)=>o<.85?.03*Math.sin((t+7*o)*Math.PI*2):0});return _0x2478e5(merge([{geometry:e,color:[.62,.64,.68,1]},{geometry:o,color:[.92,.93,.95,1]},{geometry:t}]),{center:!1,shine:.9})}),panelColor=t=>toColor("classic"===t.mode?CLASSIC_BOARD:t.BOARD.SURFACE),separatorColor=t=>toColor("classic"===t.mode?CLASSIC_SEPARATOR:t.BOARD.BORDER);export function buildScene(t,o,e,a){const n=spawnBackdrop(t,o.width,o.height,-25,e);placeTiltedBackdrop(t,n,o,25);const s="classic"===e.mode,i=s?16:8,r=t.spawn({mesh:panelMesh(o.boardWidth,o.boardHeight,i),position:[0,0,-5],color:panelColor(e),pickable:!1}),l=toColor(e.BOARD.BORDER),p=!s&&l[3]>0?t.spawn({mesh:cached("nb-rim:"+o.boardWidth.toFixed(1)+"x"+o.boardHeight.toFixed(1),()=>_0x2478e5(extrude((new Path).addRoundedRect(-o.boardWidth/2,-o.boardHeight/2,o.boardWidth,o.boardHeight,8).addRoundedRect(-o.boardWidth/2+1,-o.boardHeight/2+1,o.boardWidth-2,o.boardHeight-2,7),{depth:0,fillRule:"evenodd"}))),position:[0,0,.3],color:l,pickable:!1}):null,d=t.spawn({mesh:"cube",position:[0,separatorY(o),.2],scale:[o.boardWidth-2*o.padding,1.5,.3],color:separatorColor(e),pickable:!1}),h=holeRadius(o);return{backdrop:n,panel:r,rim:p,separator:d,sockets:a.map(({row:e,col:a})=>{const[n,s]=pointAt(o,e,a);return t.spawn({mesh:socketMesh(!1),position:[n,s,0],rotation:STAND_UP,scale:2*h,pickable:!1})}),swaps:[0,1,2].map(e=>{const[a,n]=swapAt(o,e);return t.spawn({mesh:socketMesh(!0),position:[a,n,0],rotation:STAND_UP,scale:2*h,pickable:!1})}),planks:new Map,bolts:new Map}}export function removeScene(t,o){const e=[o.backdrop,o.panel,o.separator,...o.sockets,...o.swaps,...Array.from(o.planks.values()),...Array.from(o.bolts.values(),t=>t.pivot)];for(const a of null!=o.rim?[...e,o.rim]:e)t.despawn(a)}export function setSceneTheme(t,o,e,a){setBackdropTheme(t,e.backdrop,a),t.set(e.panel,{mesh:panelMesh(o.boardWidth,o.boardHeight,"classic"===a.mode?16:8),color:panelColor(a)}),t.set(e.separator,{color:separatorColor(a)})}export function placeSockets(t,o,e,a){for(const o of e.sockets)t.despawn(o);const n=holeRadius(o);e.sockets=a.map(({row:e,col:a})=>{const[s,i]=pointAt(o,e,a);return t.spawn({mesh:socketMesh(!1),position:[s,i,0],rotation:STAND_UP,scale:2*n,pickable:!1})})}const plankCentre=(t,o)=>{const[e,a]=pointAt(t,o.startRow,o.startCol),[n,s]="horizontal"===o.orientation?pointAt(t,o.startRow,o.startCol+o.length-1):pointAt(t,o.startRow+o.length-1,o.startCol);return[(e+n)/2,(a+s)/2,plankZ(o)+5]};export function spawnPlank(t,o,e,a){e.planks.set(a.id,t.spawn({mesh:plankMesh(a.length,o.cell,holeRadius(o),"horizontal"!==a.orientation),position:plankCentre(o,a),rotation:"horizontal"===a.orientation?ACROSS:DOWN,color:"horizontal"===a.orientation?WOOD:METAL,pickable:!1}))}export function dropPlank(t,o,e,a){const n=e.planks.get(a.id);if(null==n)return 0;e.planks.delete(a.id);const[s,i,r]=plankCentre(o,a),l=.5*(a.zIndex%2?1:-1),[p,d,h]="horizontal"===a.orientation?WOOD:METAL;return t.animate(n,{position:[s+l*o.cell*.4,i-2.5*o.cell,r-30]},{duration:FALL_TIME,easing:"easeIn"}),t.animate(n,{turn:[.4*l,0,l]},{duration:FALL_TIME,easing:"easeIn"}),t.animate(n,{color:[p,d,h,0]},{duration:FALL_TIME,easing:"easeIn"}),FALL_TIME}export function spawnBolt(t,o,e,a,n){const s=t.spawn({mesh:"none",position:n,pickable:!1}),i=t.spawn({mesh:boltMesh(),parent:s,rotation:STAND_UP,scale:2*boltRadius(o),color:SILVER,pickable:!1});e.bolts.set(a,{pivot:s,body:i})}export function removeBolts(t,o){for(const e of o.bolts.values())t.despawn(e.pivot);o.bolts.clear()}const lifted=(t,o)=>[o[0],o[1],o[2]+1.6*boltRadius(t)],SCREW_TURNS=2.5;function hover(t,o,e,a,n){const s=lifted(o,a);t.animate(e.pivot,{position:[s[0],s[1],s[2]+.25*boltRadius(o)]},{duration:.7,delay:n,repeat:"forever",yoyo:!0,easing:"easeInOut"}),t.animate(e.pivot,{turn:[0,0,.3*Math.PI]},{duration:1.1,delay:n,repeat:"forever",yoyo:!0,easing:"easeInOut"})}export function liftBolt(t,o,e,a,n){const s=e.bolts.get(a);s&&(t.stopAnimation(s.pivot),t.animate(s.pivot,{position:lifted(o,n)},{duration:LIFT_TIME,easing:"easeOut"}),t.animate(s.pivot,{turn:[0,0,2*Math.PI*2.5]},{duration:LIFT_TIME,easing:"easeOut"}),t.animate(s.body,{color:GOLD},{duration:LIFT_TIME}),hover(t,o,s,n,LIFT_TIME))}function seat(t,o,e,a,n){const s=.12*boltRadius(o);t.animate(e.pivot,[{position:[a[0],a[1],a[2]-s],at:.4},{position:a,at:1}],{duration:.14,delay:n,easing:"easeOut"})}export function lowerBolt(t,o,e,a,n){const s=e.bolts.get(a);s&&(t.stopAnimation(s.pivot),t.animate(s.pivot,{position:n},{duration:LIFT_TIME,easing:"easeIn"}),t.animate(s.pivot,{turn:[0,0,2*-Math.PI*2.5]},{duration:LIFT_TIME,easing:"easeIn"}),t.animate(s.body,{color:SILVER},{duration:LIFT_TIME}),seat(t,o,s,n,LIFT_TIME))}export function settleBolt(t,o,e,a){const n=o.bolts.get(e);n&&t.animate(n.pivot,{position:a},{duration:.25,delay:.1,easing:"bounce"})}export function moveBolt(t,o,e,a,n,s){const i=e.bolts.get(a);if(!i)return;const r=Math.max(n[2],s[2])+2.4*boltRadius(o),l=lifted(o,s),p=.55*MOVE_TIME,d=MOVE_TIME-p;t.stopAnimation(i.pivot),t.animate(i.pivot,[{position:[n[0],n[1],r],at:.3},{position:[(n[0]+s[0])/2,(n[1]+s[1])/2,r+.6*boltRadius(o)],at:.6},{position:[l[0],l[1],l[2]],at:1}],{duration:p,path:"smooth",easing:"easeInOut"}),t.animate(i.pivot,{position:s},{duration:d,delay:p,easing:"easeIn"}),t.animate(i.pivot,{turn:[0,0,2*-Math.PI*2.5]},{duration:d,delay:p,easing:"easeIn"}),t.animate(i.body,{color:SILVER},{duration:MOVE_TIME}),seat(t,o,i,s,MOVE_TIME)}export function celebrate(t,o){effects.confetti(t,{position:[0,o.cell,o.cell],count:60,size:.12*o.cell,speed:1.4*o.boardWidth,lifetime:1.3,gravity:2.4*-o.boardWidth,colors:["#FFD700","#3CB371","#C4733B","#4DA6FF"].map(t=>toColor(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{livesColumn,scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,INITIAL_LIVES,LIGHT,TIME_LIMIT}from"./PacManConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./PacManGame.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,INITIAL_LIVES,LIGHT,TIME_LIMIT}from"./PacManConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./PacManGame.js";import{jsx as _0x17b3c3}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.PAC_MAN,FEEDBACK={chomp:{sound:SOUNDS.CHOMP},pellet:{sound:SOUNDS.POWER_PELLET,haptic:HapticType.MEDIUM},fruit:{sound:SOUNDS.FRUIT,haptic:HapticType.MEDIUM},eatGhost:{sound:SOUNDS.EAT_GHOST,haptic:HapticType.HEAVY},eatGhostCombo:{sound:SOUNDS.EAT_GHOST_COMBO,haptic:HapticType.HEAVY},lifeLost:{sound:SOUNDS.LIFE_LOST,haptic:HapticType.ERROR}},scoreText=e=>""+e;export const PacMan=engineGame(GAME_IDS.PAC_MAN,e=>{const[t,s]=useLiveState(0),[o,a]=useLiveState(INITIAL_LIVES),[i,r]=useLiveState(TIME_LIMIT),{theme:n,status:S,screen:m,gameOver:E}=useEngineGame(e,{gameId:GAME_IDS.PAC_MAN,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,o)=>{const a=getLayout(t,s,o);return setLayout(e,a),a.sizeX},drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START),onStop:e=>e(null,HapticType.LIGHT),onOver:(e,t)=>e("win"===t?SOUNDS.LEVEL_COMPLETE:SOUNDS.DEATH,"win"===t?HapticType.SUCCESS:HapticType.HEAVY),wire:(e,t)=>{let o=!1;e.onScore=s,e.onLives=a,e.onTime=r,e.onEvent=e=>{"chomp"===e?(o=!o,t(o?SOUNDS.CHOMP:SOUNDS.CHOMP_ALT)):t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}}});return _0x17b3c3(EngineGameScreen,{...m,light:LIGHT,columns:[scoreColumn(t),livesColumn(o,INITIAL_LIVES),timerColumn(i,n,0)],subtext:"Eat dots, dodge ghosts!",gameOver:E({title:"win"===S?"MAZE CLEARED!":"GAME OVER",message:"win"===S?"You cleared the maze!":"The ghosts got you!",scoreLabel:"Final Score",score:t,formatter:scoreText,buttonText:"Play Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{World}from"@nayan-ui/engine";import{aimTilted}from"../shared/EngineTilt.js";import{CHASE_TIME,CHOMP_TIME,FLASH_TIME,FRUIT_SPAWN_DOTS,FRUIT_TIME,GHOST_LIST,GHOST_RELEASE,GHOST_STEP,GhostMode,GhostName,INITIAL_LIVES,PAC_STEP,POINTS_PER_FRUIT,POINTS_PER_GHOST,POWER_PELLET_TIME,SCATTER_TIME,TIME_LIMIT}from"./PacManConstants.js";import{collides,eatAt,frightenGhosts,initGhosts,initMaze,initPacman,moveGhost as
|
|
1
|
+
"use strict";import{World}from"@nayan-ui/engine";import{aimTilted}from"../shared/EngineTilt.js";import{CHASE_TIME,CHOMP_TIME,FLASH_TIME,FRUIT_SPAWN_DOTS,FRUIT_TIME,GHOST_LIST,GHOST_RELEASE,GHOST_STEP,GhostMode,GhostName,INITIAL_LIVES,PAC_STEP,POINTS_PER_FRUIT,POINTS_PER_GHOST,POWER_PELLET_TIME,SCATTER_TIME,TIME_LIMIT}from"./PacManConstants.js";import{collides,eatAt,frightenGhosts,initGhosts,initMaze,initPacman,moveGhost as _0x278b3b,reachedHouse,releaseGhost,stepPacman}from"./PacManRules.js";import{buildScene,clearDots,dressGhost,eatDot,fruitEaten,ghostEaten,moveGhost as _0x372964,movePacman,pacmanHit,placeFruit,removeScene,setPacman,setSceneTheme,startChomp,stopChomp}from"./PacManScene.js";const WORLD_CAPACITY=500,MAX_STEP=.1,SWIPE=15;export function createGame(e){const o=new World(500),n=initMaze(),t={world:o,camera:{eye:[0,0,240],target:[0,0,0],fov:1,ortho:1},theme:e,layout:null,scene:null,phase:"ready",maze:n,pacman:initPacman(),ghosts:initGhosts(),fruit:null,fruitExpireAt:0,get score(){return o.scoreboard.score},get lives(){return o.scoreboard.lives},won:!1,combo:0,mode:GhostMode.SCATTER,modeTimer:SCATTER_TIME,elapsed:0,get timeLeft(){return o.scoreboard.shownSeconds},clock:0,pacPending:0,ghostPending:0,anchor:null,onPhase:e=>{},onScore:e=>{},onLives:e=>{},onTime:e=>{},onEvent:e=>{}};return o.scoreboard.reset(INITIAL_LIVES,TIME_LIMIT),o.scoreboard.handlers={onScore:e=>t.onScore(e),onSecond:e=>t.onTime(e),onTimeUp:()=>"playing"===t.phase&&lose(t)},t}export function setLayout(e,o){e.scene&&removeScene(e.world,e.scene),e.layout=o,aimTilted(e.camera,o),e.scene=buildScene(e.world,o,e.theme),redraw(e),"playing"===e.phase?startChomp(e.world,e.scene,CHOMP_TIME):stopChomp(e.world,e.scene)}export function setTheme(e,o){e.theme=o,e.scene&&setSceneTheme(e.world,e.scene,o)}function redraw(e){const{layout:o,scene:n}=e;if(o&&n){setPacman(e.world,o,n,e.pacman.x,e.pacman.y,e.pacman.direction);for(const t of GHOST_LIST){const s=e.ghosts.find(e=>e.name===t);_0x372964(e.world,o,n,t,s.x,s.y,0,!0),dressGhost(e.world,o,n,t,s.mode,s.isFlashing)}placeFruit(e.world,o,n,e.fruit)}}function home(e){e.maze=initMaze(),e.pacman=initPacman(),e.ghosts=initGhosts(),e.fruit=null,e.won=!1,e.combo=0,e.mode=GhostMode.SCATTER,e.modeTimer=SCATTER_TIME,e.elapsed=0,e.pacPending=0,e.ghostPending=0,e.world.scoreboard.reset(INITIAL_LIVES,TIME_LIMIT),e.scene&&(clearDots(e.world,e.scene),removeScene(e.world,e.scene),e.scene=e.layout?buildScene(e.world,e.layout,e.theme):null),redraw(e)}export function start(e){"ready"===e.phase&&(home(e),e.world.scoreboard.startCountdown(TIME_LIMIT),e.phase="playing",e.scene&&startChomp(e.world,e.scene,CHOMP_TIME),e.onScore(0),e.onLives(INITIAL_LIVES),e.onTime(TIME_LIMIT),e.onPhase("playing"))}export function reset(e){home(e),e.phase="ready",e.anchor=null,e.scene&&stopChomp(e.world,e.scene),e.onScore(0),e.onLives(INITIAL_LIVES),e.onTime(TIME_LIMIT),e.onPhase("ready")}export function dispose(e){e.world.dispose()}export function drag(e,{phase:o,x:n,y:t}){if("start"===o)return void(e.anchor=[n,t]);const s=e.anchor;if(!s||"playing"!==e.phase)return;const a=n-s[0],r=t-s[1];if(Math.abs(a)<=15&&Math.abs(r)<=15)return;const i=Math.abs(a)>Math.abs(r)?a>0?"RIGHT":"LEFT":r>0?"DOWN":"UP";e.pacman.nextDirection=i,e.anchor="end"===o?null:[n,t]}export function tick(e,o){if(e.world.isDisposed)return;const n=Math.min(o,.1);if(e.clock+=n,"playing"===e.phase){for(e.elapsed+=n,advanceModes(e,n),advanceFright(e,n),e.pacPending+=n;"playing"===e.phase&&e.pacPending>=PAC_STEP;)e.pacPending-=PAC_STEP,pacStep(e);for(e.ghostPending+=n;"playing"===e.phase&&e.ghostPending>=GHOST_STEP;)e.ghostPending-=GHOST_STEP,ghostStep(e);e.fruit&&e.clock>=e.fruitExpireAt&&(e.fruit=null,e.layout&&e.scene&&placeFruit(e.world,e.layout,e.scene,null))}e.world.update(o)}function advanceModes(e,o){if(e.modeTimer-=o,e.modeTimer>0)return;const n=e.mode===GhostMode.SCATTER?GhostMode.CHASE:GhostMode.SCATTER;e.mode=n,e.modeTimer=n===GhostMode.SCATTER?SCATTER_TIME:CHASE_TIME;for(const o of e.ghosts)o.mode!==GhostMode.SCATTER&&o.mode!==GhostMode.CHASE||(o.mode=n);dressAll(e)}function advanceFright(e,o){let n=!1;for(const t of e.ghosts){if(t.mode!==GhostMode.FRIGHTENED)continue;t.frightenedTimer-=o;const s=t.frightenedTimer<FLASH_TIME;s!==t.isFlashing&&(t.isFlashing=s,n=!0),t.frightenedTimer<=0&&(t.mode=e.mode,t.isFlashing=!1,n=!0)}n&&dressAll(e)}function pacStep(e){const{layout:o,scene:n}=e;if(!o||!n)return;const{moved:t,wrapped:s}=stepPacman(e.pacman,e.maze.cells);t&&movePacman(e.world,o,n,e.pacman.x,e.pacman.y,e.pacman.direction,PAC_STEP,s);const a=eatAt(e.maze,e.pacman.x,e.pacman.y);if(a){e.world.scoreboard.add(a.points),eatDot(e.world,n,e.pacman.x,e.pacman.y),a.pellet?(e.ghosts=frightenGhosts(e.ghosts,POWER_PELLET_TIME),e.combo=0,dressAll(e),e.onEvent("pellet")):e.onEvent("chomp");const t=e.maze.totalDots-e.maze.dotsRemaining;!e.fruit&&FRUIT_SPAWN_DOTS.includes(t)&&(e.fruit={x:9,y:11},e.fruitExpireAt=e.clock+FRUIT_TIME,placeFruit(e.world,o,n,e.fruit))}e.fruit&&e.pacman.x===e.fruit.x&&e.pacman.y===e.fruit.y&&(e.world.scoreboard.add(POINTS_PER_FRUIT),fruitEaten(e.world,o,n,e.fruit.x,e.fruit.y),e.fruit=null,e.onEvent("fruit")),checkCollisions(e)||0===e.maze.dotsRemaining&&win(e)}function ghostStep(e){const{layout:o,scene:n}=e;if(!o||!n)return;for(let o=0;o<e.ghosts.length;o++){const n=e.ghosts[o];n.mode===GhostMode.IN_HOUSE&&e.elapsed>=GHOST_RELEASE[n.name]&&(e.ghosts[o]=releaseGhost(n))}const t=e.ghosts.find(e=>e.name===GhostName.BLINKY)??null,s=t?{x:t.x,y:t.y}:null;for(let t=0;t<e.ghosts.length;t++){let a=reachedHouse(e.ghosts[t]);const r=a.x;a=_0x278b3b(e.maze.cells,a,e.pacman,s),e.ghosts[t]=a;const i=Math.abs(a.x-r)>1;_0x372964(e.world,o,n,a.name,a.x,a.y,GHOST_STEP,i)}dressAll(e),checkCollisions(e)}function checkCollisions(e){const{layout:o,scene:n}=e;if(!o||!n)return!1;for(let t=0;t<e.ghosts.length;t++){const s=e.ghosts[t];if(collides(e.pacman,s))if(s.mode===GhostMode.FRIGHTENED)e.combo++,e.world.scoreboard.add(POINTS_PER_GHOST*Math.pow(2,e.combo-1)),s.mode=GhostMode.EATEN,s.isFlashing=!1,dressGhost(e.world,o,n,s.name,s.mode,!1),ghostEaten(e.world,o,s.x,s.y),e.onEvent(e.combo>1?"eatGhostCombo":"eatGhost");else if(s.mode!==GhostMode.EATEN&&s.mode!==GhostMode.IN_HOUSE&&s.mode!==GhostMode.LEAVING_HOUSE)return loseLife(e),!0}return!1}function loseLife(e){const{layout:o,scene:n}=e;e.onLives(Math.max(0,e.world.scoreboard.addLives(-1))),o&&n&&pacmanHit(e.world,o,e.pacman.x,e.pacman.y),e.lives<=0?lose(e):(e.onEvent("lifeLost"),e.pacman={...initPacman(),direction:"NONE",nextDirection:"NONE"},e.ghosts=initGhosts(),e.combo=0,e.elapsed=0,e.pacPending=0,e.ghostPending=0,redraw(e))}function win(e){e.won=!0,end(e)}function lose(e){e.won=!1,end(e)}function end(e){e.world.scoreboard.stop(),e.phase="over",e.anchor=null,e.scene&&stopChomp(e.world,e.scene),e.onPhase("over")}function dressAll(e){const{layout:o,scene:n}=e;if(o&&n)for(const t of e.ghosts)dressGhost(e.world,o,n,t.name,t.mode,t.isFlashing)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,merge,Path,quat,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,merge,Path,quat,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{createGameMesh as _0x113e69}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{CellType,COLORS,COLS,GHOST_COLORS,GHOST_LIST,GhostMode,gridPoint,PACMAN_MAZE,ROWS}from"./PacManConstants.js";const BOARD_DEPTH=.18,WALL_H=.62,BACKDROP_DEPTH=24,cube=()=>shapeGeometry("cube");let boardModel=null;function boardMesh(){if(boardModel)return boardModel;const o=COLS/2,e=ROWS/2,t=toColor(COLORS.WALL),s=toColor(COLORS.WALL_EDGE),n=toColor(COLORS.BOARD),l=[{geometry:cube(),position:[0,0,-.09],scale:[COLS,ROWS,.18],color:n}];for(let n=0;n<ROWS;n++)for(let a=0;a<COLS;a++){if(PACMAN_MAZE[n][a]!==CellType.WALL)continue;const r=a+.5-o,i=e-(n+.5);l.push({geometry:cube(),position:[r,i,.31],scale:[1,1,.62],color:t}),l.push({geometry:cube(),position:[r,i,.63],scale:[.78,.78,.04],color:s})}return boardModel=_0x113e69(merge(l),{center:!1,shine:.25}),boardModel}const dotKey=(o,e)=>e*COLS+o,worldAt=(o,e,t,s)=>{const[n,l]=gridPoint(o,e,t);return[n,l,s]},MOUTH_ANGLE={RIGHT:Math.PI/2,LEFT:-Math.PI/2,UP:Math.PI,DOWN:0,NONE:Math.PI/2},mouthRotation=o=>quat.z(MOUTH_ANGLE[o]);function spawnDots(o,e,t){const s=.22*e.cell;for(let n=0;n<ROWS;n++)for(let l=0;l<COLS;l++){const a=PACMAN_MAZE[n][l];a===CellType.DOT?t.dots.set(dotKey(l,n),o.spawn({mesh:"sphere",position:worldAt(e,l+.5,n+.5,s),scale:.17*e.cell,color:toColor(COLORS.DOT),pickable:!1})):a===CellType.POWER_PELLET&&t.dots.set(dotKey(l,n),o.spawn({mesh:"sphere",position:worldAt(e,l+.5,n+.5,.3*e.cell),scale:.46*e.cell,color:toColor(COLORS.PELLET),bob:{amplitude:[0,0,.08*e.cell],speed:5},pickable:!1}))}}const solid=o=>{const[e,t,s]=toColor(o),n=2/Math.max(e,t,s,.01);return[e*n,t*n,s*n,1]},THICK=.3,BODY_Z=-.35,TOP_Z=.15-.35+.01;let pacModel=null,mouthModel=null,ghostModel=null,discModel=null;const pacMesh=()=>pacModel??=_0x113e69(extrude((new Path).addCircle(0,0,.5),{depth:.3})),mouthMesh=()=>{if(mouthModel)return mouthModel;const o=(new Path).moveTo(0,0);for(let e=0;e<=8;e++){const t=e/8*.62*2-.62;o.lineTo(.56*Math.sin(t),.56*Math.cos(t))}return o.close(),mouthModel=_0x113e69(extrude(o,{depth:0}),{center:!1}),mouthModel},ghostMesh=()=>{if(ghostModel)return ghostModel;const o=[];for(let e=0;e<=16;e++){const t=e/16*Math.PI;o.push([.5*Math.cos(t),.05+.5*Math.sin(t)])}o.push([-.5,-.38]);for(let e=0;e<=6;e++)o.push([e/6*1-.5,e%2?-.5:-.36]);o.push([.5,-.38]);const e=(new Path).moveTo(o[0][0],-o[0][1]);for(const[t,s]of o.slice(1))e.lineTo(t,-s);return e.close(),ghostModel=_0x113e69(extrude(e,{depth:.3})),ghostModel},flatDisc=()=>discModel??=_0x113e69(extrude((new Path).addCircle(0,0,.5),{depth:0}));function spawnPacman(o,e){const t=.86*e.cell,s=o.spawn({mesh:"none",position:worldAt(e,9.5,15.5,t/2),pickable:!1});return o.spawn({mesh:pacMesh(),parent:s,position:[0,0,-.35*t],scale:t,color:solid(COLORS.PACMAN),pickable:!1}),{pacman:s,mouth:o.spawn({mesh:mouthMesh(),parent:s,position:[0,0,TOP_Z*t],rotation:mouthRotation("LEFT"),scale:t,color:toColor(COLORS.BOARD),pickable:!1})}}function spawnGhost(o,e,t){const s=.86*e.cell,n=o.spawn({mesh:"none",position:worldAt(e,9.5,7.5,.5*s),pickable:!1}),l=o.spawn({mesh:ghostMesh(),parent:n,position:[0,0,-.35*s],scale:s,color:solid(GHOST_COLORS[t]),pickable:!1}),a=e=>o.spawn({mesh:flatDisc(),parent:n,position:[e*s*.19,.1*s,TOP_Z*s],scale:[.26*s,.32*s,1],color:solid(COLORS.EYE),pickable:!1}),r=e=>o.spawn({mesh:flatDisc(),parent:n,position:[e*s*.19,.06*s,(TOP_Z+.01)*s],scale:.13*s,color:solid(COLORS.PUPIL),pickable:!1});return{root:n,body:l,eyes:[a(-1),a(1)],pupils:[r(-1),r(1)]}}export function buildScene(o,e,t){const s=spawnBackdrop(o,e.width,e.height,-24,t);placeTiltedBackdrop(o,s,e,24);const n=o.spawn({mesh:boardMesh(),scale:e.cell,color:[1,1,1,1],pickable:!1}),{pacman:l,mouth:a}=spawnPacman(o,e),r={};for(const t of GHOST_LIST)r[t]=spawnGhost(o,e,t);const i={backdrop:s,board:n,dots:new Map,pacman:l,mouth:a,mouthSize:.86*e.cell,ghosts:r,fruit:null};return spawnDots(o,e,i),i}export function removeScene(o,e){o.despawn(e.backdrop),o.despawn(e.board);for(const t of e.dots.values())o.despawn(t);o.despawn(e.pacman);for(const t of GHOST_LIST)o.despawn(e.ghosts[t].root);null!=e.fruit&&o.despawn(e.fruit)}export function setSceneTheme(o,e,t){setBackdropTheme(o,e.backdrop,t)}export function eatDot(o,e,t,s){const n=e.dots.get(dotKey(t,s));null!=n&&(o.despawn(n),e.dots.delete(dotKey(t,s)))}export function clearDots(o,e){for(const t of e.dots.values())o.despawn(t);e.dots.clear()}export function placeFruit(o,e,t,s){if(null!=t.fruit&&(o.despawn(t.fruit),t.fruit=null),!s)return;const n=.7*e.cell,l=o.spawn({mesh:"none",position:worldAt(e,s.x+.5,s.y+.5,n/2),bob:{amplitude:[0,0,.1*e.cell],speed:4},pickable:!1});o.spawn({mesh:"sphere",parent:l,scale:n,color:toColor(COLORS.FRUIT),pickable:!1}),o.spawn({mesh:"cylinder",parent:l,position:[0,.1*n,.5*n],scale:[.08*n,.4*n,.08*n],color:toColor(COLORS.FRUIT_STEM),pickable:!1}),o.set(l,{scale:.01}),o.animate(l,{scale:1},{duration:.25,easing:"back"}),t.fruit=l}export function fruitEaten(o,e,t,s,n){effects.sparkle(o,{position:worldAt(e,s+.5,n+.5,.5*e.cell),count:18,size:.12*e.cell,speed:5*e.cell,lifetime:.5,gravity:8*-e.cell,colors:[toColor("#FF5252"),toColor("#FFCDD2"),[1,1,1,1]]}),placeFruit(o,e,t,null)}export function movePacman(o,e,t,s,n,l,a,r){const i=.86*e.cell,p=worldAt(e,s+.5,n+.5,i/2);o.set(t.mouth,{rotation:mouthRotation(l)}),r?o.set(t.pacman,{position:p}):o.animate(t.pacman,{position:p},{duration:a,easing:"linear"})}export function setPacman(o,e,t,s,n,l){const a=.86*e.cell;o.stopAnimation(t.pacman),o.set(t.pacman,{position:worldAt(e,s+.5,n+.5,a/2)}),o.set(t.mouth,{rotation:mouthRotation(l)})}export function startChomp(o,e,t){o.stopAnimation(e.mouth),o.set(e.mouth,{scale:.05*e.mouthSize}),o.animate(e.mouth,{scale:e.mouthSize},{duration:t,easing:"easeInOut",repeat:"forever",yoyo:!0})}export function stopChomp(o,e){o.stopAnimation(e.mouth),o.set(e.mouth,{scale:.6*e.mouthSize})}export function pacmanHit(o,e,t,s){effects.explosion(o,{position:worldAt(e,t+.5,s+.5,.5*e.cell),count:26,size:.5*e.cell,speed:4*e.cell,lifetime:.6,colors:[toColor("#FFE000"),toColor("#FFB000")]})}const ghostLook=(o,e,t)=>o===GhostMode.FRIGHTENED?solid(t?COLORS.FRIGHTENED_FLASH:COLORS.FRIGHTENED):solid(GHOST_COLORS[e]);export function moveGhost(o,e,t,s,n,l,a,r){const i=.86*e.cell,p=worldAt(e,n+.5,l+.5,.5*i),d=t.ghosts[s];r?o.set(d.root,{position:p}):o.animate(d.root,{position:p},{duration:a,easing:"linear"})}export function dressGhost(o,e,t,s,n,l){const a=.86*e.cell,r=t.ghosts[s],i=n===GhostMode.EATEN;o.set(r.body,{scale:i?0:a,color:ghostLook(n,s,l)})}export function ghostEaten(o,e,t,s){effects.sparkle(o,{position:worldAt(e,t+.5,s+.5,.5*e.cell),count:16,size:.12*e.cell,speed:4*e.cell,lifetime:.4,gravity:6*-e.cell,colors:[toColor("#80DEFF"),[1,1,1,1]]})}
|
|
@@ -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{textColumn,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_MS,getLayout,gridFor,LIGHT,LOW_TIME,PLAYER_COLORS}from"./PaperIoConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./PaperIoGame.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{textColumn,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_MS,getLayout,gridFor,LIGHT,LOW_TIME,PLAYER_COLORS}from"./PaperIoConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./PaperIoGame.js";import{jsx as _0x4b49c8}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.PAPER_IO,FULL_TIME=Math.round(GAME_DURATION_MS/1e3),NO_STATS={score:0,territoryPct:0,aiPct:0,rank:1,alivePlayers:1};export const PaperIo=engineGame(GAME_IDS.PAPER_IO,e=>{const[t,r]=useLiveState(!1),[s,o]=useLiveState(NO_STATS),[a,i]=useLiveState(FULL_TIME),{game:n,theme:m,status:S,screen:u,gameOver:p}=useEngineGame(e,{gameId:GAME_IDS.PAPER_IO,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s)=>{const o=e.grid??gridFor(t,s,isTablet);setLayout(e,getLayout(t,s,o)),r(!0)},drag:drag,reportScore:e=>e.stats?.score??0,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(null,HapticType.MEDIUM),wire:(e,t)=>{e.onStats=o,e.onTime=i,e.onEvent=r=>{"turn"===r?t(SOUNDS.TURN,HapticType.SELECTION):"capture"===r?t(SOUNDS.CAPTURE,HapticType.MEDIUM):t(e.won?SOUNDS.WIN:SOUNDS.GAME_OVER,e.won?HapticType.SUCCESS:HapticType.ERROR)}}}),E=useMemo(()=>toRgb(m.BACKGROUND),[m.BACKGROUND]);return _0x4b49c8(EngineGameScreen,{...u,source:t&&n.world?n.world:null,light:LIGHT,background:E,columns:[textColumn("YOU",s.territoryPct+"%",PLAYER_COLORS[0].head),timerColumn(a,m,LOW_TIME),textColumn("AI",s.aiPct+"%",PLAYER_COLORS[1].head)],subtext:"Claim the most land!",gameOver:p({title:"win"===S?"YOU WIN!":"GAME OVER",message:"win"===S?"You beat the AI "+s.territoryPct+"% to "+s.aiPct+"%!":"You "+s.territoryPct+"% vs AI "+s.aiPct+"% \u2014 try again!",scoreLabel:"Cells Captured",score:s.score,buttonText:"Play Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{block,ellipsoid,loft,merge,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{block,ellipsoid,loft,merge,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x384c03}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{COLORS,PERSON_COLORS}from"./PaperIoConstants.js";const WHITE=[1,1,1,1],part=(o,e,t)=>({geometry:o,position:e,color:t}),orb=(o,e,t,r=12)=>part(ellipsoid(o,void 0,r),e,t),pipe=(o,e,t,r=10)=>({geometry:tube(o,{radius:e,sides:r,smoothness:3,caps:!0}),color:t}),model=(o,e=.12)=>_0x384c03(merge(o),{center:!1,shine:e});function flagGeometry(o){const e=[],t=[];for(const r of[1,-1]){const s=e.length/11;for(let t=0;t<=6;t++)for(let s=0;s<=12;s++){const p=s/12,a=t/6,i=p*Math.PI*2.1-o+.7*a,n=Math.sin(i)*p*.085,h=.085*(Math.sin(i)+p*Math.PI*2.1*Math.cos(i)),l=.085*p*.7*Math.cos(i),m=.56*h+.045*l,d=.78*.56,O=-.78*l,u=Math.hypot(m,d,O),f=12===s||0===t||6===t?.78:1;e.push(.78*-p,n,.56*a-.045*p,r*m/u,r*d/u,r*O/u,f,f,f,p,a)}for(let o=0;o<6;o++)for(let e=0;e<12;e++){const p=s+13*o+e,a=p+1,i=p+12+1,n=i+1;r>0?t.push(p,a,i,a,n,i):t.push(p,i,a,a,i,n)}}return{vertices:Float32Array.from(e),indices:Uint32Array.from(t)}}let cached=null;export function personMeshes(){return cacheGameAsset("paper-io/PaperIoMeshes:personMeshes",()=>personMeshesUncached())}function personMeshesUncached(){if(cached)return cached;const o=toColor(PERSON_COLORS.PANTS),e=toColor(PERSON_COLORS.HAIR),t=toColor(PERSON_COLORS.POLE),r=toColor(PERSON_COLORS.SHOE),s=toColor(PERSON_COLORS.SOLE),p=toColor(COLORS.EYE),a=toColor(COLORS.PUPIL),i=model([{geometry:loft([{z:.9,bottom:-.145,top:.145,width:.115,square:2.8},{z:1.04,bottom:-.155,top:.155,width:.105,square:2.8},{z:1.3,bottom:-.225,top:.225,width:.13,square:2.6},{z:1.41,bottom:-.2,top:.2,width:.105,square:2.4},{z:1.47,bottom:-.07,top:.07,width:.065,square:2}],{around:16,smoothness:2})},pipe([[0,-.205,1.37],[.025,-.27,1.25],[.04,-.29,1.18]],.075),pipe(Array.from({length:17},(o,e)=>[.06*Math.cos(e*Math.PI/8),.07*Math.sin(e*Math.PI/8),1.465]),.015,[.74,.74,.74,1],6)]),n=model([orb([.108,.108,.133],[.005,0,1.65],WHITE,16),pipe([[0,0,1.45],[0,0,1.55]],.052),orb([.026,.023,.03],[.109,0,1.64]),...[-1,1].map(o=>orb([.022,.017,.036],[-.012,.109*o,1.65])),pipe([[.04,-.29,1.18],[.13,-.305,1.16],[.24,-.31,1.21]],.05),orb([.046,.045,.06],[.24,-.31,1.22])]),h=[orb([.11,.116,.073],[-.021,0,1.744],e,16),orb([.06,.104,.077],[-.065,0,1.69],e),orb([.115,.173,.12],[0,0,.855],o),part(block(.025,.055,.075),[.128,-.065,1.3],toColor(PERSON_COLORS.BADGE)),pipe([[.24,-.31,.05],[.24,-.31,1.22],[.24,-.31,3]],.013,t,8),orb([.025,.025,.025],[.24,-.31,3.02],t,8),pipe([[.107,-.025,1.603],[.115,0,1.598],[.107,.025,1.603]],.004,[.36,.2,.17,1],6)];for(const o of[-1,1])h.push(orb([.018,.024,.017],[.101,.047*o,1.678],p,8)),h.push(orb([.009,.01,.012],[.117,.047*o,1.678],a,8)),h.push(pipe([[.105,.027*o,1.706],[.098,.066*o,1.707]],.006,e,6));const l=model([pipe([[0,0,0],[.01,.04,-.12],[.025,.055,-.23]],.073)]),m=model([pipe([[.025,.055,-.22],[.045,.06,-.35],[.075,.055,-.46]],.045),orb([.038,.039,.06],[.08,.055,-.475])]),d=model([pipe([[0,0,0],[.035,0,-.34],[-.01,0,-.72]],.072,o),orb([.071,.071,.085],[.035,0,-.34],o),orb([.142,.066,.06],[.065,0,-.778],r),part(block(.275,.133,.025),[.065,0,-.832],s),pipe([[.11,-.04,-.73],[.11,.04,-.73]],.009,s,6),pipe([[.065,-.04,-.725],[.065,.04,-.725]],.009,s,6)]),O=[0,2*Math.PI/3,4*Math.PI/3].map(o=>_0x384c03(flagGeometry(o),{center:!1,shine:.02}));return cached={shirt:i,skin:n,details:model(h),sleeve:l,hand:m,leg:d,flags:O},cached}export function*warmAssets(){yield personMeshes}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,Path,quat}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,Path,quat}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x26f341}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{cellCentre,COLORS,LAND,PERSON,PERSON_COLORS,PLAYER_COLORS,STEP_MS,TRAIL,WORLD_SCALE}from"./PaperIoConstants.js";import{personMeshes}from"./PaperIoMeshes.js";const meshes=new Map,cached=(e,o)=>{let a=meshes.get(e);return!a&&(a=cacheGameAsset("paper-io/PaperIoScene:"+e,o),meshes.set(e,a)),a},BOARD_DEPTH=8,BACKDROP_DEPTH=30,GLIDE=Math.ceil(STEP_MS/(1e3/60))*(1e3/60)/1e3,FLASH=.48,panelMesh=(e,o,a)=>cached("pio-panel:"+e+"x"+o+":"+a,()=>_0x26f341(extrude((new Path).addRoundedRect(-e/2,-o/2,e,o,a),{depth:8}),{shine:.15}));function landCorners(e,o,a,t){const n=(o,a)=>o<0||o>=e.cols||a<0||a>=e.rows||e.owners[a*e.cols+o]===t,r=n(o,a-1),s=n(o+1,a),l=n(o,a+1),i=n(o-1,a);return(r||i?0:1)|(r||s?0:2)|(l||s?0:4)|(l||i?0:8)}function landMesh(e){return e?cached("pio-land:"+e,()=>{const o=e&e-1?.48:.95,[a,t,n,r]=[1,2,4,8].map(a=>e&a?o:0),s=(new Path).moveTo(-.5+a,-.5).lineTo(.5-t,-.5);return t&&s.arcTo(t,t,0,!1,!0,.5,-.5+t),s.lineTo(.5,.5-n),n&&s.arcTo(n,n,0,!1,!0,.5-n,.5),s.lineTo(-.5+r,.5),r&&s.arcTo(r,r,0,!1,!0,-.5,.5-r),s.lineTo(-.5,-.5+a),a&&s.arcTo(a,a,0,!1,!0,-.5+a,-.5),_0x26f341(extrude(s.close(),{depth:1}),{center:!1})}):"cube"}const boardColor=e=>toColor("classic"===e.mode?COLORS.CLASSIC_BOARD:e.BOARD.SURFACE),landColor=e=>toColor(PLAYER_COLORS[e-1]?.territory??"#888888"),trailColor=e=>toColor(PLAYER_COLORS[e-1]?.trail??"#AAAAAA",.6),landH=e=>e.cell*LAND,facing=e=>quat.z(Math.atan2(-e.dy,e.dx));function spawnHead(e,o,a,t){const n=PLAYER_COLORS[a],r=personMeshes(),s=e.spawn({mesh:"none",parent:t,pickable:!1}),l=e.spawn({mesh:"none",parent:s,scale:o.cell*PERSON.SCALE,pickable:!1}),i=toColor(PERSON_COLORS.SKIN[a%PERSON_COLORS.SKIN.length]);e.spawn({mesh:r.shirt,parent:l,color:toColor(n.head),pickable:!1}),e.spawn({mesh:r.skin,parent:l,color:i,pickable:!1}),e.spawn({mesh:r.details,parent:l,pickable:!1});const p=[-1,1].map(o=>{const a=e.spawn({mesh:"none",parent:l,position:[0,.11*o,.86],pickable:!1});return e.spawn({mesh:r.leg,parent:a,pickable:!1}),a}),d=e.spawn({mesh:"none",parent:l,position:[0,.205,1.37],pickable:!1});e.spawn({mesh:r.sleeve,parent:d,color:toColor(n.head),pickable:!1}),e.spawn({mesh:r.hand,parent:d,color:i,pickable:!1});const h=e.spawn({mesh:"none",parent:l,position:[.24,-.31,2.4],pickable:!1}),m=e.spawn({mesh:r.flags[a%r.flags.length],parent:h,rotation:quat.z(-.055),color:toColor(n.head),pickable:!1});return e.animate(m,{rotation:quat.z(.055)},{duration:.5+.08*a,repeat:"forever",yoyo:!0,easing:"easeInOut"}),{root:s,visual:l,legs:p,arm:d,flag:m,stride:a,col:-1,row:-1,walking:!1}}function rest(e,o){for(const a of[...o.legs,o.arm])e.stopAnimation(a),e.animate(a,{rotation:[0,0,0,1]},{duration:.15});e.stopAnimation(o.visual),e.set(o.visual,{position:[0,0,0]}),o.walking=!1}export function buildScene(e,o,a,t){const n=e.spawn({mesh:"none",scale:WORLD_SCALE,pickable:!1}),r=spawnBackdrop(e,o.width,o.height,-30,a);e.set(r,{parent:n}),placeTiltedBackdrop(e,r,o,30);const s=e.spawn({mesh:panelMesh(o.gridW,o.gridH,"classic"===a.mode?0:8),parent:n,position:[0,0,-4],color:boardColor(a),pickable:!1}),l={root:n,backdrop:r,board:s,land:new Array(t.total).fill(null),landOwner:new Int8Array(t.total),landCorners:new Uint8Array(t.total),trail:new Array(t.total).fill(null),trailOwner:new Int8Array(t.total),heads:t.players.map((a,t)=>spawnHead(e,o,t,n))};return syncBoard(e,o,l,t,!1),placeHeads(e,o,l,t,!1),l}export function removeScene(e,o){e.despawn(o.root)}export function setSceneTheme(e,o,a,t){setBackdropTheme(e,a.backdrop,t),e.set(a.board,{mesh:panelMesh(o.gridW,o.gridH,"classic"===t.mode?0:8),color:boardColor(t)})}export function syncBoard(e,o,a,t,n,r){const s=landH(o),l=o.cell*TRAIL;for(let i=0,p=r?.length??t.total;i<p;i++){const p=r?r[i]:i,d=t.owners[p],h=p%t.cols,m=(p-h)/t.cols,u=d?landCorners(t,h,m,d):0;if(d!==a.landOwner[p]||u!==a.landCorners[p]){const[t,r]=cellCentre(o,h,m);let l=a.land[p];if(0===d)null!=l&&e.despawn(l),a.land[p]=null;else{const i=landColor(d),h=landMesh(u);null==l?(l=e.spawn({mesh:h,parent:a.root,position:[t,r,s/2],scale:[o.columnWidth,o.rowDepth,s],color:i,pickable:!1}),a.land[p]=l):e.set(l,{mesh:h}),n&&d!==a.landOwner[p]?(e.stopAnimation(l),e.set(l,{color:toColor(COLORS.FLASH),position:[t,r,.75*s],scale:[o.columnWidth,o.rowDepth,1.5*s]}),e.animate(l,{color:i,position:[t,r,s/2],scale:[o.columnWidth,o.rowDepth,s]},{duration:.48,easing:"easeOut"})):e.set(l,{color:i})}a.landOwner[p]=d,a.landCorners[p]=u}const C=t.trails[p];if(C!==a.trailOwner[p]){const n=a.trail[p];if(null!=n&&e.despawn(n),a.trail[p]=null,0!==C){const n=p%t.cols,r=(p-n)/t.cols,[i,d]=cellCentre(o,n,r),h=e.spawn({mesh:"cube",parent:a.root,position:[i,d,s+l/2],scale:[.86*o.columnWidth,.86*o.rowDepth,l],color:trailColor(C),pickable:!1});e.set(h,{scale:[.4*o.columnWidth,.4*o.rowDepth,l]}),e.animate(h,{scale:[.86*o.columnWidth,.86*o.rowDepth,l]},{duration:.12,easing:"back"}),a.trail[p]=h}a.trailOwner[p]=C}}}export function placeHeads(e,o,a,t,n,r=[]){t.players.forEach((s,l)=>{const i=a.heads[l];if(!i)return;const[p,d]=cellCentre(o,s.col,s.row),h=landH(o)+(t.trails[s.row*t.cols+s.col]?o.cell*TRAIL:0)+.02*o.cell,m=facing(s.dir),u=i.col!==s.col||i.row!==s.row;if(n)if(e.animate(i.root,{position:[p,d,h]},{duration:GLIDE,easing:"linear"}),e.animate(i.root,{rotation:m},{duration:.14}),u&&s.alive){const a=++i.stride%2==0?1:-1;i.legs.forEach((o,t)=>e.animate(o,{rotation:quat.y(PERSON.STRIDE*a*(0===t?1:-1))},{duration:GLIDE,easing:"easeInOut"})),e.animate(i.arm,{rotation:quat.y(-PERSON.STRIDE*a*.7)},{duration:GLIDE,easing:"easeInOut"}),e.animate(i.visual,[{position:[0,0,.055*o.cell],at:.5},{position:[0,0,0]}],{duration:GLIDE,easing:"easeInOut"});const t=personMeshes().flags;e.set(i.flag,{mesh:t[i.stride%t.length]}),i.walking=!0}else i.walking&&rest(e,i);else e.stopAnimation(i.root),e.set(i.root,{position:[p,d,h],rotation:m,scale:s.alive?1:0});if(i.col=s.col,i.row=s.row,r[l]){e.animate(i.root,[{scale:1.22,at:.3},{scale:1}],{duration:.35,easing:"easeOut"});const[a,t]=cellCentre(o,s.col,s.row);effects.shatter(e,{position:[a*WORLD_SCALE,t*WORLD_SCALE,(h+o.cell)*WORLD_SCALE],count:14,size:.3*o.cell*WORLD_SCALE,speed:8*o.cell*WORLD_SCALE,lifetime:.5,gravity:20*-o.cell*WORLD_SCALE,colors:[toColor(PLAYER_COLORS[l].head),toColor("#FFFFFF")]})}})}export function finish(e,o,a,t){a.heads.forEach((o,a)=>{rest(e,o);const n=0===a===t;e.stopAnimation(o.root),n?e.animate(o.root,[{scale:PERSON.CELEBRATION_SCALE,at:.4},{scale:1.3}],{duration:.5,easing:"easeOut"}):e.animate(o.root,{scale:.75},{duration:.4})}),t&&effects.confetti(e,{position:[0,0,3*o.cell*WORLD_SCALE],count:70,size:.5*o.cell*WORLD_SCALE,speed:1.2*o.gridW*WORLD_SCALE,lifetime:1.4,gravity:2*-o.gridW*WORLD_SCALE,colors:["#6BCB77","#FFD93D","#FFFFFF","#4CA85B"].map(e=>toColor(e))})}export function*warmAssets(){for(let e=1;e<16;e++)yield()=>landMesh(e)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{lathe,merge,shapeGeometry,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{lathe,merge,shapeGeometry,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x55d9f5}from"../shared/EngineMeshes.js";const NAVY=[.06,.08,.14],NAVY_SHEEN=[.16,.2,.32],CREAM=[1,.98,.93],CREAM_SHADE=[.88,.9,.95],ORANGE=[1,.62,.12],ORANGE_DARK=[.92,.42,.08],IRIS=[.18,.5,.95],IRIS_DARK=[.06,.2,.55],rgba=(e,o=1)=>[e[0],e[1],e[2],o],mix=(e,o,t)=>{const s=Math.min(1,Math.max(0,t));return[e[0]+(o[0]-e[0])*s,e[1]+(o[1]-e[1])*s,e[2]+(o[2]-e[2])*s]},inside=(e,o,t)=>Math.min(1,Math.max(0,(o-e)/t+.5)),ellipse=(e,o,t,s=28)=>Array.from({length:s+1},(a,r)=>{const n=Math.PI/2-r/s*Math.PI;return[Math.max(.001,Math.cos(n)*e),t+Math.sin(n)*o]}),HEAD_Y=.49,HEAD_RX=.25,HEAD_RY=.225,headZ=(e,o)=>.25*Math.sqrt(Math.max(0,1-(e/.25)**2-((o-.49)/.225)**2));function bodyColor({position:[e,o,t]}){const s=mix(NAVY,NAVY_SHEEN,.6*(o+.3)*Math.max(0,-t/.3+.3)),a=Math.sqrt((e/.235)**2+((o+.04)/.255)**2),r=inside(a,1,.06)*inside(-t,-.04,.04);return rgba(mix(s,mix(CREAM_SHADE,CREAM,2*(o+.25)),r))}function headColor({position:[e,o,t]}){const s=mix(NAVY,NAVY_SHEEN,.5*Math.max(0,(o-.49)/.225)),a=Math.min(Math.hypot(e-.072,o-.53)/.1,Math.hypot(e+.072,o-.53)/.1),r=Math.hypot(e/1.15,o-.44)/.115,n=inside(Math.min(a,r),1,.08)*inside(-t,-.06,.04);return rgba(mix(s,CREAM,n))}const onFace=(e,o,t,s,a)=>({geometry:shapeGeometry("sphere"),position:[e,o,headZ(e,o)+s],scale:t,color:a});function eye(e){const o=.074*e;return[onFace(o,.525,[.1,.122,.05],-.012,rgba([1,1,1])),onFace(o+.004*e,.519,[.07,.08,.03],.004,rgba(IRIS_DARK)),onFace(o+.004*e,.513,[.058,.06,.03],.008,rgba(IRIS)),onFace(o+.004*e,.519,[.036,.042,.03],.013,rgba([.02,.02,.04])),onFace(o-.014,.539,.024,.024,[1.8,1.8,1.8,1]),onFace(o+.016,.503,.011,.022,[1.6,1.6,1.6,1]),{geometry:tube([[o+.05*e,.593,headZ(o+.05*e,.593)+.004],[o,.61,headZ(o,.61)+.006],[o-.045*e,.6,headZ(o-.045*e,.6)+.004]],{radius:e=>.009+.005*Math.sin(e*Math.PI),sides:6,color:rgba(NAVY)})}]}function beak(){const e=headZ(0,.46),o=e=>1+.45*Math.abs(Math.cos(e*Math.PI*2));return[{geometry:tube([[0,.468,e-.03],[0,.464,e+.03],[0,.452,e+.075],[0,.44,e+.09]],{radius:e=>.048*(1-.85*e),shape:o,sides:16,color:({v:e})=>rgba(mix(ORANGE,ORANGE_DARK,.6*e))})},{geometry:tube([[0,.436,e-.03],[0,.434,e+.02],[0,.432,e+.05]],{radius:e=>.03*(1-.8*e),shape:o,sides:14,color:rgba(ORANGE_DARK)})}]}const tufts=()=>[-1,0,1].map(e=>({geometry:tube([[.035*e,.715-.03,-.02],[.05*e,.755,0-.01*Math.abs(e)],[.065*e,.715+.07,.05]],{radius:o=>.022*(1-.85*o)*(0===e?1.15:.9),sides:8,color:rgba(NAVY)})})),tail=()=>({geometry:tube([[0,-.2,-.26],[0,-.27,-.33],[0,-.3,-.38]],{radius:e=>.07*(1-.8*e),shape:e=>.4+.6*Math.abs(Math.cos(e*Math.PI*2)),sides:12,color:rgba(NAVY)})});let bodyModel=null;export function bodyMesh(){return cacheGameAsset("penguin-run/PenguinMeshes:bodyMesh",()=>bodyMeshUncached())}function bodyMeshUncached(){if(bodyModel)return bodyModel;const e=lathe([[.001,.42],[.14,.4],[.18,.34],[.2,.29],[.225,.24],[.258,.17],[.284,.09],[.302,0],[.306,-.08],[.296,-.16],[.268,-.24],[.215,-.3],[.13,-.33],[.001,-.338]],{segments:64,color:bodyColor}),o=lathe(ellipse(.25,.225,.49,32),{segments:64,color:headColor});return bodyModel=_0x55d9f5(merge([{geometry:e},{geometry:o},...eye(-1),...eye(1),...beak(),...tufts(),tail()]),{center:!1,shine:.55}),bodyModel}const flipperModels={};export function flipperMesh(e){return cacheGameAsset("penguin-run/PenguinMeshes:flipperMesh"+JSON.stringify([e]),()=>flipperMeshUncached(e))}function flipperMeshUncached(e){const o=flipperModels[e];if(o)return o;const t=tube([[.07*-e,.05,0],[.01*-e,.02,0],[.02*e,-.08,.01],[.022*e,-.17,.005],[.01*e,-.24,-.01],[.006*-e,-.27,-.015]],{radius:e=>.06*Math.sin(.6+2.2*e)+.012,shape:e=>.32+.68*Math.abs(Math.cos(e*Math.PI*2)),sides:18,smoothness:10,color:({normal:o})=>rgba(o[0]*e<-.25?CREAM_SHADE:NAVY)}),s=_0x55d9f5(t,{center:!1,shine:.5});return flipperModels[e]=s,s}let footModel=null;export function footMesh(){return cacheGameAsset("penguin-run/PenguinMeshes:footMesh",()=>footMeshUncached())}function footMeshUncached(){if(footModel)return footModel;const e=shapeGeometry("sphere"),o=[-.42,0,.42].map(e=>({geometry:tube([[0,.03,.04],[.05*Math.sin(e),.026,.09],[.08*Math.sin(e),.022,.135]],{radius:e=>.032-.008*e,sides:10,color:rgba(ORANGE)})})),t=[-.42,0,.42].map(o=>({geometry:e,position:[.08*Math.sin(o),.022,.135],scale:.048,color:rgba(ORANGE)})),s={geometry:tube([[0,.04,.02],[0,.12,0],[0,.22,-.01]],{radius:e=>.045+.04*e,sides:12,color:({v:e})=>rgba(e<.35?mix(ORANGE_DARK,ORANGE,2*e):NAVY)})};return footModel=_0x55d9f5(merge([s,{geometry:e,position:[0,.03,.05],scale:[.15,.06,.16],color:rgba(mix(ORANGE,ORANGE_DARK,.3))},...o,...t]),{center:!1,shine:.35}),footModel}export function*warmAssets(){yield bodyMesh,yield footMesh,yield()=>flipperMesh(-1),yield()=>flipperMesh(1)}
|
|
@@ -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{MAX_LIVES,RESULTS_DELAY_LOSE,RESULTS_DELAY_WIN,TRACK_LENGTH}from"./PenguinRunConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,steer,tick}from"./PenguinRunGame.js";import{backgroundFor,FOG,lightFor}from"./PenguinRunScene.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{MAX_LIVES,RESULTS_DELAY_LOSE,RESULTS_DELAY_WIN,TRACK_LENGTH}from"./PenguinRunConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,steer,tick}from"./PenguinRunGame.js";import{backgroundFor,FOG,lightFor}from"./PenguinRunScene.js";import{jsx as _0x57d242}from"react/jsx-runtime";const SFX=GAME_SOUNDS.PENGUIN_RUN;export const PenguinRun=engineGame(GAME_IDS.PENGUIN_RUN,e=>{const[t,s]=useLiveState(0),[n,r]=useLiveState(0),[i,o]=useLiveState(MAX_LIVES),[a,S]=useLiveState(0),{theme:m,status:u,screen:E,gameOver:p}=useEngineGame(e,{gameId:GAME_IDS.PENGUIN_RUN,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s)=>setLayout(e,t,s),drag:(e,{phase:t,x:s,y:n})=>steer(e,t,s,n),sounds:SFX,resultsDelay:e=>"win"===e?RESULTS_DELAY_WIN:RESULTS_DELAY_LOSE,onStart:e=>e(SFX.START),wire:(e,t)=>{e.onScore=s,e.onCoins=r,e.onLives=o,e.onDistance=S,e.onCoin=e=>t(e?SFX.GEM:SFX.COIN,e?HapticType.LIGHT:null),e.onJump=()=>t(SFX.JUMP),e.onSlide=()=>t(SFX.SLIDE),e.onLane=()=>t(SFX.LANE_SWITCH,HapticType.LIGHT),e.onHurt=()=>t(SFX.CRASH,HapticType.HEAVY),e.onCrash=()=>{t(SFX.CRASH,HapticType.HEAVY),e.world.after(.5,()=>t(SFX.GAME_OVER))},e.onWin=()=>t(GAME_SOUNDS.WELL_DONE,HapticType.SUCCESS)}}),L=useMemo(()=>lightFor(m),[m]),G=useMemo(()=>backgroundFor(m),[m]);return _0x57d242(EngineGameScreen,{...E,light:L,background:G,fog:FOG,columns:[scoreColumn(t),livesColumn(i,MAX_LIVES),textColumn("TRACK",TRACK_LENGTH-a+" m")],subtext:"Swipe, jump and slide!",gameOver:p({title:"win"===u?"YOU MADE IT!":"OUCH!",message:"win"===u?"Made it to the finish with "+n+" coins!":"Out of lives after "+a+" of "+TRACK_LENGTH+" m. Try a new track!",scoreLabel:"Score",score:t,buttonText:"win"===u?"Run Again!":"Try Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,lathe,merge,quat,recolor,shapeGeometry,tube}from"@nayan-ui/engine";import{noise,random}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x455388}from"../shared/EngineMeshes.js";import{FINISH_CLEAR,LANE_X,SLAB,START_CLEAR,TILE_LENGTH,TILES_BEFORE_START,TILES_PAST_FINISH,TRACK_LENGTH}from"./PenguinRunConstants.js";export const LAST_TILE=Math.ceil(TRACK_LENGTH/TILE_LENGTH)+TILES_PAST_FINISH-1;const night=e=>"dark"===e.mode,DAY_LIGHT={direction:[.4,.9,.5],ambient:.72,color:[1.3,1.24,1.12],shadows:!0,shadowExtent:16},NIGHT_LIGHT={direction:[-.3,.85,.5],ambient:.66,color:[.95,1,1.25],shadows:!0,shadowExtent:16};export const lightFor=e=>night(e)?NIGHT_LIGHT:DAY_LIGHT;export const backgroundFor=e=>night(e)?[.16,.2,.32]:[.78,.88,.92];export const FOG=.02;const CANOPY_Y=-8,TREE_SPREAD=7.5,rgba=(e,o=1)=>[e[0],e[1],e[2],o],mix=(e,o,t)=>{const r=Math.min(1,Math.max(0,t));return[e[0]+(o[0]-e[0])*r,e[1]+(o[1]-e[1])*r,e[2]+(o[2]-e[2])*r]},STONE=[.82,.77,.66],STONE_DARK=[.56,.52,.45],MOSS=[.42,.56,.26],BARK=[.48,.34,.2],LEAF=[.26,.52,.18],LEAF_LIGHT=[.5,.72,.28],GOLD=[1,.76,.2],LEAF_DARK=[.12,.3,.1],PALM=[.34,.6,.2],WALK_X=3.78,WALK_WIDTH=1.44,WALK_OUTER=4.5,meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("penguin-run/PenguinRunScene:"+e,o),meshes.set(e,t)),t},weathered=(e,o=.5)=>({position:[t,r,s]})=>{const a=noise(3.1*t+e,3.1*s+2.3*r);let n=mix(STONE_DARK,STONE,.35+.8*a);return n=mix(n,MOSS,2.2*Math.max(0,noise(1.3*t+2*e,1.3*s+r)-(1-o))),rgba(n)},pathMesh=e=>cached("pr-path:"+e,()=>{const o=random(40+e),t=shapeGeometry("roundedBox"),r=[{geometry:shapeGeometry("cube"),position:[0,-.31,-TILE_LENGTH/2],scale:[5.3,.04,TILE_LENGTH],color:[.03,.025,.02,1]}];for(const s of[-1,1]){for(let e=0;e<4;e++)r.push({geometry:recolor(t,weathered(e+5*s,.6)),position:[2.85*s,.1,-1.5-3*e],scale:[.42,.5,2.94],color:[1,1,1,1]});for(let a=0;a<6;a++)r.push({geometry:recolor(t,weathered(20+a+7*s+13*e,.55)),position:[3.78*s,.04*(o()-.5)-.12,-1-2*a],scale:[1.4,.26,1.94],color:[1,1,1,1]});for(let e=0;e<4;e++){if(o()<.25)continue;const a=.35+.2*o();r.push({geometry:recolor(t,weathered(30+e+3*s,.7)),position:[4.32*s,a/2,-1.5-3*e],scale:[.34,a,2.4+.4*o()],color:[1,1,1,1]})}for(let e=0;e<3;e++){const e=-1-o()*(TILE_LENGTH-2),t=2.5+3.5*o(),a=4.55*s;r.push({geometry:tube([[a-.3*s,.05,e],[a+.08*s,-.3,e+.1],[a+.12*s,.5*-t,e-.1],[a+.05*s,-t,e+.15]],{radius:e=>.06-.035*e,sides:4,smoothness:3,color:({v:e})=>rgba(mix(LEAF,LEAF_LIGHT,.6*e))})})}}return r.push({geometry:recolor(t,weathered(3,.3)),position:[0,-.48,-TILE_LENGTH/2],scale:[9.3,.36,TILE_LENGTH+.02],color:[.85,.82,.78,1]}),r.push({geometry:recolor(shapeGeometry("cube"),({position:[e,o,t]})=>rgba(mix(mix(STONE_DARK,[.3,.3,.27],.08*-o),MOSS,1.6*Math.max(0,noise(.8*e,.8*t+o)-.55)))),position:[0,-4.6,-TILE_LENGTH/2],scale:[8.6,8,TILE_LENGTH],color:[1,1,1,1]}),_0x455388(merge(r),{center:!1,shine:.15})}),slabMesh=e=>cached("pr-slab:"+e,()=>_0x455388(merge([{geometry:recolor(shapeGeometry("roundedBox"),weathered(90+3*e,.35)),position:[0,-.15,0],scale:[1.66,.3,SLAB-.08],color:[1,1,1,1]}]),{center:!1,shine:.15})),brokenEdgeMesh=()=>cached("pr-broken",()=>{const e=random(97),o=[];for(const t of[-1,1])for(let r=0;r<5;r++)o.push({geometry:recolor(shapeGeometry("roundedBox"),weathered(100+r,.3)),position:[.33*r-.66+.1*(e()-.5),-.12-.1*e(),t*(SLAB/2-.08-.12*e())],rotation:quat.y(6.3*e()),scale:[.22+.12*e(),.2,.18+.12*e()],color:[1,1,1,1]});return _0x455388(merge(o),{center:!1,shine:.1})}),finishMesh=()=>cached("pr-finish",()=>{const e=shapeGeometry("roundedBox"),o=recolor(shapeGeometry("cube"),({position:[e,,o]})=>rgba((Math.floor(12*(e+.5))+Math.floor(3*(o+.5)))%2?[.96,.96,.94]:[.08,.08,.1]));return _0x455388(merge([{geometry:o,position:[0,.015,0],scale:[5.3,.03,1.2],color:[1,1,1,1]},{geometry:e,position:[-3.78,.2,0],scale:[1.1,.4,1.1],color:rgba([.8,.6,.16])},{geometry:e,position:[3.78,.2,0],scale:[1.1,.4,1.1],color:rgba([.8,.6,.16])},{geometry:e,position:[-3.78,3.1,0],scale:[.6,6.2,.6],color:rgba(GOLD)},{geometry:e,position:[3.78,3.1,0],scale:[.6,6.2,.6],color:rgba(GOLD)},{geometry:e,position:[0,6.25,0],scale:[8.36,.5,.7],color:rgba(GOLD)},{geometry:e,position:[0,5.35,.1],scale:[5.6,1.1,.12],color:rgba([.85,.12,.14])},{geometry:e,position:[0,5.35,.17],scale:[4.6,.12,.04],color:rgba([1,.9,.5])},...[-2.6,-1.3,0,1.3,2.6].map((e,o)=>{return{geometry:tube([[t=e,6,.4],[t+.06,5.45,.41]],{radius:e=>.14*(1-e),shape:e=>.2+.8*Math.abs(Math.cos(e*Math.PI*2)),sides:6,color:rgba([[.2,.5,.95],[1,.8,.15],[.2,.75,.3]][o%3])})};var t})]),{center:!1,shine:.5})}),startMesh=()=>cached("pr-start",()=>_0x455388(merge([{geometry:shapeGeometry("cube"),position:[0,.015,0],scale:[5.3,.03,.5],color:rgba([.96,.96,.92])}]),{center:!1,shine:.3})),templeMesh=()=>cached("pr-temple",()=>{const e=shapeGeometry("roundedBox"),o=(o,t=.5)=>recolor(e,weathered(o,t)),t=[0,1,2,3].map(e=>({geometry:o(150+e,.6-.1*e),position:[0,2.6*e-2,0],scale:[22-4.5*e,2.6,10-1.8*e],color:[1,1,1,1]}));return _0x455388(merge([{geometry:o(160,.3),position:[0,-8,0],scale:[24,12,12],color:[.85,.82,.78,1]},...t,{geometry:o(161,.3),position:[0,10.2,0],scale:[6,3.2,4.4],color:[1,1,1,1]},{geometry:e,position:[0,9.6,2.22],scale:[2,2.4,.1],color:[.05,.04,.03,1]},{geometry:e,position:[0,12.1,0],scale:[6.6,.5,5],color:rgba(GOLD)}]),{center:!1,shine:.15})}),columnMesh=e=>cached("pr-column:"+e,()=>{const o=e?2.2:4.4,t=shapeGeometry("roundedBox"),r=lathe([[.001,o],[.36,o-(e?.25:0)],[.38,o-.3],[.4,.8],[.44,.55]],{segments:24,displace:(o,t)=>.018*Math.cos(o*Math.PI*2*12)+(e&&t<.15?.4*(noise(9*o,1)-.5):0),color:weathered(e?7:2,.45)}),s=[{geometry:recolor(t,weathered(1,.7)),position:[0,.28,0],scale:[1.2,.56,1.2],color:[1,1,1,1]},{geometry:r}];return e?s.push({geometry:recolor(shapeGeometry("cylinder"),weathered(8,.6)),position:[.55,.32,.5],rotation:quat.z(Math.PI/2),scale:[.72,.8,.72],color:[1,1,1,1]}):(s.push({geometry:recolor(t,weathered(4,.3)),position:[0,o+.12,0],scale:[1.1,.24,1.1],color:[1,1,1,1]}),s.push({geometry:recolor(shapeGeometry("cylinder"),weathered(5,.3)),position:[0,o-.1,0],scale:[.95,.22,.95],color:[1,1,1,1]})),_0x455388(merge(s),{center:!1,shine:.1})}),idolMesh=()=>cached("pr-idol",()=>{const e=shapeGeometry("roundedBox"),o=o=>recolor(e,weathered(o,.55)),t=[.12,.11,.1,1];return _0x455388(merge([{geometry:o(1),position:[0,.35,0],scale:[1.5,.7,1.3],color:[1,1,1,1]},{geometry:o(2),position:[0,1.5,0],scale:[1.2,1.6,1.05],color:[1,1,1,1]},{geometry:o(3),position:[0,2.05,.5],scale:[1.15,.22,.2],color:[1,1,1,1]},{geometry:e,position:[-.28,1.82,.52],scale:[.3,.18,.08],color:t},{geometry:e,position:[.28,1.82,.52],scale:[.3,.18,.08],color:t},{geometry:o(4),position:[0,1.5,.58],scale:[.26,.5,.2],color:[1,1,1,1]},{geometry:e,position:[0,1.05,.53],scale:[.62,.12,.08],color:t},{geometry:o(5),position:[-.64,1.55,0],scale:[.14,.6,.35],color:[1,1,1,1]},{geometry:o(6),position:[.64,1.55,0],scale:[.14,.6,.35],color:[1,1,1,1]}]),{center:!1,shine:.1})}),torchMesh=()=>cached("pr-torch",()=>_0x455388(merge([{geometry:tube([[0,0,0],[.03,.6,.02],[-.02,1.2,0],[0,1.55,0]],{radius:e=>.07-.025*e,sides:8,color:rgba([.35,.24,.12])})},{geometry:lathe([[.001,1.5],[.18,1.55],[.26,1.75],[.22,1.76],[.001,1.65]],{segments:14,color:rgba([.55,.38,.16])})},{geometry:shapeGeometry("cylinder"),position:[0,.05,0],scale:[.35,.1,.35],color:rgba([.3,.22,.12])}]),{center:!1,shine:.6})),leafClump=(e,o=LEAF_DARK,t=LEAF_LIGHT)=>{const r=Array.from({length:7},(e,o)=>{const t=Math.PI/2-o/6*Math.PI;return[Math.max(.001,.5*Math.cos(t)),.5*Math.sin(t)]});return lathe(r,{segments:10,displace:(o,t)=>.08*Math.sin(o*Math.PI*2*3+e)*Math.sin(t*Math.PI*3+.7*e)+.04*Math.sin(o*Math.PI*2*7+1.9*e)*Math.sin(t*Math.PI*6),color:({position:[r,s,a]})=>rgba(mix(o,t,.35+1.1*s+.5*(noise(5*r+e,5*a-e)-.5)))})},bead=()=>lathe([[.001,.5],[.35,.35],[.5,0],[.35,-.35],[.001,-.5]],{segments:6}),bark=e=>({u:o,v:t})=>rgba(mix(mix([.3,.21,.13],BARK,.4+.8*noise(14*o+e,3*t)),MOSS,1.6*Math.max(0,.35-t)*noise(6*o,9*t+e))),treeMesh=e=>cached("pr-tree:"+e,()=>{const o=random(70+e),t=.8*(o()-.5),r=13+2*o(),s=o=>[t*o*o,o*r,.3*Math.sin(3*o+e)],a=[{geometry:tube(Array.from({length:6},(e,o)=>s(o/5)),{radius:e=>.62*(1-.6*e)+4*Math.max(0,.12-e),sides:10,smoothness:4,color:bark(e)})}];for(let t=0;t<5;t++){const r=t/5*Math.PI*2+.5*o(),s=1.8+.8*o();a.push({geometry:tube([[0,2.4,0],[.8*Math.cos(r),.9,.8*Math.sin(r)],[Math.cos(r)*s,0,Math.sin(r)*s]],{radius:e=>.4-.3*e,sides:6,smoothness:3,color:bark(e+t)})})}const n=[s(1)],i=3+Math.floor(2*o());for(let t=0;t<i;t++){const r=.55+t/i*.35+.05*o(),h=s(r),l=t/i*Math.PI*2+o(),m=1.6+1*o(),p=[h[0]+Math.cos(l)*m,h[1]+1.4+1.6*o(),h[2]+Math.sin(l)*m];a.push({geometry:tube([h,[(h[0]+p[0])/2,h[1]+.9,(h[2]+p[2])/2],p],{radius:e=>.28*(1-.5*r)*(1-.6*e),sides:6,smoothness:3,color:bark(e+10+t)})}),n.push(p)}return n.forEach((t,r)=>{const s=0===r?4:3;for(let n=0;n<s;n++){const s=o()*Math.PI*2,i=0===n?0:.6+.5*o(),h=(0===r?3.6:2.8)+1.2*o();a.push({geometry:leafClump(10*e+3*r+n),position:[t[0]+Math.cos(s)*i,t[1]+.4+.6*o(),t[2]+Math.sin(s)*i],rotation:quat.y(6.3*o()),scale:[h,h*(.5+.15*o()),h],color:[1,1,1,1]})}if(r>0&&o()<.8){const e=4+4*o();a.push({geometry:tube([[t[0],t[1],t[2]],[t[0]+.15,t[1]-.5*e,t[2]-.1],[t[0]-.1,t[1]-e,t[2]+.12]],{radius:.045,sides:4,smoothness:3,color:rgba(mix(BARK,LEAF,.55))})})}}),_0x455388(merge(a),{center:!1,shine:.05})}),palmMesh=e=>cached("pr-palm:"+e,()=>{const o=random(170+e),t=(o()<.5?-1:1)*(.6+.6*o()),r=10+2*o(),s=e=>[t*e*e,e*r,0],a=s(1),n=[{geometry:tube(Array.from({length:6},(e,o)=>s(o/5)),{radius:e=>.32-.1*e+2*Math.max(0,.08-e),sides:8,smoothness:5,color:({v:e})=>rgba(mix([.42,.33,.22],[.6,.5,.34],.5+.5*Math.sin(90*e)))})}];for(let e=0;e<9;e++){const t=e/9*Math.PI*2+.3*o(),r=3.6+1.2*o(),s=[Math.cos(t),0,Math.sin(t)],i=(e,o)=>[a[0]+s[0]*r*e,a[1]+o,a[2]+s[2]*r*e];n.push({geometry:tube([i(0,0),i(.35,.7),i(.7,.2),i(1,-1.3-.6*o())],{radius:e=>.42*Math.max(.05,Math.sin(Math.PI*Math.min(1,1.15*e)))**.6,shape:e=>.08+.92*Math.abs(Math.cos(e*Math.PI*2))**3,sides:6,smoothness:5,color:({v:e})=>rgba(mix(PALM,[.62,.74,.3],.8*e))})})}for(let e=0;e<3;e++){const o=e/3*Math.PI*2;n.push({geometry:bead(),position:[a[0]+.28*Math.cos(o),a[1]-.25,a[2]+.28*Math.sin(o)],scale:.32,color:rgba([.4,.27,.12])})}return _0x455388(merge(n),{center:!1,shine:.1})}),bushMesh=e=>cached("pr-bush:"+e,()=>{const o=random(210+e),t=[];for(let r=0;r<5;r++){const s=r/5*Math.PI*2+o(),a=0===r?0:.35+.2*o(),n=.7+.35*o();t.push({geometry:leafClump(300+7*e+r),position:[Math.cos(s)*a,.32*n,Math.sin(s)*a],scale:[n,.75*n,n],color:[1,1,1,1]})}const r=e?[1,.45,.6]:[1,.82,.25];for(let e=0;e<7;e++){const e=o()*Math.PI*2,s=.2+.45*o();t.push({geometry:bead(),position:[Math.cos(e)*s,.45+.35*o(),Math.sin(e)*s],scale:.11,color:rgba(r)})}return _0x455388(merge(t),{center:!1,shine:.1})}),canopyMesh=e=>cached("pr-canopy:"+e,()=>{const o=random(250+e),t=[];for(let r=0;r<9;r++){const s=4+3.5*o(),a=o();t.push({geometry:leafClump(400+11*e+r,mix(LEAF_DARK,[.08,.2,.08],a),mix(LEAF,LEAF_LIGHT,a)),position:[12*(o()-.5),1.5*o(),12*(o()-.5)],scale:[s,.55*s,s],color:[1,1,1,1]})}return _0x455388(merge(t),{center:!1,shine:.03})}),archMesh=()=>cached("pr-arch",()=>{const e=shapeGeometry("roundedBox"),o=(e,o)=>({geometry:tube([[e,5.3,.45],[e+.05,5.3-.5*o,.5],[e-.04,5.3-o,.48]],{radius:.04,sides:5,color:rgba(LEAF)})});return _0x455388(merge([{geometry:recolor(e,weathered(15,.8)),position:[-3.78,.25,0],scale:[1.35,.5,1.35],color:[1,1,1,1]},{geometry:recolor(e,weathered(16,.8)),position:[3.78,.25,0],scale:[1.35,.5,1.35],color:[1,1,1,1]},{geometry:recolor(e,weathered(11,.6)),position:[-3.78,2.8,0],scale:[1.05,5,1.05],color:[1,1,1,1]},{geometry:recolor(e,weathered(12,.6)),position:[3.78,2.8,0],scale:[1.05,5,1.05],color:[1,1,1,1]},{geometry:recolor(e,weathered(13,.4)),position:[0,5.6,0],scale:[8.8,.9,1.3],color:[1,1,1,1]},{geometry:recolor(e,weathered(14,.2)),position:[0,6.25,0],scale:[9.2,.4,1.5],color:[1,1,1,1]},{geometry:e,position:[0,5.6,.66],scale:[1.2,.5,.06],color:rgba(GOLD)},o(-2.2,1.6),o(-1.1,.9),o(.9,1.3),o(2.4,2)]),{center:!1,shine:.15})}),wideGateMesh=()=>cached("pr-wide-gate",()=>{const e=shapeGeometry("roundedBox"),o=shapeGeometry("cone"),t=Array.from({length:17},(e,t)=>({geometry:recolor(o,weathered(120+t,.2)),position:[.3*t-2.4,.95,.04],rotation:quat.x(Math.PI),scale:[.13,.2+t%2*.06,.13],color:[1,1,1,1]})),r=[-2.1,-1.2,-.4,.7,1.5,2.3].map((e,o)=>({geometry:tube([[e,1.08,.32],[e+.03,.95-o%3*.04,.35],[e-.02,.84-o%2*.1,.33]],{radius:.022,sides:5,color:rgba(LEAF)})})),s=[-1.8,-.9,0,.9,1.8].map(e=>({geometry:shapeGeometry("cylinder"),position:[e,1.32,.31],rotation:quat.x(Math.PI/2),scale:[.22,.04,.22],color:rgba(GOLD)}));return _0x455388(merge([...[-2.85,2.85].flatMap((o,t)=>[{geometry:recolor(e,weathered(130+t,.75)),position:[o,.25,0],scale:[.7,.5,.8],color:[1,1,1,1]},{geometry:recolor(e,weathered(132+t,.5)),position:[o,1.25,0],scale:[.5,2.5,.6],color:[1,1,1,1]}]),{geometry:recolor(e,weathered(134,.35)),position:[0,1.38,0],scale:[6.3,.6,.62],color:[1,1,1,1]},{geometry:recolor(e,weathered(135,.25)),position:[0,1.06,0],scale:[5.4,.14,.5],color:[.9,.86,.8,1]},{geometry:recolor(e,weathered(136,.2)),position:[0,1.76,0],scale:[6.6,.18,.72],color:[1,1,1,1]},...s,...t,...r]),{center:!1,shine:.15})}),coinMesh=()=>cached("pr-coin",()=>_0x455388(merge([{geometry:shapeGeometry("cylinder"),rotation:quat.x(Math.PI/2),scale:[.5,.08,.5],color:rgba(GOLD)},{geometry:shapeGeometry("cylinder"),rotation:quat.x(Math.PI/2),scale:[.34,.1,.34],color:rgba([1,.86,.36])}]),{shine:1})),gemMesh=()=>cached("pr-gem",()=>_0x455388(lathe([[.001,.3],[.3,.14],[.34,.06],[.001,-.38]],{segments:8,color:[1,1,1,1]}),{shine:1}));export function prepareRunMeshes(){for(const e of warmAssets())e()}export function*warmAssets(){yield()=>pathMesh(0),yield()=>pathMesh(1),yield()=>columnMesh(!1),yield()=>columnMesh(!0),yield()=>idolMesh(),yield()=>torchMesh(),yield()=>treeMesh(0),yield()=>treeMesh(1),yield()=>treeMesh(2),yield()=>palmMesh(0),yield()=>palmMesh(1),yield()=>bushMesh(0),yield()=>bushMesh(1),yield()=>canopyMesh(0),yield()=>canopyMesh(1),yield()=>archMesh(),yield()=>slabMesh(0),yield()=>slabMesh(1),yield()=>slabMesh(2),yield()=>brokenEdgeMesh(),yield()=>finishMesh(),yield()=>startMesh(),yield()=>templeMesh(),yield()=>wideGateMesh(),yield()=>coinMesh(),yield()=>gemMesh()}const slabZ=e=>-(e+.5)*SLAB;export function generateTrack(e){const o=random(e),t=[],r=Math.floor((TRACK_LENGTH-FINISH_CLEAR)/SLAB);for(let e=Math.ceil(START_CLEAR/SLAB);e<=r;){const r=slabZ(e),s=e*SLAB/TRACK_LENGTH;if(o()<.4+.15*s){const e=o()<.5?"gap":"beam";for(let o=0;o<3;o++)t.push({kind:e,lane:o,z:r,wide:!0})}else{const e=[0,1,2].sort(()=>o()-.5),a=o()<.15+.5*s?2:1;for(let o=0;o<a;o++)t.push({kind:"gap",lane:e[o],z:r})}e+=Math.max(4,5-Math.floor(2*s))+Math.floor(o()*(4-Math.floor(2*s)))}const s=(e,o,r)=>t.some(t=>t.lane===e&&Math.abs(t.z-o)<("gap"===t.kind?SLAB/2:.5)+r),a=[];let n=Math.floor(3*o()),i=8+6*o();for(let e=6;e<TRACK_LENGTH-2;e+=1.6){const t=-e;if(e>=i&&(n=(n+1+Math.floor(2*o()))%3,i=e+6+8*o()),s(n,t,.9)){const e=[0,1,2].filter(e=>!s(e,t,1.6));if(!e.length)continue;n=e[Math.floor(o()*e.length)]}a.push({lane:n,z:t,gem:o()<.04})}return{seed:e,obstacles:t,pickups:a}}export function spawnTile(e,o,t,r){const s=night(t),a=-o*TILE_LENGTH,n=a-TILE_LENGTH,i=e=>e<=a&&e>n,h=random(31*r.seed+17*o),l=s?[.8,.85,1,1]:[1,1,1,1],m=[],p=(o,t,r=1,s=0,a=l,n={})=>{const i=e.spawn({mesh:o,position:t,scale:r,rotation:quat.y(s),color:a,pickable:!1,...n});return m.push(i),i};p(pathMesh(Math.abs(o)%2),[0,0,a]);const d=Math.round(TILE_LENGTH/SLAB);for(let e=0;e<d;e++){const t=slabZ(o*d+e);for(let e=0;e<3;e++){if(r.obstacles.some(o=>"gap"===o.kind&&o.lane===e&&Math.abs(o.z-t)<.01)){p(brokenEdgeMesh(),[LANE_X[e],0,t],1,0);continue}const o=.88+.2*h();p(slabMesh(Math.floor(3*h())),[LANE_X[e],.02*(h()-.5),t],1,.015*(h()-.5),[l[0]*o,l[1]*o,l[2]*o,1])}}for(const e of[-1,1]){const o=h(),t=a-2-8*h();o<.45?p(columnMesh(h()<.35),[3.78*e,-.02,t],.85+.15*h(),6.3*h()):o<.65&&p(idolMesh(),[3.78*e,-.02,t],.72,e<0?.9:-.9);for(let o=0;o<2;o++){const o=a-1-10*h();h()<.6&&Math.abs(o-t)>1.6&&p(bushMesh(Math.floor(2*h())),[e*(3.78+.35*(h()-.3)),-.02,o],.75+.35*h(),6.3*h())}const r=a-1-10*h();h()<.75&&(p(torchMesh(),[2.85*e,.35,r]),p("flame",[2.85*e,2.05,r],.55,0,[2.6,1.3,.45,1],{bob:{amplitude:[.02,.06,.02],speed:9+4*h(),phase:6*h()}}),p("puff",[2.85*e,2.3,r],.6,0,[1.4,.8,.4,.35],{bob:{amplitude:[.03,.12,.03],speed:3,phase:6*h()}}));for(let o=0;o<2;o++){const o=[e*(12+7*h()),-9,a-h()*TILE_LENGTH];h()<.35?p(palmMesh(Math.floor(2*h())),o,.9+.3*h(),6.3*h()):p(treeMesh(Math.floor(3*h())),o,.85+.35*h(),6.3*h())}p(canopyMesh(Math.floor(2*h())),[e*(10+6*h()),-8,a-6],1+.4*h(),6.3*h(),l)}o>0&&o%5==0&&p(archMesh(),[0,0,a-6]),h()<.5&&p("puff",[16*(h()-.5),-3,a-12*h()],6+4*h(),0,s?[.4,.45,.6,.25]:[1.1,1.15,1.1,.35]),i(-TRACK_LENGTH)&&p(finishMesh(),[0,0,-TRACK_LENGTH]),i(0)&&p(startMesh(),[0,0,-.3]),o===-TILES_BEFORE_START&&p(templeMesh(),[0,0,a+4]),o===LAST_TILE&&p(templeMesh(),[0,0,n-4]);const g=r.obstacles.filter(e=>i(e.z)).map(e=>"gap"===e.kind||1!==e.lane?{...e,e:null}:{...e,e:p(wideGateMesh(),[0,0,e.z],1,0)}),M=r.pickups.filter(e=>i(e.z)).map(o=>spawnPickup(e,m,o.lane,o.gem?1:.9,o.z,o.gem));return{index:o,z:a,entities:m,obstacles:g,pickups:M}}function spawnPickup(e,o,t,r,s,a){const n=e.spawn({mesh:a?gemMesh():coinMesh(),position:[LANE_X[t],r,s],scale:a?.9:.85,color:a?[.35,.8,1.6,1]:[1.25,1.1,.75,1],spin:[0,a?1.8:3.2,0],bob:{amplitude:[0,.1,0],speed:3,phase:s},pickable:!1});return o.push(n),{gem:a,lane:t,y:r,z:s,e:n,taken:!1}}export function despawnTile(e,o){for(const t of o.entities)e.despawn(t)}export function coinSparkle(e,o,t){e.burst({position:o,count:t?16:7,mesh:"flame",size:t?.22:.14,speed:t?3:2,lifetime:.35,gravity:0,color:t?[.5,1.2,2.4,1]:[2.4,1.9,.7,1],endSize:0})}export function crashDust(e,o){e.burst({position:o,count:14,mesh:"sphere",size:.1,speed:4,lifetime:.6,gravity:-9,color:[rgba(STONE),rgba(STONE_DARK)],endSize:.05}),effects.dust(e,{position:o,count:6,size:.6,speed:1.2,lifetime:.9,color:[.8,.75,.65,.7],endSize:2.2})}
|
|
1
|
+
"use strict";import{effects,lathe,merge,quat,recolor,shapeGeometry,tube}from"@nayan-ui/engine";import{noise,random}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x518b20}from"../shared/EngineMeshes.js";import{FINISH_CLEAR,LANE_X,SLAB,START_CLEAR,TILE_LENGTH,TILES_BEFORE_START,TILES_PAST_FINISH,TRACK_LENGTH}from"./PenguinRunConstants.js";export const LAST_TILE=Math.ceil(TRACK_LENGTH/TILE_LENGTH)+TILES_PAST_FINISH-1;const night=e=>"dark"===e.mode,DAY_LIGHT={direction:[.4,.9,.5],ambient:.72,color:[1.3,1.24,1.12],shadows:!0,shadowExtent:16},NIGHT_LIGHT={direction:[-.3,.85,.5],ambient:.66,color:[.95,1,1.25],shadows:!0,shadowExtent:16};export const lightFor=e=>night(e)?NIGHT_LIGHT:DAY_LIGHT;export const backgroundFor=e=>night(e)?[.16,.2,.32]:[.78,.88,.92];export const FOG=.02;const CANOPY_Y=-8,TREE_SPREAD=7.5,rgba=(e,o=1)=>[e[0],e[1],e[2],o],mix=(e,o,t)=>{const r=Math.min(1,Math.max(0,t));return[e[0]+(o[0]-e[0])*r,e[1]+(o[1]-e[1])*r,e[2]+(o[2]-e[2])*r]},STONE=[.82,.77,.66],STONE_DARK=[.56,.52,.45],MOSS=[.42,.56,.26],BARK=[.48,.34,.2],LEAF=[.26,.52,.18],LEAF_LIGHT=[.5,.72,.28],GOLD=[1,.76,.2],LEAF_DARK=[.12,.3,.1],PALM=[.34,.6,.2],WALK_X=3.78,WALK_WIDTH=1.44,WALK_OUTER=4.5,meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("penguin-run/PenguinRunScene:"+e,o),meshes.set(e,t)),t},weathered=(e,o=.5)=>({position:[t,r,s]})=>{const a=noise(3.1*t+e,3.1*s+2.3*r);let n=mix(STONE_DARK,STONE,.35+.8*a);return n=mix(n,MOSS,2.2*Math.max(0,noise(1.3*t+2*e,1.3*s+r)-(1-o))),rgba(n)},pathMesh=e=>cached("pr-path:"+e,()=>{const o=random(40+e),t=shapeGeometry("roundedBox"),r=[{geometry:shapeGeometry("cube"),position:[0,-.31,-TILE_LENGTH/2],scale:[5.3,.04,TILE_LENGTH],color:[.03,.025,.02,1]}];for(const s of[-1,1]){for(let e=0;e<4;e++)r.push({geometry:recolor(t,weathered(e+5*s,.6)),position:[2.85*s,.1,-1.5-3*e],scale:[.42,.5,2.94],color:[1,1,1,1]});for(let a=0;a<6;a++)r.push({geometry:recolor(t,weathered(20+a+7*s+13*e,.55)),position:[3.78*s,.04*(o()-.5)-.12,-1-2*a],scale:[1.4,.26,1.94],color:[1,1,1,1]});for(let e=0;e<4;e++){if(o()<.25)continue;const a=.35+.2*o();r.push({geometry:recolor(t,weathered(30+e+3*s,.7)),position:[4.32*s,a/2,-1.5-3*e],scale:[.34,a,2.4+.4*o()],color:[1,1,1,1]})}for(let e=0;e<3;e++){const e=-1-o()*(TILE_LENGTH-2),t=2.5+3.5*o(),a=4.55*s;r.push({geometry:tube([[a-.3*s,.05,e],[a+.08*s,-.3,e+.1],[a+.12*s,.5*-t,e-.1],[a+.05*s,-t,e+.15]],{radius:e=>.06-.035*e,sides:4,smoothness:3,color:({v:e})=>rgba(mix(LEAF,LEAF_LIGHT,.6*e))})})}}return r.push({geometry:recolor(t,weathered(3,.3)),position:[0,-.48,-TILE_LENGTH/2],scale:[9.3,.36,TILE_LENGTH+.02],color:[.85,.82,.78,1]}),r.push({geometry:recolor(shapeGeometry("cube"),({position:[e,o,t]})=>rgba(mix(mix(STONE_DARK,[.3,.3,.27],.08*-o),MOSS,1.6*Math.max(0,noise(.8*e,.8*t+o)-.55)))),position:[0,-4.6,-TILE_LENGTH/2],scale:[8.6,8,TILE_LENGTH],color:[1,1,1,1]}),_0x518b20(merge(r),{center:!1,shine:.15})}),slabMesh=e=>cached("pr-slab:"+e,()=>_0x518b20(merge([{geometry:recolor(shapeGeometry("roundedBox"),weathered(90+3*e,.35)),position:[0,-.15,0],scale:[1.66,.3,SLAB-.08],color:[1,1,1,1]}]),{center:!1,shine:.15})),brokenEdgeMesh=()=>cached("pr-broken",()=>{const e=random(97),o=[];for(const t of[-1,1])for(let r=0;r<5;r++)o.push({geometry:recolor(shapeGeometry("roundedBox"),weathered(100+r,.3)),position:[.33*r-.66+.1*(e()-.5),-.12-.1*e(),t*(SLAB/2-.08-.12*e())],rotation:quat.y(6.3*e()),scale:[.22+.12*e(),.2,.18+.12*e()],color:[1,1,1,1]});return _0x518b20(merge(o),{center:!1,shine:.1})}),finishMesh=()=>cached("pr-finish",()=>{const e=shapeGeometry("roundedBox"),o=recolor(shapeGeometry("cube"),({position:[e,,o]})=>rgba((Math.floor(12*(e+.5))+Math.floor(3*(o+.5)))%2?[.96,.96,.94]:[.08,.08,.1]));return _0x518b20(merge([{geometry:o,position:[0,.015,0],scale:[5.3,.03,1.2],color:[1,1,1,1]},{geometry:e,position:[-3.78,.2,0],scale:[1.1,.4,1.1],color:rgba([.8,.6,.16])},{geometry:e,position:[3.78,.2,0],scale:[1.1,.4,1.1],color:rgba([.8,.6,.16])},{geometry:e,position:[-3.78,3.1,0],scale:[.6,6.2,.6],color:rgba(GOLD)},{geometry:e,position:[3.78,3.1,0],scale:[.6,6.2,.6],color:rgba(GOLD)},{geometry:e,position:[0,6.25,0],scale:[8.36,.5,.7],color:rgba(GOLD)},{geometry:e,position:[0,5.35,.1],scale:[5.6,1.1,.12],color:rgba([.85,.12,.14])},{geometry:e,position:[0,5.35,.17],scale:[4.6,.12,.04],color:rgba([1,.9,.5])},...[-2.6,-1.3,0,1.3,2.6].map((e,o)=>{return{geometry:tube([[t=e,6,.4],[t+.06,5.45,.41]],{radius:e=>.14*(1-e),shape:e=>.2+.8*Math.abs(Math.cos(e*Math.PI*2)),sides:6,color:rgba([[.2,.5,.95],[1,.8,.15],[.2,.75,.3]][o%3])})};var t})]),{center:!1,shine:.5})}),startMesh=()=>cached("pr-start",()=>_0x518b20(merge([{geometry:shapeGeometry("cube"),position:[0,.015,0],scale:[5.3,.03,.5],color:rgba([.96,.96,.92])}]),{center:!1,shine:.3})),templeMesh=()=>cached("pr-temple",()=>{const e=shapeGeometry("roundedBox"),o=(o,t=.5)=>recolor(e,weathered(o,t)),t=[0,1,2,3].map(e=>({geometry:o(150+e,.6-.1*e),position:[0,2.6*e-2,0],scale:[22-4.5*e,2.6,10-1.8*e],color:[1,1,1,1]}));return _0x518b20(merge([{geometry:o(160,.3),position:[0,-8,0],scale:[24,12,12],color:[.85,.82,.78,1]},...t,{geometry:o(161,.3),position:[0,10.2,0],scale:[6,3.2,4.4],color:[1,1,1,1]},{geometry:e,position:[0,9.6,2.22],scale:[2,2.4,.1],color:[.05,.04,.03,1]},{geometry:e,position:[0,12.1,0],scale:[6.6,.5,5],color:rgba(GOLD)}]),{center:!1,shine:.15})}),columnMesh=e=>cached("pr-column:"+e,()=>{const o=e?2.2:4.4,t=shapeGeometry("roundedBox"),r=lathe([[.001,o],[.36,o-(e?.25:0)],[.38,o-.3],[.4,.8],[.44,.55]],{segments:24,displace:(o,t)=>.018*Math.cos(o*Math.PI*2*12)+(e&&t<.15?.4*(noise(9*o,1)-.5):0),color:weathered(e?7:2,.45)}),s=[{geometry:recolor(t,weathered(1,.7)),position:[0,.28,0],scale:[1.2,.56,1.2],color:[1,1,1,1]},{geometry:r}];return e?s.push({geometry:recolor(shapeGeometry("cylinder"),weathered(8,.6)),position:[.55,.32,.5],rotation:quat.z(Math.PI/2),scale:[.72,.8,.72],color:[1,1,1,1]}):(s.push({geometry:recolor(t,weathered(4,.3)),position:[0,o+.12,0],scale:[1.1,.24,1.1],color:[1,1,1,1]}),s.push({geometry:recolor(shapeGeometry("cylinder"),weathered(5,.3)),position:[0,o-.1,0],scale:[.95,.22,.95],color:[1,1,1,1]})),_0x518b20(merge(s),{center:!1,shine:.1})}),idolMesh=()=>cached("pr-idol",()=>{const e=shapeGeometry("roundedBox"),o=o=>recolor(e,weathered(o,.55)),t=[.12,.11,.1,1];return _0x518b20(merge([{geometry:o(1),position:[0,.35,0],scale:[1.5,.7,1.3],color:[1,1,1,1]},{geometry:o(2),position:[0,1.5,0],scale:[1.2,1.6,1.05],color:[1,1,1,1]},{geometry:o(3),position:[0,2.05,.5],scale:[1.15,.22,.2],color:[1,1,1,1]},{geometry:e,position:[-.28,1.82,.52],scale:[.3,.18,.08],color:t},{geometry:e,position:[.28,1.82,.52],scale:[.3,.18,.08],color:t},{geometry:o(4),position:[0,1.5,.58],scale:[.26,.5,.2],color:[1,1,1,1]},{geometry:e,position:[0,1.05,.53],scale:[.62,.12,.08],color:t},{geometry:o(5),position:[-.64,1.55,0],scale:[.14,.6,.35],color:[1,1,1,1]},{geometry:o(6),position:[.64,1.55,0],scale:[.14,.6,.35],color:[1,1,1,1]}]),{center:!1,shine:.1})}),torchMesh=()=>cached("pr-torch",()=>_0x518b20(merge([{geometry:tube([[0,0,0],[.03,.6,.02],[-.02,1.2,0],[0,1.55,0]],{radius:e=>.07-.025*e,sides:8,color:rgba([.35,.24,.12])})},{geometry:lathe([[.001,1.5],[.18,1.55],[.26,1.75],[.22,1.76],[.001,1.65]],{segments:14,color:rgba([.55,.38,.16])})},{geometry:shapeGeometry("cylinder"),position:[0,.05,0],scale:[.35,.1,.35],color:rgba([.3,.22,.12])}]),{center:!1,shine:.6})),leafClump=(e,o=LEAF_DARK,t=LEAF_LIGHT)=>{const r=Array.from({length:7},(e,o)=>{const t=Math.PI/2-o/6*Math.PI;return[Math.max(.001,.5*Math.cos(t)),.5*Math.sin(t)]});return lathe(r,{segments:10,displace:(o,t)=>.08*Math.sin(o*Math.PI*2*3+e)*Math.sin(t*Math.PI*3+.7*e)+.04*Math.sin(o*Math.PI*2*7+1.9*e)*Math.sin(t*Math.PI*6),color:({position:[r,s,a]})=>rgba(mix(o,t,.35+1.1*s+.5*(noise(5*r+e,5*a-e)-.5)))})},bead=()=>lathe([[.001,.5],[.35,.35],[.5,0],[.35,-.35],[.001,-.5]],{segments:6}),bark=e=>({u:o,v:t})=>rgba(mix(mix([.3,.21,.13],BARK,.4+.8*noise(14*o+e,3*t)),MOSS,1.6*Math.max(0,.35-t)*noise(6*o,9*t+e))),treeMesh=e=>cached("pr-tree:"+e,()=>{const o=random(70+e),t=.8*(o()-.5),r=13+2*o(),s=o=>[t*o*o,o*r,.3*Math.sin(3*o+e)],a=[{geometry:tube(Array.from({length:6},(e,o)=>s(o/5)),{radius:e=>.62*(1-.6*e)+4*Math.max(0,.12-e),sides:10,smoothness:4,color:bark(e)})}];for(let t=0;t<5;t++){const r=t/5*Math.PI*2+.5*o(),s=1.8+.8*o();a.push({geometry:tube([[0,2.4,0],[.8*Math.cos(r),.9,.8*Math.sin(r)],[Math.cos(r)*s,0,Math.sin(r)*s]],{radius:e=>.4-.3*e,sides:6,smoothness:3,color:bark(e+t)})})}const n=[s(1)],i=3+Math.floor(2*o());for(let t=0;t<i;t++){const r=.55+t/i*.35+.05*o(),h=s(r),l=t/i*Math.PI*2+o(),m=1.6+1*o(),p=[h[0]+Math.cos(l)*m,h[1]+1.4+1.6*o(),h[2]+Math.sin(l)*m];a.push({geometry:tube([h,[(h[0]+p[0])/2,h[1]+.9,(h[2]+p[2])/2],p],{radius:e=>.28*(1-.5*r)*(1-.6*e),sides:6,smoothness:3,color:bark(e+10+t)})}),n.push(p)}return n.forEach((t,r)=>{const s=0===r?4:3;for(let n=0;n<s;n++){const s=o()*Math.PI*2,i=0===n?0:.6+.5*o(),h=(0===r?3.6:2.8)+1.2*o();a.push({geometry:leafClump(10*e+3*r+n),position:[t[0]+Math.cos(s)*i,t[1]+.4+.6*o(),t[2]+Math.sin(s)*i],rotation:quat.y(6.3*o()),scale:[h,h*(.5+.15*o()),h],color:[1,1,1,1]})}if(r>0&&o()<.8){const e=4+4*o();a.push({geometry:tube([[t[0],t[1],t[2]],[t[0]+.15,t[1]-.5*e,t[2]-.1],[t[0]-.1,t[1]-e,t[2]+.12]],{radius:.045,sides:4,smoothness:3,color:rgba(mix(BARK,LEAF,.55))})})}}),_0x518b20(merge(a),{center:!1,shine:.05})}),palmMesh=e=>cached("pr-palm:"+e,()=>{const o=random(170+e),t=(o()<.5?-1:1)*(.6+.6*o()),r=10+2*o(),s=e=>[t*e*e,e*r,0],a=s(1),n=[{geometry:tube(Array.from({length:6},(e,o)=>s(o/5)),{radius:e=>.32-.1*e+2*Math.max(0,.08-e),sides:8,smoothness:5,color:({v:e})=>rgba(mix([.42,.33,.22],[.6,.5,.34],.5+.5*Math.sin(90*e)))})}];for(let e=0;e<9;e++){const t=e/9*Math.PI*2+.3*o(),r=3.6+1.2*o(),s=[Math.cos(t),0,Math.sin(t)],i=(e,o)=>[a[0]+s[0]*r*e,a[1]+o,a[2]+s[2]*r*e];n.push({geometry:tube([i(0,0),i(.35,.7),i(.7,.2),i(1,-1.3-.6*o())],{radius:e=>.42*Math.max(.05,Math.sin(Math.PI*Math.min(1,1.15*e)))**.6,shape:e=>.08+.92*Math.abs(Math.cos(e*Math.PI*2))**3,sides:6,smoothness:5,color:({v:e})=>rgba(mix(PALM,[.62,.74,.3],.8*e))})})}for(let e=0;e<3;e++){const o=e/3*Math.PI*2;n.push({geometry:bead(),position:[a[0]+.28*Math.cos(o),a[1]-.25,a[2]+.28*Math.sin(o)],scale:.32,color:rgba([.4,.27,.12])})}return _0x518b20(merge(n),{center:!1,shine:.1})}),bushMesh=e=>cached("pr-bush:"+e,()=>{const o=random(210+e),t=[];for(let r=0;r<5;r++){const s=r/5*Math.PI*2+o(),a=0===r?0:.35+.2*o(),n=.7+.35*o();t.push({geometry:leafClump(300+7*e+r),position:[Math.cos(s)*a,.32*n,Math.sin(s)*a],scale:[n,.75*n,n],color:[1,1,1,1]})}const r=e?[1,.45,.6]:[1,.82,.25];for(let e=0;e<7;e++){const e=o()*Math.PI*2,s=.2+.45*o();t.push({geometry:bead(),position:[Math.cos(e)*s,.45+.35*o(),Math.sin(e)*s],scale:.11,color:rgba(r)})}return _0x518b20(merge(t),{center:!1,shine:.1})}),canopyMesh=e=>cached("pr-canopy:"+e,()=>{const o=random(250+e),t=[];for(let r=0;r<9;r++){const s=4+3.5*o(),a=o();t.push({geometry:leafClump(400+11*e+r,mix(LEAF_DARK,[.08,.2,.08],a),mix(LEAF,LEAF_LIGHT,a)),position:[12*(o()-.5),1.5*o(),12*(o()-.5)],scale:[s,.55*s,s],color:[1,1,1,1]})}return _0x518b20(merge(t),{center:!1,shine:.03})}),archMesh=()=>cached("pr-arch",()=>{const e=shapeGeometry("roundedBox"),o=(e,o)=>({geometry:tube([[e,5.3,.45],[e+.05,5.3-.5*o,.5],[e-.04,5.3-o,.48]],{radius:.04,sides:5,color:rgba(LEAF)})});return _0x518b20(merge([{geometry:recolor(e,weathered(15,.8)),position:[-3.78,.25,0],scale:[1.35,.5,1.35],color:[1,1,1,1]},{geometry:recolor(e,weathered(16,.8)),position:[3.78,.25,0],scale:[1.35,.5,1.35],color:[1,1,1,1]},{geometry:recolor(e,weathered(11,.6)),position:[-3.78,2.8,0],scale:[1.05,5,1.05],color:[1,1,1,1]},{geometry:recolor(e,weathered(12,.6)),position:[3.78,2.8,0],scale:[1.05,5,1.05],color:[1,1,1,1]},{geometry:recolor(e,weathered(13,.4)),position:[0,5.6,0],scale:[8.8,.9,1.3],color:[1,1,1,1]},{geometry:recolor(e,weathered(14,.2)),position:[0,6.25,0],scale:[9.2,.4,1.5],color:[1,1,1,1]},{geometry:e,position:[0,5.6,.66],scale:[1.2,.5,.06],color:rgba(GOLD)},o(-2.2,1.6),o(-1.1,.9),o(.9,1.3),o(2.4,2)]),{center:!1,shine:.15})}),wideGateMesh=()=>cached("pr-wide-gate",()=>{const e=shapeGeometry("roundedBox"),o=shapeGeometry("cone"),t=Array.from({length:17},(e,t)=>({geometry:recolor(o,weathered(120+t,.2)),position:[.3*t-2.4,.95,.04],rotation:quat.x(Math.PI),scale:[.13,.2+t%2*.06,.13],color:[1,1,1,1]})),r=[-2.1,-1.2,-.4,.7,1.5,2.3].map((e,o)=>({geometry:tube([[e,1.08,.32],[e+.03,.95-o%3*.04,.35],[e-.02,.84-o%2*.1,.33]],{radius:.022,sides:5,color:rgba(LEAF)})})),s=[-1.8,-.9,0,.9,1.8].map(e=>({geometry:shapeGeometry("cylinder"),position:[e,1.32,.31],rotation:quat.x(Math.PI/2),scale:[.22,.04,.22],color:rgba(GOLD)}));return _0x518b20(merge([...[-2.85,2.85].flatMap((o,t)=>[{geometry:recolor(e,weathered(130+t,.75)),position:[o,.25,0],scale:[.7,.5,.8],color:[1,1,1,1]},{geometry:recolor(e,weathered(132+t,.5)),position:[o,1.25,0],scale:[.5,2.5,.6],color:[1,1,1,1]}]),{geometry:recolor(e,weathered(134,.35)),position:[0,1.38,0],scale:[6.3,.6,.62],color:[1,1,1,1]},{geometry:recolor(e,weathered(135,.25)),position:[0,1.06,0],scale:[5.4,.14,.5],color:[.9,.86,.8,1]},{geometry:recolor(e,weathered(136,.2)),position:[0,1.76,0],scale:[6.6,.18,.72],color:[1,1,1,1]},...s,...t,...r]),{center:!1,shine:.15})}),coinMesh=()=>cached("pr-coin",()=>_0x518b20(merge([{geometry:shapeGeometry("cylinder"),rotation:quat.x(Math.PI/2),scale:[.5,.08,.5],color:rgba(GOLD)},{geometry:shapeGeometry("cylinder"),rotation:quat.x(Math.PI/2),scale:[.34,.1,.34],color:rgba([1,.86,.36])}]),{shine:1})),gemMesh=()=>cached("pr-gem",()=>_0x518b20(lathe([[.001,.3],[.3,.14],[.34,.06],[.001,-.38]],{segments:8,color:[1,1,1,1]}),{shine:1}));export function prepareRunMeshes(){for(const e of warmAssets())e()}export function*warmAssets(){yield()=>pathMesh(0),yield()=>pathMesh(1),yield()=>columnMesh(!1),yield()=>columnMesh(!0),yield()=>idolMesh(),yield()=>torchMesh(),yield()=>treeMesh(0),yield()=>treeMesh(1),yield()=>treeMesh(2),yield()=>palmMesh(0),yield()=>palmMesh(1),yield()=>bushMesh(0),yield()=>bushMesh(1),yield()=>canopyMesh(0),yield()=>canopyMesh(1),yield()=>archMesh(),yield()=>slabMesh(0),yield()=>slabMesh(1),yield()=>slabMesh(2),yield()=>brokenEdgeMesh(),yield()=>finishMesh(),yield()=>startMesh(),yield()=>templeMesh(),yield()=>wideGateMesh(),yield()=>coinMesh(),yield()=>gemMesh()}const slabZ=e=>-(e+.5)*SLAB;export function generateTrack(e){const o=random(e),t=[],r=Math.floor((TRACK_LENGTH-FINISH_CLEAR)/SLAB);for(let e=Math.ceil(START_CLEAR/SLAB);e<=r;){const r=slabZ(e),s=e*SLAB/TRACK_LENGTH;if(o()<.4+.15*s){const e=o()<.5?"gap":"beam";for(let o=0;o<3;o++)t.push({kind:e,lane:o,z:r,wide:!0})}else{const e=[0,1,2].sort(()=>o()-.5),a=o()<.15+.5*s?2:1;for(let o=0;o<a;o++)t.push({kind:"gap",lane:e[o],z:r})}e+=Math.max(4,5-Math.floor(2*s))+Math.floor(o()*(4-Math.floor(2*s)))}const s=(e,o,r)=>t.some(t=>t.lane===e&&Math.abs(t.z-o)<("gap"===t.kind?SLAB/2:.5)+r),a=[];let n=Math.floor(3*o()),i=8+6*o();for(let e=6;e<TRACK_LENGTH-2;e+=1.6){const t=-e;if(e>=i&&(n=(n+1+Math.floor(2*o()))%3,i=e+6+8*o()),s(n,t,.9)){const e=[0,1,2].filter(e=>!s(e,t,1.6));if(!e.length)continue;n=e[Math.floor(o()*e.length)]}a.push({lane:n,z:t,gem:o()<.04})}return{seed:e,obstacles:t,pickups:a}}export function spawnTile(e,o,t,r){const s=night(t),a=-o*TILE_LENGTH,n=a-TILE_LENGTH,i=e=>e<=a&&e>n,h=random(31*r.seed+17*o),l=s?[.8,.85,1,1]:[1,1,1,1],m=[],p=(o,t,r=1,s=0,a=l,n={})=>{const i=e.spawn({mesh:o,position:t,scale:r,rotation:quat.y(s),color:a,pickable:!1,...n});return m.push(i),i};p(pathMesh(Math.abs(o)%2),[0,0,a]);const d=Math.round(TILE_LENGTH/SLAB);for(let e=0;e<d;e++){const t=slabZ(o*d+e);for(let e=0;e<3;e++){if(r.obstacles.some(o=>"gap"===o.kind&&o.lane===e&&Math.abs(o.z-t)<.01)){p(brokenEdgeMesh(),[LANE_X[e],0,t],1,0);continue}const o=.88+.2*h();p(slabMesh(Math.floor(3*h())),[LANE_X[e],.02*(h()-.5),t],1,.015*(h()-.5),[l[0]*o,l[1]*o,l[2]*o,1])}}for(const e of[-1,1]){const o=h(),t=a-2-8*h();o<.45?p(columnMesh(h()<.35),[3.78*e,-.02,t],.85+.15*h(),6.3*h()):o<.65&&p(idolMesh(),[3.78*e,-.02,t],.72,e<0?.9:-.9);for(let o=0;o<2;o++){const o=a-1-10*h();h()<.6&&Math.abs(o-t)>1.6&&p(bushMesh(Math.floor(2*h())),[e*(3.78+.35*(h()-.3)),-.02,o],.75+.35*h(),6.3*h())}const r=a-1-10*h();h()<.75&&(p(torchMesh(),[2.85*e,.35,r]),p("flame",[2.85*e,2.05,r],.55,0,[2.6,1.3,.45,1],{bob:{amplitude:[.02,.06,.02],speed:9+4*h(),phase:6*h()}}),p("puff",[2.85*e,2.3,r],.6,0,[1.4,.8,.4,.35],{bob:{amplitude:[.03,.12,.03],speed:3,phase:6*h()}}));for(let o=0;o<2;o++){const o=[e*(12+7*h()),-9,a-h()*TILE_LENGTH];h()<.35?p(palmMesh(Math.floor(2*h())),o,.9+.3*h(),6.3*h()):p(treeMesh(Math.floor(3*h())),o,.85+.35*h(),6.3*h())}p(canopyMesh(Math.floor(2*h())),[e*(10+6*h()),-8,a-6],1+.4*h(),6.3*h(),l)}o>0&&o%5==0&&p(archMesh(),[0,0,a-6]),h()<.5&&p("puff",[16*(h()-.5),-3,a-12*h()],6+4*h(),0,s?[.4,.45,.6,.25]:[1.1,1.15,1.1,.35]),i(-TRACK_LENGTH)&&p(finishMesh(),[0,0,-TRACK_LENGTH]),i(0)&&p(startMesh(),[0,0,-.3]),o===-TILES_BEFORE_START&&p(templeMesh(),[0,0,a+4]),o===LAST_TILE&&p(templeMesh(),[0,0,n-4]);const g=r.obstacles.filter(e=>i(e.z)).map(e=>"gap"===e.kind||1!==e.lane?{...e,e:null}:{...e,e:p(wideGateMesh(),[0,0,e.z],1,0)}),M=r.pickups.filter(e=>i(e.z)).map(o=>spawnPickup(e,m,o.lane,o.gem?1:.9,o.z,o.gem));return{index:o,z:a,entities:m,obstacles:g,pickups:M}}function spawnPickup(e,o,t,r,s,a){const n=e.spawn({mesh:a?gemMesh():coinMesh(),position:[LANE_X[t],r,s],scale:a?.9:.85,color:a?[.35,.8,1.6,1]:[1.25,1.1,.75,1],spin:[0,a?1.8:3.2,0],bob:{amplitude:[0,.1,0],speed:3,phase:s},pickable:!1});return o.push(n),{gem:a,lane:t,y:r,z:s,e:n,taken:!1}}export function despawnTile(e,o){for(const t of o.entities)e.despawn(t)}export function coinSparkle(e,o,t){e.burst({position:o,count:t?16:7,mesh:"flame",size:t?.22:.14,speed:t?3:2,lifetime:.35,gravity:0,color:t?[.5,1.2,2.4,1]:[2.4,1.9,.7,1],endSize:0})}export function crashDust(e,o){e.burst({position:o,count:14,mesh:"sphere",size:.1,speed:4,lifetime:.6,gravity:-9,color:[rgba(STONE),rgba(STONE_DARK)],endSize:.05}),effects.dust(e,{position:o,count:6,size:.6,speed:1.2,lifetime:.9,color:[.8,.75,.65,.7],endSize:2.2})}
|
|
@@ -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{toRgb}from"../shared/EngineUtils.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{COLORS,getLayout,LIGHT}from"./PerfectCircleConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./PerfectCircleGame.js";import{levelOf}from"./PerfectCircleRules.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{toRgb}from"../shared/EngineUtils.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{COLORS,getLayout,LIGHT}from"./PerfectCircleConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./PerfectCircleGame.js";import{levelOf}from"./PerfectCircleRules.js";import{jsx as _0x41819b}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.PERFECT_CIRCLE;export const PerfectCircle=engineGame(GAME_IDS.PERFECT_CIRCLE,e=>{const[r,t]=useLiveState(0),{theme:s,status:i,screen:a,gameOver:o}=useEngineGame(e,{gameId:GAME_IDS.PERFECT_CIRCLE,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,r,t,s)=>{const i=getLayout(r,t,s);return setLayout(e,i),2*i.radius},drag:drag,reportScore:e=>Math.round(100*e.accuracy),sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onOver:(e,r)=>e("win"===r?SOUNDS.SUCCESS:SOUNDS.FAIL,"win"===r?HapticType.SUCCESS:HapticType.ERROR),wire:(e,r)=>{e.onAccuracy=t,e.onEvent=e=>{"begin"===e?r(null,HapticType.LIGHT):"end"===e&&r(SOUNDS.DRAW_END,HapticType.MEDIUM)}}}),n=useMemo(()=>toRgb(s.BACKGROUND),[s.BACKGROUND]),m=levelOf(r);return _0x41819b(EngineGameScreen,{...a,light:LIGHT,background:n,columns:[{label:"ACCURACY",value:String(r),valueColor:r>0&&"light"!==s.mode?COLORS.UI:void 0}],subtext:"Draw perfect circle!",gameOver:o({title:"win"===i?m.label.toUpperCase():"NOT QUITE!",message:"win"===i?r+"% accuracy - Amazing circle!":r+"% accuracy - Need >70% to win",scoreLabel:"Final Score",score:r,buttonText:"Try Again"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,quat,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,quat,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x23dc80}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{COLORS,FIT_TRACE_TIME,STROKE_RADIUS,TINT_TIME}from"./PerfectCircleConstants.js";const meshes=new Map,cached=(o,e)=>{let t=meshes.get(o);return!t&&(t=cacheGameAsset("perfect-circle/PerfectCircleScene:"+o,e),meshes.set(o,t)),t},STAND_UP=quat.x(Math.PI/2),BACKDROP_DEPTH=30,PLATE_DEPTH=6,STROKE_Z=4,FIT_SEGMENTS=72,ringMesh=o=>cached("pc-ring:"+o.toFixed(4),()=>{const e=Array.from({length:97},(o,e)=>{const t=e/96*Math.PI*2;return[Math.cos(t),Math.sin(t),0]});return _0x23dc80(tube(e,{radius:o/2,sides:12,smoothness:2,caps:!1}),{center:!1,shine:.5})}),neon=o=>{const[e,t,r]=toColor(o);return[1.25*e,1.25*t,1.25*r,1]};export const toWorld=(o,e,t=4)=>[e.x-o.width/2,o.height/2-e.y,t];const plateColor=o=>"classic"===o.mode?toColor(COLORS.GUIDE,.2):toColor(o.BOARD.SURFACE),ringColor=o=>"classic"===o.mode?toColor(COLORS.GUIDE,.45):toColor(o.BOARD.BORDER);export function buildScene(o,e,t){const r=spawnBackdrop(o,e.width,e.height,-30,t);placeTiltedBackdrop(o,r,e,30);const s=toWorld(e,{x:e.cx,y:e.cy},0),n=2*e.radius+10;return{backdrop:r,plate:o.spawn({mesh:"cylinder",position:[s[0],s[1],-3],rotation:STAND_UP,scale:[n,6,n],color:plateColor(t),pickable:!1}),ring:o.spawn({mesh:ringMesh(3/e.radius),position:[s[0],s[1],1.5],scale:e.radius,color:ringColor(t),pickable:!1}),tip:o.spawn({mesh:"sphere",scale:0,color:neon(COLORS.STROKE),pickable:!1}),stroke:[],fit:[]}}export function removeScene(o,e){for(const t of[e.backdrop,e.plate,e.ring,e.tip,...e.stroke,...e.fit])o.despawn(t)}export function setSceneTheme(o,e,t){setBackdropTheme(o,e.backdrop,t),o.set(e.plate,{color:plateColor(t)}),o.set(e.ring,{color:ringColor(t)})}function bar(o,e,t,r,s,n=1){const a=t[0]-e[0],i=t[1]-e[1],p=Math.hypot(a,i);return o.spawn({mesh:"cylinder",position:[(e[0]+t[0])/2,(e[1]+t[1])/2,e[2]],rotation:quat.z(Math.atan2(i,a)-Math.PI/2),scale:[2*r*n,p*n,2*r*n],color:s,pickable:!1})}export function beginStroke(o,e,t,r){clearStroke(o,t);const s=toWorld(e,r);t.stroke.push(o.spawn({mesh:"sphere",position:s,scale:2*STROKE_RADIUS,color:neon(COLORS.STROKE),pickable:!1})),o.stopAnimation(t.tip),o.set(t.tip,{position:[s[0],s[1],s[2]+1],color:neon(COLORS.STROKE)}),o.animate(t.tip,{scale:3.2*STROKE_RADIUS},{duration:.12,easing:"back"})}export function extendStroke(o,e,t,r,s){const n=toWorld(e,r),a=toWorld(e,s),i=neon(COLORS.STROKE);t.stroke.push(bar(o,n,a,STROKE_RADIUS,i)),t.stroke.push(o.spawn({mesh:"sphere",position:a,scale:2*STROKE_RADIUS,color:i,pickable:!1})),o.set(t.tip,{position:[a[0],a[1],a[2]+1]})}export function endStroke(o,e){o.animate(e.tip,{scale:0},{duration:.15})}export function verdict(o,e,t,r,s,n){const a=neon(r?COLORS.SUCCESS:COLORS.FAIL);for(const e of t.stroke)o.animate(e,{color:a},{duration:TINT_TIME,easing:"easeOut"});if(effects.sparkle(o,{position:toWorld(e,{x:e.cx,y:e.cy},10),count:r?50:14,size:3,speed:e.radius*(r?2.2:1),lifetime:.9,colors:[a,[1,1,1,1]],flash:r}),!s)return;const i="classic"===n.mode?[1,1,1,.6]:toColor(n.TEXT,.6);for(let r=0;r<72;r++){const n=-Math.PI/2+r/72*Math.PI*2,a=-Math.PI/2+(r+1)/72*Math.PI*2,p=toWorld(e,{x:s.cx+Math.cos(n)*s.r,y:s.cy+Math.sin(n)*s.r},7),l=toWorld(e,{x:s.cx+Math.cos(a)*s.r,y:s.cy+Math.sin(a)*s.r},7),h=bar(o,p,l,.9,i,.001),d=Math.hypot(l[0]-p[0],l[1]-p[1]);o.animate(h,{scale:[1.8,1.05*d,1.8]},{duration:.06,delay:TINT_TIME/2+r/72*FIT_TRACE_TIME}),t.fit.push(h)}}export function clearStroke(o,e){for(const t of[...e.stroke,...e.fit])o.despawn(t);e.stroke=[],e.fit=[],o.stopAnimation(e.tip),o.set(e.tip,{scale:0})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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{timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,gridSizeFor,LIGHT,TIME_LIMIT}from"./PipeConnectConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./PipeConnectGame.js";import{jsx as
|
|
1
|
+
"use strict";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{timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,gridSizeFor,LIGHT,TIME_LIMIT}from"./PipeConnectConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./PipeConnectGame.js";import{jsx as _0x407c34}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.PIPE_CONNECT,GRID_SIZE=gridSizeFor(isTablet);export const PipeConnect=engineGame(GAME_IDS.PIPE_CONNECT,e=>{const[t,s]=useLiveState(TIME_LIMIT),{game:r,theme:i,status:n,screen:o,gameOver:a}=useEngineGame(e,{gameId:GAME_IDS.PIPE_CONNECT,create:e=>createGame(e,GRID_SIZE),start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,r)=>{const i=getLayout(t,s,r,GRID_SIZE);return setLayout(e,i),i.board},tap:tap,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onStop:e=>e(null,HapticType.MEDIUM),onOver:(e,t)=>{"win"!==t&&e(SOUNDS.GAME_OVER,HapticType.HEAVY)},wire:(e,t)=>{e.onTime=s,e.onTurn=e=>t(e?SOUNDS.COMPLETE:SOUNDS.ROTATE,e?HapticType.SUCCESS:HapticType.LIGHT)}});return _0x407c34(EngineGameScreen,{...o,light:LIGHT,columns:[timerColumn(t,i,0)],subtext:"Connect the pipes!",gameOver:a({title:"win"===n?"CONNECTED!":"TIME UP!",message:"win"===n?"All pipes connected!":"You ran out of time!",scoreLabel:"Final Score",score:r.score,buttonText:"Play Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,lathe,merge,Path,quat,shapeGeometry,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,lathe,merge,Path,quat,shapeGeometry,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x478132}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{cellCentre,COLORS,FLOW_STEP,PipeType,TURN_TIME,WIN_STEP}from"./PipeConnectConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("pipe-connect/PipeConnectScene:"+e,o),meshes.set(e,t)),t},STAND_UP=quat.x(Math.PI/2),BOARD_DEPTH=10,BACKDROP_DEPTH=25,TILE_HEIGHT=3,R=.15,FLANGE=[.52,.56,.62,1];export const pieceRotation=e=>quat.z(-e*Math.PI/2);const UP=[0,1],RIGHT=[1,0],DOWN=[0,-1],LEFT=[-1,0],flange=([e,o])=>({geometry:tube([[.4*e,.4*o,R],[.5*e,.5*o,R]],{radius:.195,sides:16,smoothness:1}),color:FLANGE}),arm=([e,o])=>({geometry:tube([[0,0,R],[.5*e,.5*o,R]],{radius:R,sides:16,smoothness:2})}),hub=()=>({geometry:shapeGeometry("sphere"),position:[0,0,R],scale:.345}),PIECES={[PipeType.STRAIGHT]:()=>[{geometry:tube([[0,.5,R],[0,-.5,R]],{radius:R,sides:16,smoothness:2})},flange(UP),flange(DOWN)],[PipeType.CORNER]:()=>[{geometry:tube(Array.from({length:9},(e,o)=>{const t=Math.PI+o/8*(Math.PI/2);return[.5+.5*Math.cos(t),.5+.5*Math.sin(t),R]}),{radius:R,sides:16,smoothness:3})},flange(UP),flange(RIGHT)],[PipeType.T_SHAPE]:()=>[arm(UP),arm(DOWN),arm(RIGHT),hub(),flange(UP),flange(DOWN),flange(RIGHT)],[PipeType.CROSS]:()=>[arm(UP),arm(DOWN),arm(LEFT),arm(RIGHT),hub(),flange(UP),flange(DOWN),flange(LEFT),flange(RIGHT)]},pieceMesh=e=>cached("pc-"+e,()=>e===PipeType.SOURCE||e===PipeType.SINK?endMesh(e===PipeType.SOURCE):_0x478132(merge(PIECES[e]()),{center:!1,shine:.75}));function endMesh(e){const o=[UP,RIGHT,DOWN,LEFT].flatMap(e=>[{...arm(e),color:[.82,.85,.9,1]},flange(e)]),t=e?{geometry:lathe([[.001,.5],[.24,.49],[.3,.44],[.32,.06],[.3,0]],{segments:28}),rotation:STAND_UP}:{geometry:lathe([[.001,.14],[.12,.15],[.18,.36],[.36,.42],[.34,.3],[.26,0]],{segments:28}),rotation:STAND_UP},s=e?[{geometry:tube(Array.from({length:17},(e,o)=>[.17*Math.cos(o/16*Math.PI*2),.17*Math.sin(o/16*Math.PI*2),.56]),{radius:.03,sides:8,smoothness:2}),color:[.85,.15,.12,1]},{geometry:shapeGeometry("cube"),position:[0,0,.53],scale:[.04,.04,.07],color:[.6,.6,.6,1]}]:[{geometry:shapeGeometry("sphere"),position:[0,0,.15],scale:[.2,.2,.02],color:[.1,.06,.05,1]}];return _0x478132(merge([...o,t,...s]),{center:!1,shine:.6})}const panelMesh=(e,o)=>cached("pc-panel:"+e+":"+o,()=>_0x478132(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:10}),{shine:.2})),panelColor=e=>toColor("classic"===e.mode?COLORS.CLASSIC_BOARD:e.BOARD.SURFACE),tileColor=e=>toColor("classic"===e.mode?COLORS.CLASSIC_CELL:e.BOARD.CELL_EMPTY),DRY=toColor(COLORS.PIPE),WET=toColor(COLORS.WATER);export const pieceColor=(e,o)=>e.type===PipeType.SOURCE?toColor(COLORS.SOURCE):e.type===PipeType.SINK?toColor(COLORS.SINK):o?WET:DRY;export function buildScene(e,o,t,s,a){const n=spawnBackdrop(e,o.width,o.height,-25,t);placeTiltedBackdrop(e,n,o,25);const r=e.spawn({mesh:panelMesh(o.board,"classic"===t.mode?16:8),position:[0,0,-5],color:panelColor(t),pickable:!1}),l=[],i=[],p=tileColor(t);for(const t of s)for(const s of t){const[t,n]=cellCentre(o,s.row,s.col);l.push(e.spawn({mesh:"roundedBox",position:[t,n,1.5],scale:[o.cell-2,o.cell-2,3],color:p,pickable:!1})),i.push(s.type===PipeType.EMPTY?null:e.spawn({mesh:pieceMesh(s.type),position:[t,n,3],rotation:pieceRotation(s.rotation),scale:o.cell,color:pieceColor(s,a.has(s.id)),pickable:!1}))}return{backdrop:n,panel:r,tiles:l,pieces:i}}export function removeScene(e,o){for(const t of[o.backdrop,o.panel,...o.tiles,...o.pieces])null!=t&&e.despawn(t)}export function setSceneTheme(e,o,t,s){setBackdropTheme(e,t.backdrop,s),e.set(t.panel,{mesh:panelMesh(o.board,"classic"===s.mode?16:8),color:panelColor(s)});const a=tileColor(s);for(const o of t.tiles)e.set(o,{color:a})}export function turnPiece(e,o,t){e.animate(o,{rotation:pieceRotation(t)},{duration:TURN_TIME,easing:"back"})}export function flow(e,o,t,s,a,n,r){if(!a)return void e.animate(t,{color:pieceColor(s,!1)},{duration:.15});const l=Math.max(0,n-r)*FLOW_STEP;e.animate(t,{color:pieceColor(s,!0)},{duration:.12,delay:l}),e.animate(t,[{scale:1.07*o.cell,at:.4},{scale:o.cell}],{duration:.22,delay:l})}export function winPulse(e,o,t,s){e.animate(t,[{scale:1.12*o.cell,at:.4},{scale:o.cell}],{duration:.25,delay:s*WIN_STEP})}export function splash(e,o,t,s){const[a,n]=cellCentre(o,t,s);effects.splash(e,{position:[a,n,.4*o.cell],count:24,size:.09*o.cell,speed:4*o.cell,direction:[0,0,1],spread:1.1,lifetime:.7,gravity:9*-o.cell,colors:[toColor("#4FC3F7"),toColor("#81D4FA"),[1,1,1,1]]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{memo,useCallback,useEffect,useRef,useState}from"react";import{audio}from"@nayan-ui/engine";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS,playSoundVoice}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn}from"../shared/EngineHud.js";import{GameLoading}from"../shared/GameLoading.js";import{GameLoadingTransition}from"../shared/GameLoadingTransition.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{PLAY_WITH_TUA_ACTIONS,PLAY_WITH_TUA_LIGHT}from"./PlayWithTuaConstants.js";import{createGame,cycleMove,dispose,drag,reset,resize,selectMove,setAudible,setTheme,start,tick}from"./PlayWithTuaGame.js";import{getCachedCharacter,loadCharacter}from"./PlayWithTuaModel.js";import{jsx as
|
|
1
|
+
"use strict";import{memo,useCallback,useEffect,useRef,useState}from"react";import{audio}from"@nayan-ui/engine";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS,playSoundVoice}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn}from"../shared/EngineHud.js";import{GameLoading}from"../shared/GameLoading.js";import{GameLoadingTransition}from"../shared/GameLoadingTransition.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{PLAY_WITH_TUA_ACTIONS,PLAY_WITH_TUA_LIGHT}from"./PlayWithTuaConstants.js";import{createGame,cycleMove,dispose,drag,reset,resize,selectMove,setAudible,setTheme,start,tick}from"./PlayWithTuaGame.js";import{getCachedCharacter,loadCharacter}from"./PlayWithTuaModel.js";import{jsx as _0x2ed96d}from"react/jsx-runtime";const SFX=GAME_SOUNDS.PLAY_WITH_TUA,Run=memo(function(e){const[t,s]=useLiveState(0,0),[a,r]=useLiveState("standing",0),o=useRef(e.settings);o.current=e.settings;const{game:i,screen:n}=useEngineGame(e,{gameId:GAME_IDS.PLAY_WITH_TUA,create:t=>createGame(e.model,t),start:start,reset:reset,dispose:dispose,tick:tick,resize:resize,drag:drag,setTheme:setTheme,sounds:SFX,reportData:e=>({action:e.move,moves:e.score}),wire:(e,t)=>{const a=[];return e.onSilence=()=>{for(const e of a)audio.stop(e);a.length=0},e.onSound=t=>{const s=o.current,r=playSoundVoice(SFX[t.sound],e.audible&&s.enableSounds&&!s.isVisible);null!=r&&(a.push(r),a.length>12&&audio.stop(a.shift()))},e.onScore=s,e.onMove=s=>{r(s),"playing"===e.phase&&t("standing"===s?SFX.STANDING:null,HapticType.LIGHT)},()=>e.onSilence()},onStart:e=>e(SFX.START,HapticType.LIGHT)}),m=useCallback(e=>setAudible(i,e),[i]);return _0x2ed96d(EngineGameScreen,{...n,light:PLAY_WITH_TUA_LIGHT,quality:"auto",onAudioChange:m,gameOver:null,onTap:()=>{"ready"===i.phase&&n.onStart(),cycleMove(i)},columns:[scoreColumn(t,"MOVES"),textColumn("ACTION",PLAY_WITH_TUA_ACTIONS.find(e=>e.id===a).label)],subtext:"Tap for next action \xb7 Drag to rotate",choices:PLAY_WITH_TUA_ACTIONS.map(t=>({id:t.id,label:t.label,selected:t.id===a,onPress:()=>{return s=t.id,void(e.settings.isVisible||("ready"===i.phase&&n.onStart(),selectMove(i,s)));var s}}))})});export const PlayWithTua=engineGame(GAME_IDS.PLAY_WITH_TUA,e=>{const[t,s]=useState(getCachedCharacter),[a,r]=useState(null);return useEffect(()=>{if(t)return;let e=!0;return loadCharacter().then(t=>{e&&s(t)}).catch(t=>{e&&r(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[t]),_0x2ed96d(GameLoadingTransition,{ready:!!t,loader:_0x2ed96d(GameLoading,{gameId:GAME_IDS.PLAY_WITH_TUA,theme:e.settings.theme,offset:e.settings.offset,error:!!a,message:a??void 0}),children:t&&_0x2ed96d(Run,{...e,model:t})})});
|
|
@@ -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{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{getLayout,LIGHT,TIME_LIMIT,TIME_WARNING}from"./PopitFidgetConstants.js";import{createGame,dispose,press,reset,setLayout,setTheme,start,tick}from"./PopitFidgetGame.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{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{getLayout,LIGHT,TIME_LIMIT,TIME_WARNING}from"./PopitFidgetConstants.js";import{createGame,dispose,press,reset,setLayout,setTheme,start,tick}from"./PopitFidgetGame.js";import{jsx as _0xb04e3}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.POPIT_FIDGET;export const PopitFidget=engineGame(GAME_IDS.POPIT_FIDGET,e=>{const[t,s]=useLiveState(0),[r,o]=useLiveState(TIME_LIMIT),{theme:i,status:m,screen:a,gameOver:n}=useEngineGame(e,{gameId:GAME_IDS.POPIT_FIDGET,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.sheet},drag:(e,t)=>{"start"===t.phase&&press(e,t.x,t.y)},sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>e("win"===t?GAME_SOUNDS.WELL_DONE:SOUNDS.GAME_OVER),wire:(e,t)=>{e.onScore=s,e.onTime=o,e.onPop=()=>t(SOUNDS.POP,HapticType.LIGHT)}}),p=useMemo(()=>toRgb(i.BACKGROUND),[i.BACKGROUND]);return _0xb04e3(EngineGameScreen,{...a,light:LIGHT,background:p,columns:[scoreColumn(t),timerColumn(r,i,TIME_WARNING)],subtext:"Pop bubbles to relax!",gameOver:n({title:"win"===m?"YOU WON!":"TIME UP!",message:"win"===m?"All bubbles popped!":"You ran out of time!",scoreLabel:"Final Score",score:t,buttonText:"Pop Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,lathe,merge,Path,quat}from"@nayan-ui/engine";import{darken,lighten}from"../../services/GamesConstants.js";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popBurst}from"../shared/EngineBlasts.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,lathe,merge,Path,quat}from"@nayan-ui/engine";import{darken,lighten}from"../../services/GamesConstants.js";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popBurst}from"../shared/EngineBlasts.js";import{cacheGameAsset,createGameMesh as _0x3f3d22}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{bubbleCentre,FLIP_TIME,GRID_SIZE,PRESS_TIME,ROW_COLORS}from"./PopitFidgetConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("popit-fidget/PopitFidgetScene:"+e,o),meshes.set(e,t)),t},STAND_UP=quat.x(Math.PI/2),SHEET_DEPTH=10,CORNER=22,BACKDROP_DEPTH=25,rgb=e=>{const[o,t,s]=toColor(e);return[o,t,s]},sheetShade=e=>rgb(lighten(ROW_COLORS[e],.22)),domeColor=e=>toColor(ROW_COLORS[e]),dimpleColor=e=>toColor(darken(ROW_COLORS[e],.12)),sheetMesh=e=>cached("pf-sheet:"+e.sheet.toFixed(1)+":"+e.spacing.toFixed(2),()=>{const o=e.sheet/2,t=Math.min(22,e.spacing/2),s=Array.from({length:GRID_SIZE},(s,n)=>{const[,a]=bubbleCentre(e,n,0),r=0===n?-o:-(a+e.spacing/2),i=n===GRID_SIZE-1?o:-(a-e.spacing/2),h=new Path;return 0===n?h.moveTo(-o,i).lineTo(-o,r+t).quadraticTo(-o,r,-o+t,r).lineTo(o-t,r).quadraticTo(o,r,o,r+t).lineTo(o,i).close():n===GRID_SIZE-1?h.moveTo(-o,r).lineTo(o,r).lineTo(o,i-t).quadraticTo(o,i,o-t,i).lineTo(-o+t,i).quadraticTo(-o,i,-o,i-t).close():h.addRect(-o,r,e.sheet,i-r),{geometry:extrude(h,{depth:10}),color:sheetShade(n)}});return _0x3f3d22(merge(s),{shine:.25})}),lipMesh=e=>cached("pf-lip:"+e.sheet.toFixed(1),()=>{const o=e.sheet,t=Math.min(22,e.spacing/2);return _0x3f3d22(extrude((new Path).addRoundedRect(-o/2,-o/2,o,o,t).addRoundedRect(-o/2+3,-o/2+3,o-6,o-6,t-3),{depth:2.5,fillRule:"evenodd"}),{shine:.6})}),smooth=(e,o,t)=>{const s=Math.min(1,Math.max(0,(t-e)/(o-e)));return s*s*(3-2*s)},grey=e=>[e,e,e],domeMesh=()=>cached("pf-dome-v4",()=>{const e=[];for(let o=0;o<=8;o++){const t=o/8*(Math.PI/2);e.push([.52-.06*Math.sin(t),.06*(1-Math.cos(t))])}e.reverse();const o=[];for(let e=0;e<=20;e++){const t=e/20*(Math.PI/2);o.push([Math.max(.001,.46*Math.cos(t)),.12+.3*Math.sin(t)])}return _0x3f3d22(lathe([...o.reverse(),...e],{segments:64,color:({position:e})=>grey(.88+.12*smooth(0,.2,e[1])+.04*smooth(.3,.43,e[1]))}),{center:!1,shine:.38})}),dimpleMesh=()=>cached("pf-dimple-v4",()=>{const e=[];for(let o=0;o<=14;o++){const t=o/14;e.push([Math.max(.001,.44*t),.012+.14*t*t])}for(let o=1;o<=10;o++){const t=o/10*Math.PI;e.push([.475-.035*Math.cos(t)+o/10*.025,.152+.04*Math.sin(t)-.19*smooth(.5,1,o/10)])}return _0x3f3d22(lathe(e,{segments:64,color:({position:e})=>grey(.8+.2*smooth(.02,.17,e[1]))}),{center:!1,shine:.3})});export function buildScene(e,o,t,s){const n=spawnBackdrop(e,o.width,o.height,-25,t);placeTiltedBackdrop(e,n,o,25);const a=e.spawn({mesh:sheetMesh(o),position:[0,0,-5],color:[1,1,1,1],pickable:!1}),r=e.spawn({mesh:lipMesh(o),position:[0,0,1.25],color:[1,1,1,.45],pickable:!1}),i=[],h=[];for(let t=0;t<GRID_SIZE;t++)for(let n=0;n<GRID_SIZE;n++){const[a,r]=bubbleCentre(o,t,n),l=!s[t*GRID_SIZE+n];i.push(e.spawn({mesh:domeMesh(),position:[a,r,0],rotation:STAND_UP,scale:l?o.bubble:0,color:domeColor(t),pickable:!1})),h.push(e.spawn({mesh:dimpleMesh(),position:[a,r,0],rotation:STAND_UP,scale:l?0:o.bubble,color:dimpleColor(t),pickable:!1}))}return{backdrop:n,sheet:a,lip:r,domes:i,dimples:h}}export function removeScene(e,o){for(const t of[o.backdrop,o.sheet,o.lip,...o.domes,...o.dimples])e.despawn(t)}export function setSceneTheme(e,o,t){setBackdropTheme(e,o.backdrop,t)}export function pop(e,o,t,s){const n=o.bubble,a=Math.floor(s/GRID_SIZE),r=t.domes[s],i=t.dimples[s];e.stopAnimation(r),e.stopAnimation(i),e.animate(r,[{scale:[1.1*n,.18*n,1.1*n],at:.75},{scale:0}],{duration:PRESS_TIME+.02,easing:"easeIn"}),e.set(i,{scale:0}),e.animate(i,[{scale:[1.08*n,1.4*n,1.08*n],at:.55},{scale:n}],{duration:FLIP_TIME,delay:PRESS_TIME,easing:"easeOut"});const[h,l]=bubbleCentre(o,a,s%GRID_SIZE);popBurst(e,{position:[h,l,.5*n],size:n,color:domeColor(a),glowZ:.05*n,count:7})}export function restore(e,o,t){t.domes.forEach((o,s)=>{e.stopAnimation(o),e.stopAnimation(t.dimples[s])});const s=e.transforms;t.domes.forEach((e,n)=>{s.scale(e,o.bubble),s.scale(t.dimples[n],0)}),s.flush()}export function celebrate(e,o){effects.confetti(e,{position:[0,0,o.bubble],count:60,size:.16*o.bubble,speed:1.4*o.sheet,lifetime:1.3,gravity:2.4*-o.sheet,colors:ROW_COLORS.slice(0,4).map(e=>toColor(e))})}
|
|
@@ -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{BOARD_BORDER_WIDTH,GAME_DURATION,getLayout,LIGHT}from"./ReversiConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./ReversiGame.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{BOARD_BORDER_WIDTH,GAME_DURATION,getLayout,LIGHT}from"./ReversiConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./ReversiGame.js";import{jsx as _0x4427bb}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.REVERSI,FEEDBACK={place:{sound:SOUNDS.PLACE,haptic:HapticType.MEDIUM},robot:{sound:SOUNDS.PLACE,haptic:HapticType.LIGHT},invalid:{sound:SOUNDS.INVALID,haptic:HapticType.LIGHT},pass:{sound:SOUNDS.PASS},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS},lose:{sound:SOUNDS.LOSE,haptic:HapticType.ERROR}};export const Reversi=engineGame(GAME_IDS.REVERSI,e=>{const[t,s]=useLiveState(0),[i,o]=useLiveState({black:2,white:2}),[r,n]=useLiveState(GAME_DURATION),{game:a,theme:m,status:S,screen:u,gameOver:E}=useEngineGame(e,{gameId:GAME_IDS.REVERSI,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,i)=>{const o=getLayout(t,s,i);return setLayout(e,o),o.size+2*BOARD_BORDER_WIDTH},drag:drag,outcome:e=>"black"===e.winner?"win":"lose",sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t,s)=>{s.timedOut&&e(SOUNDS.TIME_UP,HapticType.ERROR)},wire:(e,t)=>{e.onScore=s,e.onCounts=(e,t)=>o({black:e,white:t}),e.onTime=n,e.onEvent=s=>{"lose"!==s||null!==e.winner||e.timedOut?t(FEEDBACK[s].sound,FEEDBACK[s].haptic):t(GAME_SOUNDS.DRAW,HapticType.MEDIUM)}}}),{black:p,white:O,timedOut:D}=a,T=null===a.winner&&!D,l="win"===S?"YOU WON!":T?"IT'S A TIE!":D?"TIME UP!":"YOU LOST!",d="win"===S?"You finished "+p+"-"+O+"!":T?"Even at "+p+"-"+O+"!":D?"You ran out of time!":"The robot wins "+O+"-"+p+"!";return _0x4427bb(EngineGameScreen,{...u,light:LIGHT,columns:[scoreColumn(t),textColumn("YOU-AI",i.black+"-"+i.white),timerColumn(r,m)],subtext:"Outflank the robot!",gameOver:E({title:l,message:d,scoreLabel:"Score",score:t,buttonText:"Play Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,lathe,merge,Path,quat}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,lathe,merge,Path,quat}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x52198b}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{BOARD_BORDER_WIDTH,BOARD_SURFACE,cellCentre,COLORS,FLIP_TIME,PLACE_LEAD,RIPPLE}from"./ReversiConstants.js";const meshes=new Map,cached=(e,t)=>{let o=meshes.get(e);return!o&&(o=cacheGameAsset("reversi/ReversiScene:"+e,t),meshes.set(e,o)),o},STAND_UP=quat.x(Math.PI/2),WHITE_UP=[0,0,0,1],BLACK_UP=quat.x(Math.PI),EDGE_ON=quat.x(Math.PI/2),BACKDROP_DEPTH=30,FELT=BOARD_SURFACE,DISC=.8,THICK=.16,discMesh=()=>cached("rv-disc",()=>{const e=lathe([[.001,.5],[.36,.5],[.385,.46],[.41,.5],[.43,.5],[.465,.43],[.495,.28],[.5,.1],[.5,0],[.001,0]],{segments:36,color:({position:[e,t,o]})=>{const s=Math.hypot(e,o)>.43?.88:t<.49?.92:1;return[s,s,s,1]}});return _0x52198b(merge([{geometry:e,rotation:STAND_UP,color:toColor(COLORS.WHITE)},{geometry:e,rotation:quat.x(-Math.PI/2),color:toColor(COLORS.BLACK)}]),{center:!1,shine:.45})}),ringMesh=()=>cached("rv-ring",()=>_0x52198b(extrude((new Path).addCircle(0,0,.5).addCircle(0,0,.38),{depth:0,fillRule:"evenodd"}),{center:!1})),frameMesh=()=>cached("rv-frame",()=>_0x52198b(extrude((new Path).addRect(-.5,-.5,1,1).addRect(-.44,-.44,.88,.88),{depth:0,fillRule:"evenodd"}),{center:!1})),feltMesh=()=>cached("rv-felt",()=>_0x52198b(extrude((new Path).addRect(-.5,-.5,1,1),{depth:0}),{center:!1})),gridMesh=()=>cached("rv-grid",()=>{const e=new Path;for(let t=0;t<=8;t++){const o=Math.max(-3.9875,Math.min(3.9875,t-4));e.addRect(o-.0125,-4,.025,8).addRect(-4,o-.0125,8,.025)}const t=new Path;for(const e of[-2,2])for(const o of[-2,2])t.addCircle(e,o,.06);return _0x52198b(merge([{geometry:extrude(e,{depth:0}),color:toColor(COLORS.GRID)},{geometry:extrude(t,{depth:0}),position:[0,0,.01],color:toColor(COLORS.STAR)}]),{center:!1})}),lying=e=>FELT+.16*e.cell/2,at=(e,t,o)=>{const[s,n]=cellCentre(e,t);return[s,n,o]},faceUp=e=>"white"===e?WHITE_UP:BLACK_UP;function spawnFelt(e,t){const o=[e.spawn({mesh:feltMesh(),position:[0,0,FELT],scale:[t.size,t.size,1],color:toColor(COLORS.FELT),pickable:!1}),e.spawn({mesh:gridMesh(),position:[0,0,FELT+.02],scale:[t.cell,t.cell,1],pickable:!1})],s=BOARD_BORDER_WIDTH,n=toColor(COLORS.BOARD_BORDER);for(const a of[-1,1])o.push(e.spawn({mesh:feltMesh(),position:[0,a*(t.size+s)/2,FELT],scale:[t.size+2*s,s,1],color:n,pickable:!1})),o.push(e.spawn({mesh:feltMesh(),position:[a*(t.size+s)/2,0,FELT],scale:[s,t.size,1],color:n,pickable:!1}));return o}export function buildScene(e,t,o,s,n,a){const i=spawnBackdrop(e,t.width,t.height,-30,o);placeTiltedBackdrop(e,i,t,30);const r={backdrop:i,felt:spawnFelt(e,t),discs:new Array(64).fill(null),hints:[],last:e.spawn({mesh:frameMesh(),scale:0,color:toColor(COLORS.LAST_MOVE),pickable:!1})};return s.forEach((o,s)=>{o&&placeDisc(e,t,r,s,o,!1)}),showHints(e,t,r,n),showLast(e,t,r,a),r}export function removeScene(e,t){for(const o of[t.backdrop,...t.felt,...t.discs,...t.hints,t.last])null!=o&&e.despawn(o)}export function setSceneTheme(e,t,o){setBackdropTheme(e,t.backdrop,o)}export function placeDisc(e,t,o,s,n,a=!0){const i=o.discs[s];null!=i&&e.despawn(i);const r=.8*t.cell,l=lying(t),h=e.spawn({mesh:discMesh(),position:at(t,s,a?l+.7*t.cell:l),rotation:faceUp(n),scale:[r,r,.16*t.cell],pickable:!1});a&&e.animate(h,{position:at(t,s,l)},{duration:.2,easing:"bounce"}),o.discs[s]=h}export function flipDiscs(e,t,o,s,n,a){const i=Math.floor(s/8),r=s%8,l=lying(t);for(const s of n){const n=o.discs[s];if(null==n)continue;const h=Math.max(Math.abs(Math.floor(s/8)-i),Math.abs(s%8-r));e.animate(n,[{position:at(t,s,l+.45*t.cell),rotation:EDGE_ON,at:.5},{position:at(t,s,l),rotation:faceUp(a)}],{duration:FLIP_TIME,delay:PLACE_LEAD+(h-1)*RIPPLE,easing:"easeInOut"})}}export function showHints(e,t,o,s){for(const t of o.hints)e.despawn(t);const n=toColor(COLORS.HINT);o.hints=s.map(o=>e.spawn({mesh:ringMesh(),position:at(t,o,FELT+.08),scale:.32*t.cell,color:n,pickable:!1}))}export function showLast(e,t,o,s){s<0?e.set(o.last,{scale:0}):e.set(o.last,{position:at(t,s,FELT+.06),scale:t.cell-2})}export function nudge(e,t,o,s){const n=o.discs[s];null!=n&&e.animate(n,{shake:.05*t.cell},{duration:.2})}export function celebrate(e,t,o,s){const n=lying(t);s.forEach((s,a)=>{const i=o.discs[a];if("black"!==s||null==i)return;const r=.3+.04*(Math.floor(a/8)+a%8);e.animate(i,[{position:at(t,a,n+.4*t.cell),at:.4},{position:at(t,a,n)}],{duration:.4,delay:r,easing:"easeOut"})}),effects.confetti(e,{position:[0,0,2*t.cell],count:60,size:.15*t.cell,speed:1.4*t.size,lifetime:1.3,gravity:2.4*-t.size,colors:["#FFD700","#4CAF50","#FFFFFF","#1F7A46"].map(e=>toColor(e))})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.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{getLayout,LIGHT,TIME_LIMIT}from"./SearchGridConstants.js";import{createGame,dispose,drag,entries,reset,setLayout,setTheme,start,tick}from"./SearchGridGame.js";import{drawEntryList}from"./SearchGridScene.js";import{jsx as
|
|
1
|
+
"use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.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{getLayout,LIGHT,TIME_LIMIT}from"./SearchGridConstants.js";import{createGame,dispose,drag,entries,reset,setLayout,setTheme,start,tick}from"./SearchGridGame.js";import{drawEntryList}from"./SearchGridScene.js";import{jsx as _0x5115a3}from"react/jsx-runtime";export function createSearchGame(e){const{sounds:t}=e;return engineGame(e.gameId,r=>{const[s,a]=useLiveState(0),[i,n]=useLiveState(TIME_LIMIT),{theme:o,status:m,screen:u,gameOver:g}=useEngineGame(r,{gameId:e.gameId,create:t=>createGame(t,e),start:start,reset:reset,dispose:dispose,tick:tick,hud:(e,t)=>{e.layout&&drawEntryList(t,entries(e),e.found,e.layout)},setTheme:setTheme,resize:(e,t,r,s)=>{const a=getLayout(t,r,s);return setLayout(e,a),a.boardSize},drag:drag,sounds:t,onStart:e=>e(t.START,HapticType.MEDIUM),onOver:(e,r)=>{"win"!==r&&e(t.GAME_OVER,HapticType.HEAVY)},wire:(e,r)=>{e.onScore=a,e.onTime=n,e.onFind=()=>r(t.FOUND,HapticType.MEDIUM),e.onWin=()=>r(t.WIN,HapticType.SUCCESS)}}),d=useMemo(()=>toRgb(o.BACKGROUND),[o.BACKGROUND]);return _0x5115a3(EngineGameScreen,{...u,light:LIGHT,background:d,columns:[scoreColumn(s),timerColumn(i,o,0)],subtext:e.startSubtext,gameOver:g({title:"win"===m?e.winTitle:"TIME UP!",message:"win"===m?e.winMessage:"You ran out of time!",scoreLabel:"win"===m?"You Won!":"Game Over",score:s,buttonText:"win"===m?"Play Again!":"Try Again!"})})})}
|