@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,434 +0,0 @@
|
|
|
1
|
-
// Everything Tank 1990 draws: a battlefield (themed, as the original board, with its faint grid) seen from a
|
|
2
|
-
// little in front of straight down (shared/EngineTilt: an orthographic camera leaning back, one world
|
|
3
|
-
// unit per point) inside a thick riveted steel frame, brick walls that crumble a layer at a time, riveted steel blocks, the golden base,
|
|
4
|
-
// and tanks with tracks, turret and barrel that swing round to face where they drive. Shells are
|
|
5
|
-
// glowing tracers; muzzle flashes and explosions are particle bursts. Every wall, tank and shell kind
|
|
6
|
-
// is one shared mesh, so each is one instanced draw.
|
|
7
|
-
//
|
|
8
|
-
// Board points (x right, y down, from the board's top-left; as the rules use) map to the world with the
|
|
9
|
-
// board centred on the origin, y up and z up off the field.
|
|
10
|
-
import {
|
|
11
|
-
type Color,
|
|
12
|
-
effects,
|
|
13
|
-
type Entity,
|
|
14
|
-
extrude,
|
|
15
|
-
type GeometryPart,
|
|
16
|
-
lathe,
|
|
17
|
-
merge,
|
|
18
|
-
type Model,
|
|
19
|
-
Path,
|
|
20
|
-
quat,
|
|
21
|
-
shapeGeometry,
|
|
22
|
-
tube,
|
|
23
|
-
type Vec3,
|
|
24
|
-
type World
|
|
25
|
-
} from '@nayan-ui/engine';
|
|
26
|
-
import type { GameTheme } from '../../services/ThemeService';
|
|
27
|
-
import { setBackdropTheme, spawnBackdrop } from '../shared/EngineBackdrop';
|
|
28
|
-
import { cacheGameAsset, createGameMesh as createShape } from '../shared/EngineMeshes';
|
|
29
|
-
import { placeTiltedBackdrop } from '../shared/EngineTilt';
|
|
30
|
-
import { toColor } from '../shared/EngineUtils';
|
|
31
|
-
import {
|
|
32
|
-
CLASSIC_FIELD,
|
|
33
|
-
type Direction,
|
|
34
|
-
EXPLOSION_TIME,
|
|
35
|
-
FRAME,
|
|
36
|
-
GRID_HEIGHT,
|
|
37
|
-
GRID_LINE,
|
|
38
|
-
GRID_WIDTH,
|
|
39
|
-
type Layout,
|
|
40
|
-
TANK_RATIO,
|
|
41
|
-
TURN_TIME
|
|
42
|
-
} from './Tank1990Constants';
|
|
43
|
-
import type { Bullet, Tank, Tile } from './Tank1990Rules';
|
|
44
|
-
|
|
45
|
-
const meshes = new Map<string, Model>();
|
|
46
|
-
const cached = (key: string, build: () => Model) => {
|
|
47
|
-
let m = meshes.get(key);
|
|
48
|
-
if (!m) {
|
|
49
|
-
m = cacheGameAsset('tank-1990/Tank1990Scene:' + key, build);
|
|
50
|
-
meshes.set(key, m);
|
|
51
|
-
}
|
|
52
|
-
return m;
|
|
53
|
-
};
|
|
54
|
-
type RGB = [number, number, number];
|
|
55
|
-
const rgb = (css: string): RGB => {
|
|
56
|
-
const [r, g, b] = toColor(css);
|
|
57
|
-
return [r, g, b];
|
|
58
|
-
};
|
|
59
|
-
const c4 = (css: string): Color => toColor(css);
|
|
60
|
-
const cube = () => shapeGeometry('cube');
|
|
61
|
-
const sphere = () => shapeGeometry('sphere');
|
|
62
|
-
const STAND_UP = quat.x(Math.PI / 2);
|
|
63
|
-
const HEADING: Record<Direction, number> = { up: 0, left: Math.PI / 2, down: Math.PI, right: -Math.PI / 2 };
|
|
64
|
-
export const heading = (d: Direction) => quat.z(HEADING[d]);
|
|
65
|
-
const FIELD_DEPTH = 8;
|
|
66
|
-
const BACKDROP_DEPTH = 25;
|
|
67
|
-
|
|
68
|
-
/** Board points to the world, at height z. */
|
|
69
|
-
export const toWorld = (l: Layout, x: number, y: number, z = 0): Vec3 => [x - l.boardWidth / 2, l.boardHeight / 2 - y, z];
|
|
70
|
-
|
|
71
|
-
// ── Meshes (walls in cells, tanks in tank lengths) ────────────────────
|
|
72
|
-
|
|
73
|
-
/** A brick wall one cell square: brick-red sides, a running bond of bricks on top over dark mortar. Damaged, it's one layer lower and darker. */
|
|
74
|
-
const brickMesh = (damaged: boolean) =>
|
|
75
|
-
cached(`t90-brick-${damaged ? 1 : 2}`, () => {
|
|
76
|
-
const h = damaged ? 0.34 : 0.56;
|
|
77
|
-
const face = rgb(damaged ? '#7A3F1E' : '#A0522D');
|
|
78
|
-
const top = rgb(damaged ? '#9A6040' : '#C0764A');
|
|
79
|
-
const parts: GeometryPart[] = [
|
|
80
|
-
{ geometry: cube(), position: [0, 0, h / 2], scale: [0.96, 0.96, h], color: [...rgb('#2E1A0C'), 1] },
|
|
81
|
-
{ geometry: cube(), position: [0, 0, (h - 0.04) / 2], scale: [0.98, 0.98, h - 0.04], color: [...face, 1] }
|
|
82
|
-
];
|
|
83
|
-
// A running bond: half-cell bricks, every other row shifted by a quarter
|
|
84
|
-
const rows = 4;
|
|
85
|
-
for (let r = 0; r < rows; r++) {
|
|
86
|
-
const y = -0.5 + (r + 0.5) / rows;
|
|
87
|
-
const shift = r % 2 ? -0.25 : 0;
|
|
88
|
-
for (let k = 0; k < 3; k++) {
|
|
89
|
-
const x0 = Math.max(-0.48, -0.5 + shift + k * 0.5 + 0.02);
|
|
90
|
-
const x1 = Math.min(0.48, -0.5 + shift + (k + 1) * 0.5 - 0.02);
|
|
91
|
-
if (x1 - x0 < 0.06) continue;
|
|
92
|
-
if (damaged && (r + k) % 3 === 0) continue; // chunks knocked out
|
|
93
|
-
const tint = 0.9 + ((r * 7 + k * 3) % 5) * 0.04;
|
|
94
|
-
parts.push({
|
|
95
|
-
geometry: cube(),
|
|
96
|
-
position: [(x0 + x1) / 2, y, h + 0.025],
|
|
97
|
-
scale: [x1 - x0, 1 / rows - 0.05, 0.05],
|
|
98
|
-
color: [top[0] * tint, top[1] * tint, top[2] * tint, 1]
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return createShape(merge(parts), { center: false, shine: 0.1 });
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
/** Gunmetal steel, for the blocks and the frame. */
|
|
106
|
-
const STEEL = { edge: '#252B33', body: '#5F6B7A', plate: '#9AA6B4', rivet: '#E6EBF1' };
|
|
107
|
-
|
|
108
|
-
/** A steel block one cell square: polished sides, a raised plate and four rivets on top. */
|
|
109
|
-
const steelMesh = () =>
|
|
110
|
-
cached('t90-steel-v2', () => {
|
|
111
|
-
const h = 0.6;
|
|
112
|
-
const parts: GeometryPart[] = [
|
|
113
|
-
// A dark outline under gunmetal sides: it reads against a light field and a dark one alike
|
|
114
|
-
{ geometry: cube(), position: [0, 0, (h - 0.02) / 2], scale: [0.98, 0.98, h - 0.02], color: [...rgb(STEEL.edge), 1] },
|
|
115
|
-
{ geometry: cube(), position: [0, 0, h / 2], scale: [0.9, 0.9, h], color: [...rgb(STEEL.body), 1] },
|
|
116
|
-
{ geometry: cube(), position: [0, 0, h + 0.02], scale: [0.62, 0.62, 0.04], color: [...rgb(STEEL.plate), 1] },
|
|
117
|
-
{ geometry: cube(), position: [0, 0, h + 0.045], scale: [0.5, 0.5, 0.01], color: [...rgb(STEEL.body), 1] }
|
|
118
|
-
];
|
|
119
|
-
for (const [x, y] of [
|
|
120
|
-
[-0.36, -0.36],
|
|
121
|
-
[0.36, -0.36],
|
|
122
|
-
[-0.36, 0.36],
|
|
123
|
-
[0.36, 0.36]
|
|
124
|
-
])
|
|
125
|
-
parts.push({ geometry: sphere(), position: [x!, y!, h], scale: [0.12, 0.12, 0.08], color: [...rgb(STEEL.rivet), 1] });
|
|
126
|
-
return createShape(merge(parts), { center: false, shine: 0.85 });
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
/** The base: a golden plinth with a star standing proud on it. */
|
|
130
|
-
const baseMesh = () =>
|
|
131
|
-
cached('t90-base', () =>
|
|
132
|
-
createShape(
|
|
133
|
-
merge([
|
|
134
|
-
{ geometry: shapeGeometry('roundedBox'), position: [0, 0, 0.14], scale: [0.92, 0.92, 0.28], color: [...rgb('#FFC107'), 1] },
|
|
135
|
-
{ geometry: cube(), position: [0, 0, 0.29], scale: [0.7, 0.7, 0.03], color: [...rgb('#FF8F00'), 1] },
|
|
136
|
-
{ geometry: extrude(new Path().addStar(0, 0, 0.32, 0.14), { depth: 0.12 }), position: [0, 0, 0.36], color: [...rgb('#FFE082'), 1] }
|
|
137
|
-
]),
|
|
138
|
-
{ center: false, shine: 0.7 }
|
|
139
|
-
)
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
const PLAYER_PAINT = { hull: '#FFD700', top: '#FFE44D', track: '#8B7209', turret: '#FFF176', barrel: '#B8860B' };
|
|
143
|
-
const ENEMY_PAINT = { hull: '#6B7D94', top: '#8A9AAE', track: '#2E3C4E', turret: '#7A8EA4', barrel: '#4A5E74' };
|
|
144
|
-
|
|
145
|
-
/** A tank one unit long, facing +y: hull on two tracks with tread bars, a domed turret, and a barrel reaching past its nose. */
|
|
146
|
-
const tankMesh = (player: boolean) =>
|
|
147
|
-
cached(`t90-tank-${player ? 'player' : 'enemy'}`, () => {
|
|
148
|
-
const p = player ? PLAYER_PAINT : ENEMY_PAINT;
|
|
149
|
-
const parts: GeometryPart[] = [];
|
|
150
|
-
for (const side of [1, -1]) {
|
|
151
|
-
parts.push({ geometry: shapeGeometry('roundedBox'), position: [side * 0.37, 0, 0.13], scale: [0.24, 1, 0.26], color: c4(p.track) });
|
|
152
|
-
for (let i = 0; i < 6; i++)
|
|
153
|
-
parts.push({ geometry: cube(), position: [side * 0.37, -0.42 + i * 0.168, 0.265], scale: [0.25, 0.06, 0.02], color: [0.12, 0.12, 0.12, 1] });
|
|
154
|
-
}
|
|
155
|
-
parts.push(
|
|
156
|
-
{ geometry: shapeGeometry('roundedBox'), position: [0, 0, 0.22], scale: [0.56, 0.84, 0.24], color: c4(p.hull) },
|
|
157
|
-
{ geometry: cube(), position: [0, -0.08, 0.345], scale: [0.46, 0.5, 0.02], color: c4(p.top) },
|
|
158
|
-
{
|
|
159
|
-
geometry: lathe(
|
|
160
|
-
[
|
|
161
|
-
[0.001, 0.2],
|
|
162
|
-
[0.12, 0.19],
|
|
163
|
-
[0.2, 0.14],
|
|
164
|
-
[0.23, 0.06],
|
|
165
|
-
[0.23, 0]
|
|
166
|
-
],
|
|
167
|
-
{ segments: 24 }
|
|
168
|
-
),
|
|
169
|
-
position: [0, -0.04, 0.34],
|
|
170
|
-
rotation: STAND_UP,
|
|
171
|
-
color: c4(p.turret)
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
geometry: tube(
|
|
175
|
-
[
|
|
176
|
-
[0, 0.12, 0.43],
|
|
177
|
-
[0, 0.66, 0.43]
|
|
178
|
-
],
|
|
179
|
-
{ radius: 0.055, sides: 12 }
|
|
180
|
-
),
|
|
181
|
-
color: c4(p.barrel)
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
geometry: tube(
|
|
185
|
-
[
|
|
186
|
-
[0, 0.6, 0.43],
|
|
187
|
-
[0, 0.68, 0.43]
|
|
188
|
-
],
|
|
189
|
-
{ radius: 0.075, sides: 12 }
|
|
190
|
-
),
|
|
191
|
-
color: c4(p.barrel)
|
|
192
|
-
}
|
|
193
|
-
);
|
|
194
|
-
return createShape(merge(parts), { center: false, shine: player ? 0.55 : 0.4 });
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
/** The field: a slab (themed) with the faint grid between cells. */
|
|
198
|
-
const fieldMesh = (l: Layout, radius: number) =>
|
|
199
|
-
cached(`t90-field:${l.boardWidth}x${l.boardHeight}:${radius}`, () =>
|
|
200
|
-
createShape(
|
|
201
|
-
extrude(new Path().addRoundedRect(-l.boardWidth / 2, -l.boardHeight / 2, l.boardWidth, l.boardHeight, radius), { depth: FIELD_DEPTH }),
|
|
202
|
-
{
|
|
203
|
-
shine: 0.1
|
|
204
|
-
}
|
|
205
|
-
)
|
|
206
|
-
);
|
|
207
|
-
const gridMesh = (l: Layout) =>
|
|
208
|
-
cached(`t90-grid:${l.cell}`, () => {
|
|
209
|
-
const parts: GeometryPart[] = [];
|
|
210
|
-
for (let x = 1; x < GRID_WIDTH; x++)
|
|
211
|
-
parts.push({ geometry: cube(), position: [x * l.cell - l.boardWidth / 2, 0, 0], scale: [1, l.boardHeight, 0.2] });
|
|
212
|
-
for (let y = 1; y < GRID_HEIGHT; y++)
|
|
213
|
-
parts.push({ geometry: cube(), position: [0, l.boardHeight / 2 - y * l.cell, 0], scale: [l.boardWidth, 1, 0.2] });
|
|
214
|
-
return createShape(merge(parts), { center: false });
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
const frameWidth = (l: Layout) => Math.min(FRAME, l.cell * 0.5);
|
|
218
|
-
/**
|
|
219
|
-
* A thick steel frame round the field, as the steel blocks: a raised polished band hugging the board's
|
|
220
|
-
* edge, a lighter plate along its top, and a rivet at every cell.
|
|
221
|
-
*/
|
|
222
|
-
const frameMesh = (l: Layout) =>
|
|
223
|
-
cached(`t90-frame:${l.boardWidth}x${l.boardHeight}`, () => {
|
|
224
|
-
const f = frameWidth(l);
|
|
225
|
-
const h = l.cell * 0.6;
|
|
226
|
-
const w = l.boardWidth;
|
|
227
|
-
const H = l.boardHeight;
|
|
228
|
-
const ring = (inset: number, depth: number, color: string, z: number): GeometryPart => ({
|
|
229
|
-
geometry: extrude(
|
|
230
|
-
new Path()
|
|
231
|
-
.addRoundedRect(-w / 2 - f + inset, -H / 2 - f + inset, w + (f - inset) * 2, H + (f - inset) * 2, Math.max(1, f * 0.5 - inset))
|
|
232
|
-
.addRect(-w / 2 - inset * 0.2, -H / 2 - inset * 0.2, w + inset * 0.4, H + inset * 0.4),
|
|
233
|
-
{ depth, fillRule: 'evenodd' }
|
|
234
|
-
),
|
|
235
|
-
position: [0, 0, z],
|
|
236
|
-
color: [...rgb(color), 1]
|
|
237
|
-
});
|
|
238
|
-
const parts: GeometryPart[] = [ring(0, h, STEEL.body, h / 2), ring(f * 0.22, h * 0.06, STEEL.plate, h + h * 0.03)];
|
|
239
|
-
const rivet = (x: number, y: number) =>
|
|
240
|
-
parts.push({ geometry: sphere(), position: [x, y, h + h * 0.06], scale: [f * 0.3, f * 0.3, f * 0.2], color: [...rgb(STEEL.rivet), 1] });
|
|
241
|
-
const mid = f / 2;
|
|
242
|
-
for (let i = 0; i <= GRID_WIDTH; i++) {
|
|
243
|
-
const x = -w / 2 + i * l.cell;
|
|
244
|
-
rivet(x, H / 2 + mid);
|
|
245
|
-
rivet(x, -H / 2 - mid);
|
|
246
|
-
}
|
|
247
|
-
for (let j = 1; j < GRID_HEIGHT; j++) {
|
|
248
|
-
const y = -H / 2 + j * l.cell;
|
|
249
|
-
rivet(-w / 2 - mid, y);
|
|
250
|
-
rivet(w / 2 + mid, y);
|
|
251
|
-
}
|
|
252
|
-
return createShape(merge(parts), { center: false, shine: 0.85 });
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
// ── Spawning ──────────────────────────────────────────────────────────
|
|
256
|
-
|
|
257
|
-
export type TankView = { body: Entity; shield: Entity; direction: Direction; shielded: boolean; x: number; y: number };
|
|
258
|
-
export type Scene = {
|
|
259
|
-
backdrop: Entity;
|
|
260
|
-
field: Entity;
|
|
261
|
-
frame: Entity;
|
|
262
|
-
grid: Entity;
|
|
263
|
-
/** Each tile's wall, row by row (null where it's open ground). */
|
|
264
|
-
walls: (Entity | null)[][];
|
|
265
|
-
tanks: Map<number, TankView>;
|
|
266
|
-
bullets: Map<number, Entity>;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
const fieldColor = (theme: GameTheme) => toColor(theme.mode === 'classic' ? CLASSIC_FIELD : theme.BOARD.SURFACE);
|
|
270
|
-
const wallMesh = (t: Tile) =>
|
|
271
|
-
t.type === 'brick' ? brickMesh(t.health < 2) : t.type === 'steel' ? steelMesh() : t.type === 'base' ? baseMesh() : null;
|
|
272
|
-
|
|
273
|
-
export function buildScene(world: World, l: Layout, theme: GameTheme, tiles: Tile[][]): Scene {
|
|
274
|
-
const backdrop = spawnBackdrop(world, l.width, l.height, -BACKDROP_DEPTH, theme);
|
|
275
|
-
placeTiltedBackdrop(world, backdrop, l, BACKDROP_DEPTH);
|
|
276
|
-
const field = world.spawn({
|
|
277
|
-
mesh: fieldMesh(l, theme.mode === 'classic' ? 10 : 6),
|
|
278
|
-
position: [0, 0, -FIELD_DEPTH / 2],
|
|
279
|
-
color: fieldColor(theme),
|
|
280
|
-
pickable: false
|
|
281
|
-
});
|
|
282
|
-
const frame = world.spawn({ mesh: frameMesh(l), position: [0, 0, 0], pickable: false });
|
|
283
|
-
const grid = world.spawn({ mesh: gridMesh(l), position: [0, 0, 0.15], color: toColor(GRID_LINE), pickable: false });
|
|
284
|
-
const walls = tiles.map((row, y) => row.map((t, x) => spawnWall(world, l, t, x, y)));
|
|
285
|
-
return { backdrop, field, frame, grid, walls, tanks: new Map(), bullets: new Map() };
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function spawnWall(world: World, l: Layout, t: Tile, x: number, y: number): Entity | null {
|
|
289
|
-
const mesh = wallMesh(t);
|
|
290
|
-
return mesh ? world.spawn({ mesh, position: toWorld(l, (x + 0.5) * l.cell, (y + 0.5) * l.cell), scale: l.cell, pickable: false }) : null;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export function removeScene(world: World, s: Scene) {
|
|
294
|
-
const units = [...Array.from(s.tanks.values(), (t) => t.body), ...Array.from(s.bullets.values())];
|
|
295
|
-
for (const e of [s.backdrop, s.field, s.frame, s.grid, ...units, ...s.walls.flat()]) if (e != null) world.despawn(e);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export function setSceneTheme(world: World, l: Layout, s: Scene, theme: GameTheme) {
|
|
299
|
-
setBackdropTheme(world, s.backdrop, theme);
|
|
300
|
-
world.set(s.field, { mesh: fieldMesh(l, theme.mode === 'classic' ? 10 : 6), color: fieldColor(theme) });
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/** A tile's wall after a hit: a layer down, or gone in a shower of rubble. */
|
|
304
|
-
export function updateWall(world: World, l: Layout, s: Scene, x: number, y: number, t: Tile, was: Tile['type']) {
|
|
305
|
-
const e = s.walls[y]![x];
|
|
306
|
-
const mesh = wallMesh(t);
|
|
307
|
-
if (e != null && mesh) world.set(e, { mesh });
|
|
308
|
-
else if (e != null) {
|
|
309
|
-
world.despawn(e);
|
|
310
|
-
s.walls[y]![x] = null;
|
|
311
|
-
}
|
|
312
|
-
effects.shatter(world, {
|
|
313
|
-
position: toWorld(l, (x + 0.5) * l.cell, (y + 0.5) * l.cell, l.cell * 0.5),
|
|
314
|
-
count: mesh ? 6 : 12,
|
|
315
|
-
size: l.cell * 0.14,
|
|
316
|
-
speed: l.cell * 3,
|
|
317
|
-
direction: [0, 0, 1],
|
|
318
|
-
spread: 1.2,
|
|
319
|
-
lifetime: 0.5,
|
|
320
|
-
gravity: -l.cell * 9,
|
|
321
|
-
colors: was === 'base' ? [c4('#FFC107'), c4('#FF8F00'), c4('#5A5A5A')] : [c4('#A0522D'), c4('#6B3410'), c4('#C0764A')],
|
|
322
|
-
flash: false
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/** Builds a fresh map's walls (a new board). */
|
|
327
|
-
export function rebuildWalls(world: World, l: Layout, s: Scene, tiles: Tile[][]) {
|
|
328
|
-
for (const e of s.walls.flat()) if (e != null) world.despawn(e);
|
|
329
|
-
s.walls = tiles.map((row, y) => row.map((t, x) => spawnWall(world, l, t, x, y)));
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// ── Tanks and shells ──────────────────────────────────────────────────
|
|
333
|
-
|
|
334
|
-
const SHIELD: Color = [0.12, 0.55, 1, 0.28];
|
|
335
|
-
const SHELL: Color = [2.4, 1.5, 0.45, 1];
|
|
336
|
-
const SHELL_GLOW: Color = [2.2, 1.1, 0.3, 0.45];
|
|
337
|
-
|
|
338
|
-
/** Puts every live tank and shell where the battle has them (spawning newcomers, clearing the gone). */
|
|
339
|
-
export function syncUnits(world: World, l: Layout, s: Scene, tanks: Tank[], bullets: Bullet[], now: number) {
|
|
340
|
-
const size = l.cell * TANK_RATIO;
|
|
341
|
-
const seen = new Set<number>();
|
|
342
|
-
for (const t of tanks) {
|
|
343
|
-
if (!t.isAlive) continue;
|
|
344
|
-
seen.add(t.id);
|
|
345
|
-
let view = s.tanks.get(t.id);
|
|
346
|
-
const at = toWorld(l, t.x, t.y);
|
|
347
|
-
if (!view) {
|
|
348
|
-
const body = world.spawn({ mesh: tankMesh(t.isPlayer), position: at, rotation: heading(t.direction), scale: size, pickable: false });
|
|
349
|
-
const shield = world.spawn({ mesh: 'sphere', parent: body, position: [0, 0, 0.3], scale: 0, color: SHIELD, pickable: false });
|
|
350
|
-
view = { body, shield, direction: t.direction, shielded: false, x: t.x, y: t.y };
|
|
351
|
-
s.tanks.set(t.id, view);
|
|
352
|
-
// A new tank grows in
|
|
353
|
-
world.set(body, { scale: size * 0.3 });
|
|
354
|
-
world.animate(body, { scale: size }, { duration: 0.25, easing: 'back' });
|
|
355
|
-
}
|
|
356
|
-
if (view.x !== t.x || view.y !== t.y) {
|
|
357
|
-
world.set(view.body, { position: at });
|
|
358
|
-
view.x = t.x;
|
|
359
|
-
view.y = t.y;
|
|
360
|
-
}
|
|
361
|
-
if (view.direction !== t.direction) {
|
|
362
|
-
view.direction = t.direction;
|
|
363
|
-
world.animate(view.body, { rotation: heading(t.direction) }, { duration: TURN_TIME, easing: 'easeOut' });
|
|
364
|
-
}
|
|
365
|
-
const shielded = now < t.spawnProtectionEndTime;
|
|
366
|
-
if (shielded !== view.shielded) {
|
|
367
|
-
view.shielded = shielded;
|
|
368
|
-
world.stopAnimation(view.shield);
|
|
369
|
-
world.set(view.shield, { scale: shielded ? 1.45 : 0 });
|
|
370
|
-
if (shielded) world.animate(view.shield, { scale: 1.6 }, { duration: 0.35, repeat: 'forever', yoyo: true, easing: 'easeInOut' });
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
for (const [id, view] of s.tanks)
|
|
374
|
-
if (!seen.has(id)) {
|
|
375
|
-
world.despawn(view.body);
|
|
376
|
-
s.tanks.delete(id);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
const live = new Set<number>();
|
|
380
|
-
const updates = world.transforms;
|
|
381
|
-
for (const b of bullets) {
|
|
382
|
-
live.add(b.id);
|
|
383
|
-
const at = toWorld(l, b.x, b.y, l.cell * 0.34);
|
|
384
|
-
const e = s.bullets.get(b.id);
|
|
385
|
-
if (e == null) {
|
|
386
|
-
const shell = world.spawn({ mesh: 'sphere', position: at, scale: l.cell * 0.24, color: SHELL, pickable: false });
|
|
387
|
-
world.spawn({ mesh: 'puff', parent: shell, scale: 2.4, color: SHELL_GLOW, pickable: false });
|
|
388
|
-
s.bullets.set(b.id, shell);
|
|
389
|
-
} else updates.position(e, at[0], at[1], at[2]);
|
|
390
|
-
}
|
|
391
|
-
updates.flush();
|
|
392
|
-
for (const [id, e] of s.bullets)
|
|
393
|
-
if (!live.has(id)) {
|
|
394
|
-
world.despawn(e);
|
|
395
|
-
s.bullets.delete(id);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/** A muzzle flash at the end of a tank's barrel. */
|
|
400
|
-
export function muzzleFlash(world: World, l: Layout, t: Tank) {
|
|
401
|
-
const size = l.cell * TANK_RATIO;
|
|
402
|
-
const reach = size / 2 + size * 0.5;
|
|
403
|
-
const [sx, sy] = t.direction === 'up' ? [0, -1] : t.direction === 'down' ? [0, 1] : t.direction === 'left' ? [-1, 0] : [1, 0];
|
|
404
|
-
effects.dust(world, {
|
|
405
|
-
position: toWorld(l, t.x + sx * reach, t.y + sy * reach, size * 0.43),
|
|
406
|
-
count: 3,
|
|
407
|
-
size: size * 0.35,
|
|
408
|
-
speed: size * 1.5,
|
|
409
|
-
direction: [sx, -sy, 0.3],
|
|
410
|
-
spread: 0.5,
|
|
411
|
-
lifetime: 0.1,
|
|
412
|
-
color: [
|
|
413
|
-
[2.6, 2.6, 2.2, 0.95],
|
|
414
|
-
[2.4, 2, 0.8, 0.8]
|
|
415
|
-
],
|
|
416
|
-
endSize: 1.8
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/** An explosion at a board point: a fireball and smoke, bigger for a tank. */
|
|
421
|
-
export function explode(world: World, l: Layout, x: number, y: number, big: boolean) {
|
|
422
|
-
const size = l.cell * (big ? 0.9 : 0.5);
|
|
423
|
-
effects.explosion(world, {
|
|
424
|
-
position: toWorld(l, x, y, l.cell * 0.4),
|
|
425
|
-
count: big ? 22 : 10,
|
|
426
|
-
size,
|
|
427
|
-
speed: size * (big ? 3 : 2),
|
|
428
|
-
lifetime: EXPLOSION_TIME,
|
|
429
|
-
direction: [0, 0, 1],
|
|
430
|
-
spread: 1.3,
|
|
431
|
-
gravity: -l.cell * 10,
|
|
432
|
-
debris: big ? [c4('#3E4A58'), c4('#FFB74D'), c4('#5A5A5A')] : undefined
|
|
433
|
-
});
|
|
434
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// Tic Tac Toe's screen, on the Nayan engine: the board and pieces are one 3D scene (an orthographic
|
|
2
|
-
// camera leaning back over the board), under Playtura's scoreboard (you, the turn and the clock, the
|
|
3
|
-
// robot), controls and modals. The play is in TicTacToeGame.ts (the rules and the robot in
|
|
4
|
-
// TicTacToeRules.ts), what it draws in TicTacToeScene.ts.
|
|
5
|
-
//
|
|
6
|
-
// One world serves the whole visit: Start, Stop and Play Again clear the board in place and a theme
|
|
7
|
-
// change rebuilds just the board, so the GPU view is never rebuilt. Pieces drop and the win bar glows in
|
|
8
|
-
// the engine's Rust core; JS reads the finger and steps the clock and the world once a frame.
|
|
9
|
-
import { useMemo } from 'react';
|
|
10
|
-
import { HapticType } from '../../services/HapticsService';
|
|
11
|
-
import { GAME_SOUNDS } from '../../services/SoundsService';
|
|
12
|
-
import { GAME_IDS, isTablet } from '../../services/UtilsService';
|
|
13
|
-
import { engineGame, EngineGameScreen } from '../shared/EngineGameScreen';
|
|
14
|
-
import { textColumn, timerColumn } from '../shared/EngineHud';
|
|
15
|
-
import { toRgb } from '../shared/EngineUtils';
|
|
16
|
-
import { useEngineGame } from '../shared/useEngineGame';
|
|
17
|
-
import { useLiveState } from '../shared/useLiveState';
|
|
18
|
-
import { COLORS, getLayout, LIGHT, TIME_LIMIT } from './TicTacToeConstants';
|
|
19
|
-
import { createGame, dispose, drag, type GameEvent, reset, type Result, setLayout, setTheme, shownScore, start, tick } from './TicTacToeGame';
|
|
20
|
-
import type { Player } from './TicTacToeRules';
|
|
21
|
-
|
|
22
|
-
const SOUNDS = GAME_SOUNDS.TIC_TAC_TOE;
|
|
23
|
-
const LOW_TIME = 30;
|
|
24
|
-
|
|
25
|
-
/** Each event's sound and haptic, as the original version played them. */
|
|
26
|
-
const FEEDBACK: Record<GameEvent, { sound: (typeof SOUNDS)[keyof typeof SOUNDS]; haptic: HapticType }> = {
|
|
27
|
-
place: { sound: SOUNDS.PLACE, haptic: HapticType.LIGHT },
|
|
28
|
-
robot: { sound: SOUNDS.ROBOT, haptic: HapticType.LIGHT },
|
|
29
|
-
win: { sound: SOUNDS.WIN, haptic: HapticType.SUCCESS },
|
|
30
|
-
lose: { sound: SOUNDS.LOSE, haptic: HapticType.ERROR },
|
|
31
|
-
draw: { sound: SOUNDS.DRAW, haptic: HapticType.MEDIUM }
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const TITLES: Record<Result, [string, string]> = {
|
|
35
|
-
win: ['YOU WON!', 'You beat the robot!'],
|
|
36
|
-
lose: ['YOU LOST!', 'The robot wins!'],
|
|
37
|
-
draw: ['DRAW!', 'Nobody wins this round!'],
|
|
38
|
-
timeout: ['TIME UP!', 'You ran out of time!']
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const TicTacToe = engineGame(GAME_IDS.TIC_TAC_TOE, (props) => {
|
|
42
|
-
const [turn, setTurn] = useLiveState<Player>('O');
|
|
43
|
-
const [time, setTime] = useLiveState(TIME_LIMIT);
|
|
44
|
-
|
|
45
|
-
// As the original game did: a win 10,000; a loss or a timeout 0; a draw (and a stop) as a cancel
|
|
46
|
-
const { game, theme, screen, gameOver } = useEngineGame(props, {
|
|
47
|
-
gameId: GAME_IDS.TIC_TAC_TOE,
|
|
48
|
-
create: createGame,
|
|
49
|
-
start,
|
|
50
|
-
reset,
|
|
51
|
-
dispose,
|
|
52
|
-
tick,
|
|
53
|
-
setTheme,
|
|
54
|
-
resize: (g, width, height, offset) => {
|
|
55
|
-
const l = getLayout(width, height, offset, isTablet);
|
|
56
|
-
setLayout(g, l);
|
|
57
|
-
return l.size + l.pad * 2;
|
|
58
|
-
},
|
|
59
|
-
drag,
|
|
60
|
-
outcome: (g) => (g.result === 'win' ? 'win' : g.result === 'draw' ? 'draw' : 'lose'),
|
|
61
|
-
reportScore: (g, s) => (s === 'win' ? g.finalScore : 0),
|
|
62
|
-
sounds: SOUNDS,
|
|
63
|
-
onStart: (fx) => fx(SOUNDS.START, HapticType.MEDIUM),
|
|
64
|
-
onOver: (fx, _status, g) => {
|
|
65
|
-
if (g.result === 'timeout') fx(SOUNDS.TIME_UP, HapticType.ERROR);
|
|
66
|
-
},
|
|
67
|
-
wire: (g, fx) => {
|
|
68
|
-
g.onTurn = setTurn;
|
|
69
|
-
g.onTime = setTime;
|
|
70
|
-
g.onEvent = (event) => fx(FEEDBACK[event].sound, FEEDBACK[event].haptic);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const background = useMemo(() => toRgb(theme.BACKGROUND), [theme.BACKGROUND]);
|
|
75
|
-
const [title, message] = TITLES[game.result ?? 'timeout'];
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<EngineGameScreen
|
|
79
|
-
{...screen}
|
|
80
|
-
light={LIGHT}
|
|
81
|
-
background={background}
|
|
82
|
-
// You, whose turn it is and the clock, the robot (as the original scoreboard)
|
|
83
|
-
columns={[
|
|
84
|
-
textColumn('YOU', 'O', COLORS.O_BADGE),
|
|
85
|
-
timerColumn(time, theme, LOW_TIME, turn === 'O' ? 'YOUR TURN' : 'AI THINKING...'),
|
|
86
|
-
textColumn('AI', 'X', COLORS.X_BADGE)
|
|
87
|
-
]}
|
|
88
|
-
subtext="Play vs Robot!"
|
|
89
|
-
gameOver={gameOver({
|
|
90
|
-
title,
|
|
91
|
-
message,
|
|
92
|
-
scoreLabel: 'Final Score',
|
|
93
|
-
score: shownScore(game),
|
|
94
|
-
buttonText: 'Play Again!'
|
|
95
|
-
})}
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// Tic Tac Toe's scores, timings, colors and layout. Rules and scores match the original version
|
|
2
|
-
// (games/tic-tac-toe), so scores carry over.
|
|
3
|
-
import { getScoreBoardTop } from '../shared/EngineHud';
|
|
4
|
-
import type { TiltView } from '../shared/EngineTilt';
|
|
5
|
-
import { frontLight, gameWidthFor } from '../shared/EngineUtils';
|
|
6
|
-
|
|
7
|
-
// ── Rules and scoring ─────────────────────────────────────────────────
|
|
8
|
-
|
|
9
|
-
export const TIME_LIMIT = 120; // seconds
|
|
10
|
-
export const WIN_SCORE = 10000;
|
|
11
|
-
export const DRAW_SCORE = 5000;
|
|
12
|
-
export const LOSE_SCORE = 0;
|
|
13
|
-
/** Points for every second still on the clock when a game is won (half this for a draw). */
|
|
14
|
-
export const TIME_BONUS = 50;
|
|
15
|
-
export const ROBOT_DELAY = 0.5; // the robot "thinks" this long
|
|
16
|
-
|
|
17
|
-
// ── Colors ────────────────────────────────────────────────────────────
|
|
18
|
-
|
|
19
|
-
export const COLORS = {
|
|
20
|
-
X: '#E53935',
|
|
21
|
-
O: '#2E7D32',
|
|
22
|
-
WIN: '#FFC107',
|
|
23
|
-
// The wooden board (classic), as the original board
|
|
24
|
-
FRAME: '#5c4033',
|
|
25
|
-
WELL: '#3a2518',
|
|
26
|
-
SURFACE: '#6b4c3b',
|
|
27
|
-
SURFACE_ALT: '#735342',
|
|
28
|
-
GRID: '#8d6e5a',
|
|
29
|
-
// The scoreboard's badges
|
|
30
|
-
X_BADGE: '#F44336',
|
|
31
|
-
O_BADGE: '#4CAF50'
|
|
32
|
-
} as const;
|
|
33
|
-
|
|
34
|
-
// ── The scene ─────────────────────────────────────────────────────────
|
|
35
|
-
|
|
36
|
-
/** The camera leans back from straight down, so the board's depth and the pieces stand up. */
|
|
37
|
-
export const TILT = 0.42;
|
|
38
|
-
/** Lit from the upper left; surfaces facing up off the board (+z) keep their exact color. */
|
|
39
|
-
export const LIGHT = frontLight([-0.4, 0.5, 1], 0.45);
|
|
40
|
-
|
|
41
|
-
// ── Layout (view points) ──────────────────────────────────────────────
|
|
42
|
-
|
|
43
|
-
const SCOREBOARD_HEIGHT = 92;
|
|
44
|
-
const CONTROLS_HEIGHT = 120;
|
|
45
|
-
|
|
46
|
-
export type Layout = TiltView & { cell: number; size: number; pad: number };
|
|
47
|
-
|
|
48
|
-
/** The board as big as the original board (85% of the width, at most 350 points, 420 on a tablet), smaller if the screen is short. */
|
|
49
|
-
export function getLayout(width: number, height: number, offset: number, tablet: boolean): Layout {
|
|
50
|
-
const pad = tablet ? 10 : 8;
|
|
51
|
-
const top = getScoreBoardTop(offset) + SCOREBOARD_HEIGHT;
|
|
52
|
-
const room = Math.max(180, height - top - CONTROLS_HEIGHT);
|
|
53
|
-
const fromHeight = room / Math.cos(TILT) - pad * 2 - 30;
|
|
54
|
-
// The board, frame included, as wide as the game area (30 narrower than the screen, at most 500), shorter if the screen is
|
|
55
|
-
const size = Math.floor(Math.max(150, Math.min(gameWidthFor(width) - pad * 2, fromHeight)) / 3) * 3;
|
|
56
|
-
return { width, height, tilt: TILT, centerY: top + room / 2, cell: size / 3, size, pad };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** A cell's centre (0 top left, row by row), in world units. */
|
|
60
|
-
export function cellCentre(l: Layout, i: number): [number, number] {
|
|
61
|
-
return [((i % 3) - 1) * l.cell, (1 - Math.floor(i / 3)) * l.cell];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** The cell under a board point, or -1. */
|
|
65
|
-
export function cellAt(l: Layout, x: number, y: number): number {
|
|
66
|
-
const col = Math.floor((x + l.size / 2) / l.cell);
|
|
67
|
-
const row = Math.floor((l.size / 2 - y) / l.cell);
|
|
68
|
-
return col < 0 || col > 2 || row < 0 || row > 2 ? -1 : row * 3 + col;
|
|
69
|
-
}
|