react-native-games 1.3.0 → 1.5.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/balloon-blaster/BalloonBlaster.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +1 -1
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js +1 -1
- package/lib/module/games/balloon-blaster/components/GameArea.js +1 -1
- package/lib/module/games/balloon-blaster/components/GameBackground.js +1 -1
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js +1 -1
- package/lib/module/games/balloon-blaster/components/index.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/BikeRacingService.js +1 -1
- package/lib/module/games/bike-racing/BikeRacingStore.js +1 -1
- package/lib/module/games/bike-racing/components/BikeComponent.js +1 -1
- package/lib/module/games/bike-racing/components/GameBackground.js +1 -1
- package/lib/module/games/bike-racing/components/ScoreBoard.js +1 -1
- package/lib/module/games/bike-racing/components/index.js +1 -1
- package/lib/module/games/bike-racing/index.js +1 -1
- package/lib/module/games/block-blast/BlockBlast.js +1 -1
- package/lib/module/games/block-blast/BlockBlastConstants.js +1 -1
- package/lib/module/games/block-blast/BlockBlastService.js +1 -1
- package/lib/module/games/block-blast/BlockBlastStore.js +1 -1
- package/lib/module/games/block-blast/components/BlockPieceComponent.js +1 -1
- package/lib/module/games/block-blast/components/GameArea.js +1 -1
- package/lib/module/games/block-blast/components/GameBackground.js +1 -1
- package/lib/module/games/block-blast/components/GridComponent.js +1 -1
- package/lib/module/games/block-blast/components/ScoreBoard.js +1 -1
- package/lib/module/games/block-blast/components/index.js +1 -1
- package/lib/module/games/block-blast/index.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooterConstants.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooterService.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooterStore.js +1 -1
- package/lib/module/games/bubble-shooter/components/GameArea.js +1 -1
- package/lib/module/games/bubble-shooter/components/GameBackground.js +1 -1
- package/lib/module/games/bubble-shooter/components/ScoreBoard.js +1 -1
- package/lib/module/games/bubble-shooter/components/index.js +1 -1
- package/lib/module/games/bubble-shooter/index.js +1 -1
- package/lib/module/games/candy-crush/CandyCrush.js +1 -1
- package/lib/module/games/candy-crush/CandyCrushConstants.js +1 -1
- package/lib/module/games/candy-crush/CandyCrushService.js +1 -1
- package/lib/module/games/candy-crush/CandyCrushStore.js +1 -1
- package/lib/module/games/candy-crush/components/CandyItem.js +1 -1
- package/lib/module/games/candy-crush/components/GameBackground.js +1 -1
- package/lib/module/games/candy-crush/components/GameGrid.js +1 -1
- package/lib/module/games/candy-crush/components/ScoreBoard.js +1 -1
- package/lib/module/games/candy-crush/components/index.js +1 -1
- package/lib/module/games/candy-crush/index.js +1 -1
- package/lib/module/games/car-racing/CarRacing.js +1 -1
- package/lib/module/games/car-racing/CarRacingConstants.js +1 -1
- package/lib/module/games/car-racing/CarRacingService.js +1 -1
- package/lib/module/games/car-racing/CarRacingStore.js +1 -1
- package/lib/module/games/car-racing/components/CarComponent.js +1 -1
- package/lib/module/games/car-racing/components/GameBackground.js +1 -1
- package/lib/module/games/car-racing/components/ScoreBoard.js +1 -1
- package/lib/module/games/car-racing/components/index.js +1 -1
- package/lib/module/games/colors-sort/ColorsSort.js +1 -1
- package/lib/module/games/colors-sort/ColorsSortConstants.js +1 -1
- package/lib/module/games/colors-sort/ColorsSortService.js +1 -1
- package/lib/module/games/colors-sort/ColorsSortStore.js +1 -1
- package/lib/module/games/colors-sort/components/ColorContainer.js +1 -1
- package/lib/module/games/colors-sort/components/GameBackground.js +1 -1
- package/lib/module/games/colors-sort/components/ScoreBoard.js +1 -1
- package/lib/module/games/colors-sort/components/index.js +1 -1
- package/lib/module/games/dino-jump/DinoJump.js +1 -1
- package/lib/module/games/dino-jump/DinoJumpConstants.js +1 -1
- package/lib/module/games/dino-jump/DinoJumpService.js +1 -1
- package/lib/module/games/dino-jump/DinoJumpStore.js +1 -1
- package/lib/module/games/dino-jump/components/DinoSprite.js +1 -1
- package/lib/module/games/dino-jump/components/GameArea.js +1 -1
- package/lib/module/games/dino-jump/components/GameBackground.js +1 -1
- package/lib/module/games/dino-jump/components/ObstacleSprite.js +1 -1
- package/lib/module/games/dino-jump/components/ScoreBoard.js +1 -1
- package/lib/module/games/dino-jump/components/StarSprite.js +1 -1
- package/lib/module/games/dino-jump/components/index.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBird.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdStore.js +1 -1
- package/lib/module/games/flappy-bird/components/Bird.js +1 -1
- package/lib/module/games/flappy-bird/components/GameArea.js +1 -1
- package/lib/module/games/flappy-bird/components/GameBackground.js +1 -1
- package/lib/module/games/flappy-bird/components/Pipes.js +1 -1
- package/lib/module/games/flappy-bird/components/ScoreBoard.js +1 -1
- package/lib/module/games/flappy-bird/components/index.js +1 -1
- package/lib/module/games/fruit-merger/FruitMerger.js +1 -1
- package/lib/module/games/fruit-merger/FruitMergerConstants.js +1 -1
- package/lib/module/games/fruit-merger/FruitMergerService.js +1 -1
- package/lib/module/games/fruit-merger/FruitMergerStore.js +1 -1
- package/lib/module/games/fruit-merger/components/FruitItem.js +1 -1
- package/lib/module/games/fruit-merger/components/GameArea.js +1 -1
- package/lib/module/games/fruit-merger/components/GameBackground.js +1 -1
- package/lib/module/games/fruit-merger/components/ScoreBoard.js +1 -1
- package/lib/module/games/fruit-merger/components/index.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinja.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaService.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js +1 -1
- package/lib/module/games/fruit-ninja/components/FruitComponent.js +1 -1
- package/lib/module/games/fruit-ninja/components/GameArea.js +1 -1
- package/lib/module/games/fruit-ninja/components/GameBackground.js +1 -1
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js +1 -1
- package/lib/module/games/fruit-ninja/components/index.js +1 -1
- package/lib/module/games/game-2048/Game2048.js +1 -1
- package/lib/module/games/game-2048/Game2048Constants.js +1 -1
- package/lib/module/games/game-2048/Game2048Service.js +1 -1
- package/lib/module/games/game-2048/Game2048Store.js +1 -1
- package/lib/module/games/game-2048/components/GameBackground.js +1 -1
- package/lib/module/games/game-2048/components/GameGrid.js +1 -1
- package/lib/module/games/game-2048/components/GameTile.js +1 -1
- package/lib/module/games/game-2048/components/ScoreBoard.js +1 -1
- package/lib/module/games/game-2048/components/index.js +1 -1
- package/lib/module/games/maze-runner/MazeRunner.js +1 -1
- package/lib/module/games/maze-runner/MazeRunnerConstants.js +1 -1
- package/lib/module/games/maze-runner/MazeRunnerService.js +1 -1
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +1 -1
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js +1 -1
- package/lib/module/games/maze-runner/components/GameBackground.js +1 -1
- package/lib/module/games/maze-runner/components/ScoreBoard.js +1 -1
- package/lib/module/games/maze-runner/components/SkiaPipeComponent.js +1 -1
- package/lib/module/games/maze-runner/components/StaticGameBackground.js +1 -1
- package/lib/module/games/maze-runner/components/WallComponent.js +1 -1
- package/lib/module/games/maze-runner/components/index.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircle.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircleConstants.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircleService.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircleStore.js +1 -1
- package/lib/module/games/perfect-circle/components/DrawingCanvas.js +1 -1
- package/lib/module/games/perfect-circle/components/GameBackground.js +1 -1
- package/lib/module/games/perfect-circle/components/ScoreBoard.js +1 -1
- package/lib/module/games/perfect-circle/index.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidget.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetService.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetStore.js +1 -1
- package/lib/module/games/popit-fidget/components/BubbleComponent.js +1 -1
- package/lib/module/games/popit-fidget/components/FidgetGrid.js +1 -1
- package/lib/module/games/popit-fidget/components/GameBackground.js +1 -1
- package/lib/module/games/popit-fidget/components/ScoreBoard.js +1 -1
- package/lib/module/games/popit-fidget/components/index.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersService.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +1 -1
- package/lib/module/games/sliding-numbers/components/GameBackground.js +1 -1
- package/lib/module/games/sliding-numbers/components/NumbersGrid.js +1 -1
- package/lib/module/games/sliding-numbers/components/NumbersTile.js +1 -1
- package/lib/module/games/sliding-numbers/components/ScoreBoard.js +1 -1
- package/lib/module/games/sliding-numbers/components/index.js +1 -1
- package/lib/module/games/snake/Snake.js +1 -1
- package/lib/module/games/snake/SnakeConstants.js +1 -1
- package/lib/module/games/snake/SnakeService.js +1 -1
- package/lib/module/games/snake/SnakeStore.js +1 -1
- package/lib/module/games/snake/components/GameBackground.js +1 -1
- package/lib/module/games/snake/components/GameGrid.js +1 -1
- package/lib/module/games/snake/components/ScoreBoard.js +1 -1
- package/lib/module/games/snake/components/index.js +1 -1
- package/lib/module/games/snake/index.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighter.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighterConstants.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighterService.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighterStore.js +1 -1
- package/lib/module/games/space-fighter/components/AsteroidComponent.js +1 -1
- package/lib/module/games/space-fighter/components/GameArea.js +1 -1
- package/lib/module/games/space-fighter/components/GameBackground.js +1 -1
- package/lib/module/games/space-fighter/components/ScoreBoard.js +1 -1
- package/lib/module/games/space-fighter/components/Spacecraft3D.js +1 -1
- package/lib/module/games/space-fighter/components/SpacecraftPath.js +1 -1
- package/lib/module/games/space-fighter/components/index.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMole.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleService.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js +1 -1
- package/lib/module/games/whack-a-mole/components/GameBackground.js +1 -1
- package/lib/module/games/whack-a-mole/components/GameGrid.js +1 -1
- package/lib/module/games/whack-a-mole/components/GameHole.js +1 -1
- package/lib/module/games/whack-a-mole/components/MoleCharacter.js +1 -1
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js +1 -1
- package/lib/module/games/whack-a-mole/components/index.js +1 -1
- package/lib/module/helpers/AnimationFrame.js +1 -1
- package/lib/module/helpers/AnimationTracker.js +1 -1
- package/lib/module/helpers/ErrorHandler.js +1 -1
- package/lib/module/helpers/GameControlButton.js +1 -1
- package/lib/module/helpers/GameOverModal.js +1 -1
- package/lib/module/helpers/GameSettingsModal.js +1 -1
- package/lib/module/helpers/ParticleBlast.js +1 -1
- package/lib/module/helpers/ScoreBoardContainer.js +1 -1
- package/lib/module/helpers/index.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/services/GamesConstants.js +1 -1
- package/lib/module/services/GamesService.js +1 -1
- package/lib/module/services/HapticsService.js +1 -1
- package/lib/module/services/ScoringService.js +1 -1
- package/lib/module/services/SoundsService.js +1 -1
- package/lib/module/services/UtilsService.js +1 -1
- package/package.json +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import t,{useEffect as o,useMemo as r,useCallback as e}from"react";import{View as n,StyleSheet as s}from"react-native";import{GestureHandlerRootView as i}from"react-native-gesture-handler";import{useBalloonBlasterStore as a}from"./BalloonBlasterStore.js";import{createBalloonBlasterService as l}from"./BalloonBlasterService.js";import{ScoreBoard as f,GameArea as m,GameBackground as c}from"./components/index.js";import{GameControlButton as p,GameOverModal as u,useAnimationTrackers as B,useGameErrorHandler as b,GameErrorType as d}from"../../helpers/index.js";import{GameSettingsModal as g}from"../../helpers/index.js";import{GAME_IDS as x,DEFAULT_GAME_SETTINGS as C}from"../../services/UtilsService.js";import{jsx as S,jsxs as j}from"react/jsx-runtime";export const BalloonBlaster=t.memo(({settings:s,onSettingsChange:A,onEndGame:P})=>{const T=a(t=>t.isPlaying),v=a(t=>t.gameOver),G=a(t=>t.score),y=t.useRef(!1),E=t.useCallback(t=>{if(P&&!y.current){const o=a.getState();P({status:t,score:o.score.toString()}),y.current=!0}},[P]),O=a(t=>t.startGame),w=a(t=>t.stopGame),I=a(t=>t.resetGame),F=a(t=>t.decrementTime),M=a(t=>t.addBalloon),N=a(t=>t.removeBalloon),R=a(t=>t.updateBalloon),{balloonAnimations:U,particleAnimations:V}=B(["balloonAnimations","particleAnimations"]),{wrapFunction:k,safeExecute:q}=b(x.BALLOON_BLASTER),z=e(t=>{M(t)},[M]),D=e(k(()=>{I()},d.UNKNOWN_ERROR),[k,I]),H=r(()=>q(()=>l(U,V),l(U,V),d.INITIALIZATION_ERROR),[U,V,q]),J=e(k(()=>{y.current=!1,I(),a.getState().balloons.forEach(t=>N(t.id)),H&&(H.cleanup(),H.resetAnimations()),setTimeout(()=>{O(),H&&(H.startGameTimer(F),H.startBalloonSpawning(z,600),H.startPhysicsLoop(R,N,()=>a.getState().balloons))},50)},d.INITIALIZATION_ERROR),[k,I,N,H,O,F,z,R]),K=e(k(()=>{E("cancel"),w(),H&&(H.cleanup(),H.resetAnimations())},d.UNKNOWN_ERROR),[k,w,H,E]);o(()=>()=>{D()},[D]),o(()=>{if(v&&!y.current){const t=a.getState().lives>0?"win":"lose";E(t)}v||(y.current=!1)},[v,E]),o(()=>{v&&H&&H.cleanup()},[v,H]);const L=r(()=>({isPlaying:T,gameOver:v,onStartGame:J,onStopGame:K,startButtonText:"START POPPING",stopButtonText:"STOP GAME",startButtonSubtext:"Pop balloons to score!",stopButtonSubtext:"End current game",startButtonColor:"#3b82f6",stopButtonColor:"#dc2626",startButtonBorderColor:"#60a5fa",stopButtonBorderColor:"#f87171"}),[T,v,J,K]),Q=r(()=>({isVisible:v,score:G,onPlayAgain:D,buttonText:"Pop Again!",primaryColor:"rgba(59, 130, 246, 0.5)",borderColor:"rgba(59, 130, 246, 0.5)",buttonColor:"#ffffff",buttonBorderColor:"#ffffff",buttonTextColor:"#3b82f6"}),[v,G,D]),W=r(()=>({gameId:x.BALLOON_BLASTER,settings:s||C,onSettingsChange:A}),[s,A]),X=s?.offset??0;return S(n,{style:h.container,children:S(i,{children:j(c,{offset:X,children:[S(m,{}),S(f,{offset:X}),S(p,{...L}),S(u,{...Q}),S(g,{...W})]})})})});const h=s.create({container:{flex:1}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export const BALLOON_BLASTER_GAME_CONFIG
|
|
1
|
+
"use strict";export const BALLOON_BLASTER_GAME_CONFIG={GAME_DURATION:120,MAX_LIVES:3,BALLOON_SPAWN_INTERVAL:800,BALLOON_RISE_SPEED:.08,GRAVITY:-.003,INITIAL_VELOCITY_Y:-.2,INITIAL_VELOCITY_X_RANGE:.3,ROTATION_SPEED_RANGE:.02,BALLOON_SIZE:60,SLICE_TRAIL_LENGTH:10,COMBO_TIMEOUT:2e3,PARTICLE_COUNT:4,PARTICLE_LIFETIME:600};export const BALLOON_BLASTER_ANIMATION_CONFIG={BALLOON_SPRING:{damping:30,stiffness:50},POP_SPRING:{damping:20,stiffness:300},PARTICLE_SPRING:{damping:25,stiffness:400},SLICE_TIMING:{duration:200}};export const BALLOON_BLASTER_COLORS={BACKGROUND:"#87CEEB",SCORE_BOARD:"#4169E1",SLICE_TRAIL:"#FFD700",PARTICLE_COLORS:["#FF6B6B","#4ECDC4","#45B7D1","#96CEB4","#FFEAA7","#DDA0DD"],COMBO_TEXT:"#FF4757",LIVES_COLOR:"#FF6B6B",PARTICLE_GLOW:"rgba(255,255,255,0.9)",SCORE:"#FFFFFF",UI:"#FF6347",BUTTON_ACTIVE:"#FF7F50",BUTTON_INACTIVE:"#FFA07A",TEXT_PRIMARY:"#FFFFFF",TEXT_SECONDARY:"#F0F8FF",WHITE:"#FFFFFF",START_BUTTON:"#4CAF50",GAME_OVER_OVERLAY:"rgba(0, 0, 0, 0.85)"};export const BALLOON_TYPES=[{emoji:"\ud83c\udf88",points:10,name:"red balloon",color:"#FF0040",gradient:["#FF0040","#FF4080"]},{emoji:"\ud83c\udf88",points:10,name:"blue balloon",color:"#0080FF",gradient:["#0080FF","#40A0FF"]},{emoji:"\ud83c\udf88",points:15,name:"yellow balloon",color:"#FFD700",gradient:["#FFD700","#FFEB3B"]},{emoji:"\ud83c\udf88",points:20,name:"green balloon",color:"#00FF80",gradient:["#00FF80","#40FFA0"]},{emoji:"\ud83c\udf88",points:25,name:"purple balloon",color:"#8000FF",gradient:["#8000FF","#A040FF"]},{emoji:"\ud83c\udf88",points:15,name:"pink balloon",color:"#FF0080",gradient:["#FF0080","#FF40A0"]},{emoji:"\ud83c\udf88",points:30,name:"orange balloon",color:"#FF4000",gradient:["#FF4000","#FF8040"]},{emoji:"\ud83c\udf88",points:25,name:"cyan balloon",color:"#00FFFF",gradient:["#00FFFF","#40FFFF"]},{emoji:"\ud83c\udf88",points:35,name:"magenta balloon",color:"#FF00FF",gradient:["#FF00FF","#FF40FF"]},{emoji:"\ud83c\udf88",points:40,name:"gold balloon",color:"#FFB000",gradient:["#FFB000","#FFD700"]},{emoji:"\ud83c\udf88",points:45,name:"rainbow balloon",color:"#FF0080",gradient:["#FF0080","#8000FF","#0080FF","#00FF80"]},{emoji:"\ud83c\udf88",points:50,name:"neon balloon",color:"#00FF00",gradient:["#00FF00","#FFFF00"]}];export const BALLOON_SPECIAL_ITEMS=[{emoji:"\ud83d\udca3",points:-50,name:"bomb",isBomb:!0,color:"#FF4444"},{emoji:"\u2b50",points:50,name:"star",isBonus:!0,color:"#FFD700"}];export const BALLOON_BLASTER_THEME={backgroundColor:"rgba(0, 0, 0, 0.7)",headerBackgroundColor:"#3b82f6",headerTextColor:"#ffffff",sectionBackgroundColor:"rgba(59, 130, 246, 0.15)",sectionTitleColor:"#3b82f6",buttonSelectedColor:"#3b82f6",buttonUnselectedColor:"rgba(255, 255, 255, 0.2)",buttonSelectedTextColor:"#ffffff",buttonUnselectedTextColor:"rgba(255, 255, 255, 0.7)",switchTrackColorFalse:"rgba(59, 130, 246, 0.3)",switchTrackColorTrue:"#3b82f6",switchThumbColor:"#ffffff",infoTextColor:"rgba(255, 255, 255, 0.9)"};export const BALLOON_BLASTER_DIFFICULTY_DESCRIPTIONS={easy:"Balloons spawn slower, more forgiving",medium:"Balanced gameplay and balloon speed",hard:"Fast balloons, quick reflexes needed!"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Dimensions}from
|
|
1
|
+
"use strict";import{Dimensions as t}from"react-native";import{BALLOON_BLASTER_GAME_CONFIG as i,BALLOON_BLASTER_ANIMATION_CONFIG as e,BALLOON_BLASTER_COLORS as o,BALLOON_TYPES as s,BALLOON_SPECIAL_ITEMS as a}from"./BalloonBlasterConstants.js";const{width:n,height:r}=t.get("window");export{i as GAME_CONFIG,e as ANIMATION_CONFIG,o as COLORS,s as BALLOON_TYPES,a as SPECIAL_ITEMS};export class BalloonBlasterService{gameTimerRef=null;balloonSpawnRef=null;animationRef=null;comboTimeoutRef=null;particles=[];constructor(t,i){this.balloonAnimations=t,this.particleAnimations=i}startGameTimer(t){this.clearGameTimer(),this.gameTimerRef=setInterval(t,1e3)}startBalloonSpawning(t,e){this.clearBalloonSpawn();const o=e||i.BALLOON_SPAWN_INTERVAL,s=()=>{const i=this.createRandomBalloon();t(i);const e=150*(Math.random()-.5),a=o+e;this.balloonSpawnRef=setTimeout(s,Math.max(200,a))};for(let i=0;3>i;i++)setTimeout(()=>{const i=this.createRandomBalloon();t(i)},50*i);this.balloonSpawnRef=setTimeout(s,100)}startPhysicsLoop(t,e,o){let s=performance.now();const a=1e3/60,h=l=>{const c=l-s;if(a>c)return void(this.animationRef=requestAnimationFrame(h));s=l;const m=c/16.67;this.updateParticles(m);const u=o();for(let o=0;o<u.length;o++){const s=u[o];if(!s||s.isPopped)continue;const a=s.velocity.y+i.GRAVITY*m;let h=s.position.x+s.velocity.x*m;const l=s.position.y+a*m,c=s.rotation+s.rotationSpeed*m;if(-100>l){e(s.id);continue}if(l>r+100){e(s.id);continue}let M=s.velocity.x;h>0?h<n-i.BALLOON_SIZE||(h=n-i.BALLOON_SIZE,M=.8*-Math.abs(M)):(h=0,M=.8*Math.abs(M)),t(s.id,{position:{x:h,y:l},velocity:{x:M,y:a},rotation:c})}this.animationRef=requestAnimationFrame(h)};this.animationRef=requestAnimationFrame(h)}createRandomBalloon(){const t=(.1>Math.random()?a[Math.floor(Math.random()*a.length)]:s[Math.floor(Math.random()*s.length)])||s[0],e=i.BALLOON_SIZE,o=e/2,h=n-2*o-e,l=o+Math.random()*h,c=r-30,m=(Math.random()-.5)*i.INITIAL_VELOCITY_X_RANGE,u=i.INITIAL_VELOCITY_Y;return{id:`balloon_${Date.now()}_${Math.random()}`,type:t,position:{x:l,y:c},velocity:{x:m,y:u},rotation:0,rotationSpeed:(Math.random()-.5)*i.ROTATION_SPEED_RANGE,isPopped:!1,spawnTime:Date.now(),isBomb:"isBomb"in t&&t.isBomb,isBonus:"isBonus"in t&&t.isBonus}}createPopParticles(t){15>this.particles.length||this.particles.splice(0,Math.floor(this.particles.length/2));const e=[],s=Math.min(i.PARTICLE_COUNT,6),a=t.position.x+i.BALLOON_SIZE/2,n=t.position.y+i.BALLOON_SIZE/2;for(let r=0;s>r;r++){const h=r/s*Math.PI*2,l=5+4*Math.random();e.push({id:`particle_${t.id}_${r}_${Date.now()}_${Math.random()}`,position:{x:a,y:n},velocity:{x:Math.cos(h)*l,y:Math.sin(h)*l-3},color:o.PARTICLE_COLORS[r%o.PARTICLE_COLORS.length]||"#FF6B6B",size:4+3*Math.random(),lifetime:0,maxLifetime:Math.min(i.PARTICLE_LIFETIME,800)})}return this.particles=[...this.particles,...e],e}updateParticles(t=1){const i=16*t,e=.08*t,o=[];for(let s=0;s<this.particles.length;s++){const a=this.particles[s];if(!a)continue;const n={...a};n.lifetime+=i,n.lifetime<n.maxLifetime&&(n.position={x:n.position.x+n.velocity.x*t,y:n.position.y+n.velocity.y*t},n.velocity={x:n.velocity.x*Math.pow(.99,t),y:(n.velocity.y+e)*Math.pow(.99,t)},o.push(n))}this.particles=o}getParticles(){return this.particles}checkBalloonPop(t,e){if(t.isPopped||2>e.length)return!1;const o={x:t.position.x+i.BALLOON_SIZE/2,y:t.position.y+i.BALLOON_SIZE/2},s=i.BALLOON_SIZE/2;for(let t=0;t<e.length-1;t++){const i=e[t],a=e[t+1];if(i&&a&&s>=this.distanceFromPointToLine(o,i,a))return!0}return!1}distanceFromPointToLine(t,i,e){const o=t.x-i.x,s=t.y-i.y,a=e.x-i.x,n=e.y-i.y,r=o*a+s*n,h=a*a+n*n;if(0===h)return Math.sqrt(o*o+s*s);let l=r/h;l=Math.max(0,Math.min(1,l));const c=i.x+l*a,m=i.y+l*n,u=t.x-c,M=t.y-m;return Math.sqrt(u*u+M*M)}resetAnimations(){this.balloonAnimations.clear(),this.particleAnimations.clear(),this.particles=[]}cleanup(){this.clearGameTimer(),this.clearBalloonSpawn(),this.clearAnimationLoop(),this.clearComboTimeout(),this.particles=[]}clearGameTimer(){this.gameTimerRef&&(clearInterval(this.gameTimerRef),this.gameTimerRef=null)}clearBalloonSpawn(){this.balloonSpawnRef&&(clearTimeout(this.balloonSpawnRef),this.balloonSpawnRef=null)}clearAnimationLoop(){this.animationRef&&(cancelAnimationFrame(this.animationRef),this.animationRef=null)}clearComboTimeout(){this.comboTimeoutRef&&(clearTimeout(this.comboTimeoutRef),this.comboTimeoutRef=null)}}export const createBalloonBlasterService=(t,i)=>new BalloonBlasterService(t,i);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{create}from
|
|
1
|
+
"use strict";import{create as e}from"zustand";import{subscribeWithSelector as o}from"zustand/middleware";import{GAME_CONFIG as t}from"./BalloonBlasterService.js";import{immerMiddleware as i}from"../../services/UtilsService.js";export const useBalloonBlasterStore=e()(o(i((e,o)=>({score:0,timeLeft:60,isPlaying:!1,gameOver:!1,combo:0,lives:t.MAX_LIVES,balloons:[],particles:[],slicePath:[],isSlicing:!1,startGame:o=>{e(e=>{e.score=0,e.timeLeft=60,e.isPlaying=!0,e.gameOver=!1,e.combo=0,e.lives=t.MAX_LIVES,e.balloons=[],e.slicePath=[],e.isSlicing=!1})},stopGame:()=>{e(e=>{e.score=0,e.timeLeft=60,e.isPlaying=!1,e.gameOver=!1,e.combo=0,e.lives=t.MAX_LIVES,e.balloons=[],e.slicePath=[],e.isSlicing=!1})},resetGame:()=>{e(e=>{e.score=0,e.timeLeft=60,e.isPlaying=!1,e.gameOver=!1,e.combo=0,e.lives=t.MAX_LIVES,e.balloons=[],e.slicePath=[],e.isSlicing=!1})},popBalloon:t=>{const{balloons:i,isPlaying:r}=o();if(!r)return;let s=-1;for(let e=0;e<i.length;e++)if(i[e].id===t){s=e;break}-1===s||i[s].isPopped||e(e=>{e.score=e.score+10,e.balloons[s]&&(e.balloons[s].isPopped=!0,e.balloons[s].popTime=Date.now())})},updateScore:o=>{e(e=>{e.score=e.score+o})},decrementTime:()=>{e(e=>{const o=e.timeLeft-1;o>0?e.timeLeft=o:(e.timeLeft=0,e.isPlaying=!1,e.gameOver=!0)})},addBalloon:o=>{e(e=>{const{height:t}=require("react-native").Dimensions.get("window"),i={...o,position:{x:o.position.x,y:t+20}};e.balloons.push(i)})},removeBalloon:o=>{e(e=>{e.balloons=e.balloons.filter(e=>e.id!==o)})},updateBalloon:(o,t)=>{e(e=>{for(let i=0;i<e.balloons.length;i++)if(e.balloons[i].id===o){Object.assign(e.balloons[i],t);break}})},setParticles:o=>{e(e=>{e.particles=o})},setSlicePath:o=>{e(e=>{e.slicePath=o})},setIsSlicing:o=>{e(e=>{e.isSlicing=o})},incrementCombo:()=>{e(e=>{e.combo=e.combo+1})},resetCombo:()=>{e(e=>{e.combo=0})},loseLife:()=>{e(e=>{const o=e.lives-1;o>0?e.lives=o:(e.lives=0,e.isPlaying=!1,e.gameOver=!0)})},addLife:()=>{e(e=>{e.lives=Math.min(e.lives+1,t.MAX_LIVES)})}}))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import t,{useEffect as r,useMemo as o,useCallback as a}from"react";import{TouchableOpacity as e,Dimensions as n}from"react-native";import{Canvas as i,vec as s,Path as h,Skia as c,Oval as l,Circle as p}from"@shopify/react-native-skia";import F,{useSharedValue as d,useAnimatedStyle as y,withSpring as m,withTiming as g}from"react-native-reanimated";import{GAME_CONFIG as u,ANIMATION_CONFIG as M}from"../BalloonBlasterService.js";import{jsx as f,Fragment as w,jsxs as x}from"react/jsx-runtime";const k=1.2,I=25,v=.5,B=.8,$=8,C=.6,b=.3;export const BalloonComponent=t.memo(({balloon:t,onPop:$})=>{const{height:j}=n.get("window"),D=t.position.y>j?t.position.y:j-30,W=d(t.position.x),E=d(D),H=d(t.rotation),P=d(t.isPopped?0:1),z=d(t.isPopped?0:1);r(()=>{W.value=m(t.position.x,M.BALLOON_SPRING),E.value=m(t.position.y,M.BALLOON_SPRING),H.value=m(t.rotation,M.BALLOON_SPRING)},[t.position.x,t.position.y,t.rotation]),r(()=>{t.isPopped?(P.value=g(0,M.SLICE_TIMING),z.value=g(0,M.SLICE_TIMING)):(P.value=m(1,M.BALLOON_SPRING),z.value=m(1,M.BALLOON_SPRING))},[t.isPopped]);const O=y(()=>({transform:[{translateX:W.value},{translateY:E.value},{rotate:H.value+"rad"},{scale:P.value}],opacity:z.value})),S={position:"absolute",width:u.BALLOON_SIZE,height:u.BALLOON_SIZE,zIndex:t.isBomb?10:5},X=a((t,r)=>{const o=t.replace("#",""),a=Math.min(255,parseInt(o.substring(0,2),16)+Math.round(255*r)),e=Math.min(255,parseInt(o.substring(2,4),16)+Math.round(255*r)),n=Math.min(255,parseInt(o.substring(4,6),16)+Math.round(255*r));return`#${a.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`},[]),Y=a((t,r)=>{const o=t.replace("#",""),a=Math.max(0,parseInt(o.substring(0,2),16)-Math.round(255*r)),e=Math.max(0,parseInt(o.substring(2,4),16)-Math.round(255*r)),n=Math.max(0,parseInt(o.substring(4,6),16)-Math.round(255*r));return`#${a.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`},[]),q=o(()=>{if(t.isBomb)return{primary:"#1a1a1a",secondary:"#333333",highlight:"#555555",shadow:"#000000"};if(t.isBonus)return{primary:"#FFD700",secondary:"#FFEB3B",highlight:"#FFF59D",shadow:"#CC8800"};const r=t.type.color||"#FF0080";return{primary:r,secondary:X(r,.3),highlight:X(r,.5),shadow:Y(r,.3)}},[t.isBomb,t.isBonus,t.type.color,X,Y]),A=o(()=>{const t=u.BALLOON_SIZE,r=u.BALLOON_SIZE*k;return{balloonWidth:t,balloonHeight:r,totalHeight:r+I,center:s(t/2,r/2)}},[]),G=o(()=>{const r=c.Path.Make(),o=A.center.x,a=A.balloonHeight-2,e=t.id.split("").reduce((t,r)=>t+r.charCodeAt(0),0),n=t=>(e+17*t)%100/100;r.moveTo(o,a);for(let t=1;2>=t;t++){const e=a+12.5*t,i=2+2*n(t),s=o+(n(t+10)-.5)*i,h=o+(n(t+20)-.5)*i*.5,c=e-6.25;r.quadTo(h,c,s,e)}return r},[t.id,A.center.x,A.balloonHeight]),J=a(()=>{$?.(t.id)},[$,t.id]);return f(F.View,{style:[S,O],children:f(e,{onPress:J,activeOpacity:.8,style:{width:A.balloonWidth,height:A.totalHeight},children:x(i,{style:{width:A.balloonWidth,height:A.totalHeight},pointerEvents:"none",children:[f(l,{x:0,y:0,width:A.balloonWidth,height:A.balloonHeight,color:q.primary,opacity:B}),f(l,{x:.2*A.balloonWidth,y:.15*A.balloonHeight,width:.3*A.balloonWidth,height:.2*A.balloonHeight,color:q.highlight,opacity:v}),t.isBomb&&x(w,{children:[f(p,{cx:A.center.x,cy:A.center.y,r:8,color:"#FF0000",opacity:.9}),f(h,{path:c.Path.Make().moveTo(A.center.x,A.center.y-4).lineTo(A.center.x,A.center.y+1),color:"#FFFFFF",style:"stroke",strokeWidth:2,strokeCap:"round"}),f(p,{cx:A.center.x,cy:A.center.y+3,r:1,color:"#FFFFFF"})]}),!t.isBonus&&f(h,{path:G,color:"#8B4513",style:"stroke",strokeWidth:1.5,strokeCap:"round"}),t.isBonus&&f(p,{cx:A.center.x,cy:A.center.y,r:A.balloonWidth*C,color:"#FFD700",opacity:b})]})})})},(t,r)=>t.balloon.id===r.balloon.id&&t.balloon.position.x===r.balloon.position.x&&t.balloon.position.y===r.balloon.position.y&&t.balloon.rotation===r.balloon.rotation&&t.balloon.isPopped===r.balloon.isPopped&&t.balloon.isBomb===r.balloon.isBomb&&t.balloon.isBonus===r.balloon.isBonus);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import o,{useEffect as e,useState as r,useCallback as t,useMemo as s}from"react";import{View as i,StyleSheet as n}from"react-native";import{useBalloonBlasterStore as a}from"../BalloonBlasterStore.js";import{GAME_CONFIG as m}from"../BalloonBlasterService.js";import{playSound as l,GAME_SOUNDS as p}from"../../../services/SoundsService.js";import{playHaptic as c,HapticType as f}from"../../../services/HapticsService.js";import{ParticleBlast as d,useAnimationTracker as u}from"../../../helpers/index.js";import{BalloonComponent as j}from"./BalloonComponent.js";import{jsx as v,jsxs as x}from"react/jsx-runtime";const B=500,S=8,h=1e3;export const GameArea=o.memo(()=>{const o=a(o=>o.balloons),n=a(o=>o.isPlaying),S=a(o=>o.gameOver),{popBalloon:b,removeBalloon:y,updateBalloon:P,resetCombo:A,loseLife:L,addLife:$}=a(),_=u(),[g,w]=r([]),D=t(()=>{l(p.BALLOON_BLASTER.POP,!0),c(f.LIGHT,!0)},[]),G=t(()=>{l(p.BALLOON_BLASTER.BOMB,!0),c(f.HEAVY,!0)},[]),H=t(o=>{const e=o.position.x+m.BALLOON_SIZE/2,r=o.position.y+m.BALLOON_SIZE/2,t=`blast_${Date.now()}_${Math.random()}`;w(o=>[...o,{id:t,x:e,y:r}])},[]),M=t(o=>{w(e=>e.filter(e=>e.id!==o))},[]),T=t(o=>{if(!n||S)return;const e=a.getState().balloons.find(e=>e.id===o);e&&!e.isPopped&&(e.isBomb?(G(),L(),A(),P(o,{isPopped:!0})):e.isBonus?(D(),$(),P(o,{isPopped:!0})):(D(),b(o)),H(e),setTimeout(()=>{y(o),_.delete(o)},B))},[n,S,G,D,L,A,$,b,P,H,y,_]);e(()=>{o.forEach(o=>{_.has(o.id)||_.initialize(o.id)})},[o,_]);const k=s(()=>o.map(o=>{const e=_.get(o.id);return v(j,{balloon:o,animation:e,onPop:T},o.id)}),[o,_,T]),q=s(()=>g.map(o=>v(d,{x:o.x,y:o.y,particleCount:8,duration:h,onComplete:()=>M(o.id)},o.id)),[g,M]);return x(i,{style:C.gameArea,children:[k,q]})});const C=n.create({gameArea:{flex:1,position:"relative",overflow:"hidden"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import r from"react";import{Dimensions as c,View as o}from"react-native";import{Canvas as t,LinearGradient as l,Rect as F,Circle as i,Path as y,Skia as d,vec as h,Group as e,Shadow as a}from"@shopify/react-native-skia";import{jsx as n,jsxs as x}from"react/jsx-runtime";const{width:p,height:b}=c.get("window");export const GameBackground=r.memo(({children:r,offset:c=0})=>{const s=.18*b+.9*c,g=.29*b+.9*c,u=.3*b+.9*c,D=.23*b+.9*c;return x(o,{style:{flex:1},children:[x(t,{style:{position:"absolute",top:0,left:0,right:0,bottom:0,width:p,height:b},children:[n(F,{x:0,y:0,width:p,height:b,children:n(l,{start:h(0,0),end:h(0,b),colors:["#87CEEB","#B0E0E6","#E0F6FF","#F0F8FF","#FFF8DC"]})}),x(e,{children:[x(i,{cx:.8*p,cy:s,r:40,children:[n(l,{start:h(-40,-40),end:h(40,40),colors:["#FFFF99","#FFD700","#FFA500","#FF8C00"]}),n(a,{dx:0,dy:0,blur:30,color:"#FFD700"})]}),n(i,{cx:.8*p-8,cy:s-8,r:15,children:n(l,{start:h(-15,-15),end:h(15,15),colors:["#FFFFFF","#FFFF99"]})}),Array.from({length:16},(r,c)=>{const o=22.5*c*Math.PI/180,t=c%2==0,l=t?25:15,F=t?4:2,i=.8*p+45*Math.cos(o),h=s+45*Math.sin(o),e=.8*p+Math.cos(o)*(45+l),a=s+Math.sin(o)*(45+l),x=d.Path.Make();return x.moveTo(i,h),x.lineTo(e,a),n(y,{path:x,style:"stroke",strokeWidth:F,color:"#FFD700",opacity:.75},c)}),n(i,{cx:.8*p,cy:s,r:60,opacity:.1,children:n(l,{start:h(-60,-60),end:h(60,60),colors:["#FFD700","transparent"]})})]}),x(e,{children:[x(e,{children:[n(i,{cx:.12*p,cy:g,r:16,color:"#F0F8FF",opacity:.35,children:n(a,{dx:1,dy:2,blur:12,color:"rgba(0,0,0,0.05)"})}),n(i,{cx:.18*p,cy:g-(.24*b-.21*b),r:22,color:"#FFFFFF",opacity:.45,children:n(a,{dx:1,dy:2,blur:12,color:"rgba(0,0,0,0.05)"})}),n(i,{cx:.25*p,cy:g-(.24*b-.19*b),r:26,color:"#F8F8FF",opacity:.55,children:n(a,{dx:2,dy:3,blur:12,color:"rgba(0,0,0,0.06)"})}),n(i,{cx:.32*p,cy:g-(.24*b-.21*b),r:20,color:"#FFFFFF",opacity:.5,children:n(a,{dx:1,dy:2,blur:12,color:"rgba(0,0,0,0.05)"})}),n(i,{cx:.37*p,cy:g,r:14,color:"#F0F8FF",opacity:.4,children:n(a,{dx:1,dy:2,blur:12,color:"rgba(0,0,0,0.04)"})})]}),x(e,{children:[n(i,{cx:.62*p,cy:u,r:15,color:"#F0F8FF",opacity:.4,children:n(a,{dx:1,dy:2,blur:10,color:"rgba(0,0,0,0.04)"})}),n(i,{cx:.69*p,cy:u-(.27*b-.24*b),r:19,color:"#FFFFFF",opacity:.5,children:n(a,{dx:1,dy:2,blur:10,color:"rgba(0,0,0,0.05)"})}),n(i,{cx:.76*p,cy:u-(.27*b-.26*b),r:13,color:"#F8F8FF",opacity:.45,children:n(a,{dx:1,dy:2,blur:10,color:"rgba(0,0,0,0.04)"})})]}),x(e,{children:[n(i,{cx:.84*p,cy:D,r:10,color:"#F0F8FF",opacity:.35,children:n(a,{dx:0,dy:1,blur:6,color:"rgba(0,0,0,0.03)"})}),n(i,{cx:.89*p,cy:D-(.19*b-.17*b),r:12,color:"#FFFFFF",opacity:.4,children:n(a,{dx:0,dy:1,blur:6,color:"rgba(0,0,0,0.03)"})}),n(i,{cx:.93*p,cy:D,r:8,color:"#F8F8FF",opacity:.3,children:n(a,{dx:0,dy:1,blur:6,color:"rgba(0,0,0,0.02)"})})]})]}),x(e,{children:[x(e,{children:[n(i,{cx:.15*p,cy:.35*b,r:12,color:"#FF6B6B",opacity:.3,children:n(a,{dx:2,dy:2,blur:8,color:"rgba(0,0,0,0.1)"})}),n(F,{x:.15*p-.5,y:.35*b+12,width:1,height:15,color:"#8B4513",opacity:.4}),n(i,{cx:.2*p,cy:.32*b,r:10,color:"#4ECDC4",opacity:.3,children:n(a,{dx:2,dy:2,blur:6,color:"rgba(0,0,0,0.1)"})}),n(F,{x:.2*p-.5,y:.32*b+10,width:1,height:12,color:"#8B4513",opacity:.4}),n(i,{cx:.12*p,cy:.38*b,r:11,color:"#FFEAA7",opacity:.3,children:n(a,{dx:2,dy:2,blur:7,color:"rgba(0,0,0,0.1)"})}),n(F,{x:.12*p-.5,y:.38*b+11,width:1,height:13,color:"#8B4513",opacity:.4})]}),x(e,{children:[n(i,{cx:.45*p,cy:.28*b,r:9,color:"#DDA0DD",opacity:.25,children:n(a,{dx:1,dy:2,blur:5,color:"rgba(0,0,0,0.08)"})}),n(F,{x:.45*p-.5,y:.28*b+9,width:1,height:10,color:"#8B4513",opacity:.3}),n(i,{cx:.5*p,cy:.31*b,r:8,color:"#96CEB4",opacity:.25,children:n(a,{dx:1,dy:2,blur:4,color:"rgba(0,0,0,0.08)"})}),n(F,{x:.5*p-.5,y:.31*b+8,width:1,height:9,color:"#8B4513",opacity:.3})]}),x(e,{children:[n(i,{cx:.75*p,cy:.33*b,r:7,color:"#FFB6C1",opacity:.2,children:n(a,{dx:1,dy:1,blur:3,color:"rgba(0,0,0,0.06)"})}),n(F,{x:.75*p-.5,y:.33*b+7,width:1,height:8,color:"#8B4513",opacity:.25}),n(i,{cx:.8*p,cy:.3*b,r:6,color:"#FFA500",opacity:.2,children:n(a,{dx:1,dy:1,blur:3,color:"rgba(0,0,0,0.06)"})}),n(F,{x:.8*p-.5,y:.3*b+6,width:1,height:7,color:"#8B4513",opacity:.25})]}),x(e,{children:[n(i,{cx:.85*p,cy:.2*b,r:4,color:"#FF1493",opacity:.15}),n(F,{x:.85*p-.25,y:.2*b+4,width:.5,height:5,color:"#8B4513",opacity:.2}),n(i,{cx:.25*p,cy:.25*b,r:3,color:"#00CED1",opacity:.15}),n(F,{x:.25*p-.25,y:.25*b+3,width:.5,height:4,color:"#8B4513",opacity:.2}),n(i,{cx:.65*p,cy:.22*b,r:3.5,color:"#FFD700",opacity:.15}),n(F,{x:.65*p-.25,y:.22*b+3.5,width:.5,height:4.5,color:"#8B4513",opacity:.2})]})]}),x(e,{children:[Array.from({length:15},(r,c)=>{const o=["#FF6B6B","#4ECDC4","#FFEAA7","#DDA0DD","#96CEB4","#FFB6C1"];return n(i,{cx:p/15*c+c%3*20,cy:.15*b+c%5*.1*b,r:2+c%3,color:o[c%o.length],opacity:.3},"confetti-"+c)}),Array.from({length:8},(r,c)=>{const o=p/8*c,t=.05*b,l=o+30+c%2*20,F=.15*b,i=["#FF6B6B","#4ECDC4","#FFEAA7","#DDA0DD"],h=i[c%i.length],e=d.Path.Make();return e.moveTo(o,t),e.quadTo(o+15,t+20,l,F),n(y,{path:e,style:"stroke",strokeWidth:3,color:h,opacity:.4},"streamer-"+c)})]}),n(F,{x:0,y:.85*b,width:p,height:.15*b,children:n(l,{start:h(0,.85*b),end:h(0,b),colors:["#F0F8FF","#E6F3FF","#DDE9FF"]})})]}),r]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import e from"react";import{View as t,Text as o,StyleSheet as r}from"react-native";import{useBalloonBlasterStore as i}from"../BalloonBlasterStore.js";import{GAME_CONFIG as l}from"../BalloonBlasterService.js";import{ScoreBoardContainer as n}from"../../../helpers/index.js";import{jsx as s,jsxs as a}from"react/jsx-runtime";export const ScoreBoard=e.memo(({offset:e=0})=>{const r=i(e=>e.score),f=i(e=>e.timeLeft),h=i(e=>e.lives);return s(n,{offset:e,backgroundColor:"rgba(59, 130, 246, 0.4)",borderColor:"rgba(255, 255, 255, 0.6)",children:a(t,{style:c.scoreBoard,children:[a(t,{style:c.scoreSection,children:[s(o,{style:c.scoreLabel,children:"Score"}),s(o,{style:c.scoreValue,children:r})]}),a(t,{style:c.scoreSection,children:[s(o,{style:c.scoreLabel,children:"Time"}),s(o,{style:c.timeValue,children:(e=>{const t=e%60;return`${Math.floor(e/60).toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}`})(f)})]}),a(t,{style:c.scoreSection,children:[s(o,{style:c.scoreLabel,children:"Lives"}),s(t,{style:c.livesRow,children:Array.from({length:l.MAX_LIVES}).map((e,t)=>s(o,{style:[c.heartIcon,h>t?c.heartActive:c.heartInactive],children:"\ud83c\udf88"},t))})]})]})})});const c=r.create({scoreBoard:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},scoreSection:{alignItems:"center",flex:1},scoreLabel:{fontSize:16,fontWeight:"bold",color:"#ffffff",marginBottom:4},scoreValue:{fontSize:25,fontWeight:"bold",color:"#1e40af"},timeValue:{fontSize:25,fontWeight:"bold",color:"#1e40af"},livesRow:{flexDirection:"row",justifyContent:"center"},heartIcon:{fontSize:24,marginHorizontal:3,fontWeight:"bold"},heartActive:{opacity:1,textShadowColor:"rgba(0, 0, 0, 0.5)",textShadowOffset:{width:1,height:1},textShadowRadius:2},heartInactive:{opacity:.3,textShadowColor:"rgba(255, 255, 255, 0.3)",textShadowOffset:{width:1,height:1},textShadowRadius:1}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{BalloonComponent}from
|
|
1
|
+
"use strict";export{BalloonComponent}from"./BalloonComponent.js";export{GameArea}from"./GameArea.js";export{GameBackground}from"./GameBackground.js";export{ScoreBoard}from"./ScoreBoard.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import t from"react";import{View as e,StyleSheet as o,Dimensions as r}from"react-native";import{GestureDetector as i,Gesture as n,GestureHandlerRootView as s}from"react-native-gesture-handler";import{useBikeRacingStore as a,useScore as f,useIsPlaying as c,useGameOver as l,useObstacles as m,usePlayerBike as g,useRoadOffset as u,useParticleEffects as d,useLives as h}from"./BikeRacingStore.js";import{BikeRacingService as p}from"./BikeRacingService.js";import{GameBackground as x,BikeComponent as C,ScoreBoard as B}from"./components/index.js";import{GameControlButton as S,GameOverModal as v,GameSettingsModal as y,ParticleBlast as j}from"../../helpers/index.js";import{GAME_IDS as b,DEFAULT_GAME_SETTINGS as w}from"../../services/UtilsService.js";import{getDifficultySettings as R,BIKE_RACING_COLORS as T,BIKE_RACING_GAME_CONFIG as A}from"./BikeRacingConstants.js";import{playSound as k,GAME_SOUNDS as G}from"../../services/SoundsService.js";import{playHaptic as P,HapticType as I}from"../../services/HapticsService.js";import{jsx as M,jsxs as O}from"react/jsx-runtime";const{width:E,height:D}=r.get("window");export const BikeRacing=({settings:r=w,onSettingsChange:N,onEndGame:U})=>{const V=r?.difficulty||"medium",q=r?.enableSounds??!0,z=r?.enableHaptics??!0,F=r?.offset??0,J=f(),K=c(),L=l(),Q=h(),W=m(),X=g(),Y=u(),Z=d(),$=t.useRef(!1),_=t.useCallback(t=>{U&&!$.current&&(U({status:t,score:J.toString()}),$.current=!0)},[U,J]),tt=t.useCallback((t,e)=>a.getState().startGame(t,e),[]),et=t.useCallback(()=>a.getState().stopGame(),[]),ot=t.useCallback(()=>a.getState().resetGame(),[]),rt=t.useCallback(t=>{a.getState().removeParticleEffect(t)},[]),it=t.useMemo(()=>R(V),[V]),nt=t.useMemo(()=>new p(it.roadSpeed,it.obstacleSpawnInterval),[it.roadSpeed,it.obstacleSpawnInterval]);t.useEffect(()=>{a.getState().setOffset(F)},[F]),t.useEffect(()=>{nt.setCallbacks(()=>{k(G.CAR_RACING.CRASH,q),P(I.ERROR,z)},()=>{k(G.CAR_RACING.PASS,q),P(I.LIGHT,z)})},[nt,q,z]),t.useEffect(()=>{if(!K)return;const t=setInterval(()=>{a.getState().decrementTime()},1e3);return()=>clearInterval(t)},[K]),t.useEffect(()=>{L&&!$.current&&_(Q>0?"win":"lose"),L||($.current=!1)},[L,Q,_]),t.useEffect(()=>()=>{nt.cleanup(),et()},[nt]);const st=t.useCallback(()=>{$.current=!1,tt(it.gameDuration,F),nt.startGame(),k(G.CAR_RACING.START,q),P(I.SUCCESS,z)},[tt,nt,it.gameDuration,F,q,z]),at=t.useCallback(()=>{_("cancel"),et(),nt.stopGame()},[et,nt,_]),ft=t.useCallback(()=>{ot(),nt.cleanup()},[ot,nt]),ct=t.useCallback(()=>{ft()},[ft]),lt=t.useRef(1),mt=n.Pan().onUpdate(t=>{if(!K)return;const e=A.LANE_WIDTH*A.ROAD_LANES,o=(E-e)/2,r=t.absoluteX-o,i=Math.floor(r/A.LANE_WIDTH),n=Math.max(0,Math.min(A.ROAD_LANES-1,i));n!==lt.current&&(lt.current=n,k(G.CAR_RACING.LANE_SWITCH,q),P(I.SELECTION,z)),nt.movePlayerToLane(n)}).runOnJS(!0),gt=t.useMemo(()=>({isPlaying:K,gameOver:L,onStartGame:st,onStopGame:at,startButtonColor:T.UI,stopButtonColor:T.UI,startButtonBorderColor:T.UI,stopButtonBorderColor:T.UI,startButtonText:"START RACING",stopButtonText:"STOP GAME",startButtonSubtext:"Dodge traffic to score!"}),[K,L,st,at]),ut=t.useMemo(()=>({isVisible:L,score:J,onPlayAgain:ct,buttonText:"Race Again!",primaryColor:"rgba(255, 102, 0, 0.5)",borderColor:"rgba(255, 102, 0, 0.5)",buttonColor:"#ffffff",buttonBorderColor:"#ffffff",buttonTextColor:T.UI}),[L,J,ct]);return M(s,{style:H.container,children:O(e,{style:H.container,children:[M(e,{style:o.absoluteFillObject,children:M(x,{width:E,height:D,roadOffset:Y})}),M(B,{offset:F}),M(i,{gesture:mt,children:O(e,{style:H.gameArea,children:[W.map(t=>M(C,{x:t.x,y:t.y,width:t.width,height:t.height,color:t.color,isPlayer:!1},t.id)),M(C,{x:X.x,y:X.y,width:X.width,height:X.height,color:T.PLAYER_BIKE,isPlayer:!0})]})}),Z.map(t=>M(j,{x:t.x,y:t.y,particleCount:12,colors:["#ff6600","#ff8833","#ffaa66","#ffcc00","#ffff00","#ffffff"],duration:800,onComplete:()=>rt(t.id)},t.id)),M(S,{...gt}),M(v,{...ut}),M(y,{gameId:b.BIKE_RACING,settings:r||w,onSettingsChange:N})]})})};const H=o.create({container:{flex:1,backgroundColor:"#000"},gameArea:{flex:1}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export const BIKE_RACING_DIFFICULTY_CONFIG
|
|
1
|
+
"use strict";export const BIKE_RACING_DIFFICULTY_CONFIG={easy:{gameDuration:60,obstacleSpawnInterval:2500,roadSpeed:5},medium:{gameDuration:120,obstacleSpawnInterval:2e3,roadSpeed:7},hard:{gameDuration:180,obstacleSpawnInterval:1500,roadSpeed:9}};export const getDifficultySettings=e=>BIKE_RACING_DIFFICULTY_CONFIG[e];export const DEFAULT_BIKE_RACING_SETTINGS={difficulty:"medium",soundEnabled:!0,hapticEnabled:!0,gameDuration:BIKE_RACING_DIFFICULTY_CONFIG.medium.gameDuration,obstacleSpawnInterval:BIKE_RACING_DIFFICULTY_CONFIG.medium.obstacleSpawnInterval,roadSpeed:BIKE_RACING_DIFFICULTY_CONFIG.medium.roadSpeed};export const BIKE_RACING_GAME_CONFIG={GAME_DURATION:120,BIKE_WIDTH:40,BIKE_HEIGHT:70,OBSTACLE_WIDTH:40,OBSTACLE_HEIGHT:70,ROAD_LANES:3,LANE_WIDTH:90,ROAD_SPEED:7,OBSTACLE_SPAWN_INTERVAL:2e3,COLLISION_TOLERANCE:5,POINTS_PER_OBSTACLE_PASSED:15,LANE_SWITCH_DURATION:150};export const BIKE_RACING_COLORS={ROAD_DARK:"#1a1a1a",ROAD_LIGHT:"#2a2a2a",ROAD_LINE:"#ffff00",GRASS_GREEN:"#2d5016",GRASS_DARK:"#1a3009",SKY_BLUE:"#87ceeb",PLAYER_BIKE:"#ff6600",OBSTACLE_BIKE_1:"#0066ff",OBSTACLE_BIKE_2:"#00ff66",OBSTACLE_BIKE_3:"#ff00ff",SCORE:"#ffff00",UI:"#ff6600"};export const BIKE_RACING_THEME={backgroundColor:"rgba(0, 0, 0, 0.7)",headerBackgroundColor:"#ff6600",headerTextColor:"#ffffff",sectionBackgroundColor:"rgba(255, 102, 0, 0.15)",sectionTitleColor:"#ff6600",buttonSelectedColor:"#ff6600",buttonUnselectedColor:"rgba(255, 255, 255, 0.2)",buttonSelectedTextColor:"#ffffff",buttonUnselectedTextColor:"rgba(255, 255, 255, 0.7)",switchTrackColorFalse:"rgba(255, 102, 0, 0.3)",switchTrackColorTrue:"#ff6600",switchThumbColor:"#ffffff",infoTextColor:"rgba(255, 255, 255, 0.9)"};export const BIKE_RACING_DIFFICULTY_DESCRIPTIONS={easy:"1 min, slower traffic, casual ride",medium:"2 mins, normal traffic speed, balanced challenge",hard:"3 mins, fast traffic, expert riding skills!"};export const getLanePosition=(e,o)=>(o-270)/2+90*e+45-20;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Dimensions}from
|
|
1
|
+
"use strict";import{Dimensions as t}from"react-native";import{useBikeRacingStore as s}from"./BikeRacingStore.js";import{BIKE_RACING_GAME_CONFIG as i,BIKE_RACING_COLORS as e,getLanePosition as a}from"./BikeRacingConstants.js";const{width:n,height:o}=t.get("window");export class BikeRacingService{obstacleSpawnTimer=null;gameLoopTimer=null;obstacleIdCounter=0;roadSpeed=i.ROAD_SPEED;obstacleSpawnInterval=i.OBSTACLE_SPAWN_INTERVAL;collisionCooldown=new Map;constructor(t,s){t&&(this.roadSpeed=t),s&&(this.obstacleSpawnInterval=s)}setCallbacks(t,s){this.onCollision=t,this.onPass=s}startGame(){this.cleanup(),this.obstacleIdCounter=0,this.collisionCooldown.clear(),this.startObstacleSpawning(),this.gameLoopTimer=setInterval(()=>{this.updateGameState()},16)}stopGame(){this.cleanup()}updateGameState(){const t=s.getState(),{obstacles:i,playerBike:e,isPlaying:a}=t;if(!a)return;const n=(t.roadOffset+this.roadSpeed)%100;t.updateRoadOffset(n);for(let s=0;s<i.length;s++){const a=i[s];if(!a)continue;const n=a.y+this.roadSpeed;n>o+50?t.removeObstacle(a.id):(!a.passed&&n>e.y+e.height&&(t.markObstaclePassed(a.id),this.onPass&&this.onPass()),t.updateObstacle(a.id,{y:n}),this.checkCollision(a,e))}}checkCollision(t,e){const a=s.getState(),n=this.collisionCooldown.get(t.id);if(n&&1e3>Date.now()-n)return;const o=i.COLLISION_TOLERANCE;if(e.x<t.x+t.width-o&&e.x+e.width>t.x+o&&e.y<t.y+t.height-o&&e.y+e.height>t.y+o){this.collisionCooldown.set(t.id,Date.now());const s=(e.x+e.width/2+t.x+t.width/2)/2,i=(e.y+e.height/2+t.y+t.height/2)/2;a.addParticleEffect(s,i),a.loseLife(),a.removeObstacle(t.id),this.onCollision&&this.onCollision()}}startObstacleSpawning(){this.obstacleSpawnTimer=setInterval(()=>{this.spawnObstacle()},this.obstacleSpawnInterval),this.spawnObstacle()}spawnObstacle(){const t=s.getState();if(!t.isPlaying)return;const o=this.fastRandom(0,i.ROAD_LANES),h=a(o,n),r=[e.OBSTACLE_BIKE_1,e.OBSTACLE_BIKE_2,e.OBSTACLE_BIKE_3],l=r[this.fastRandom(0,r.length)]||e.OBSTACLE_BIKE_1,c={id:"obstacle-"+this.obstacleIdCounter++,x:h,y:-i.OBSTACLE_HEIGHT,lane:o,width:i.OBSTACLE_WIDTH,height:i.OBSTACLE_HEIGHT,color:l,passed:!1};t.addObstacle(c)}fastRandom(t,s){return Math.floor(Math.random()*(s-t))+t}movePlayerToLane(t){const i=s.getState();i.isPlaying&&i.movePlayerBike(t)}cleanup(){this.obstacleSpawnTimer&&(clearInterval(this.obstacleSpawnTimer),this.obstacleSpawnTimer=null),this.gameLoopTimer&&(clearInterval(this.gameLoopTimer),this.gameLoopTimer=null),this.collisionCooldown.clear()}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{create}from
|
|
1
|
+
"use strict";import{create as e}from"zustand";import{subscribeWithSelector as t}from"zustand/middleware";import{Dimensions as s}from"react-native";import{immerMiddleware as o}from"../../services/UtilsService.js";import{BIKE_RACING_GAME_CONFIG as i,getLanePosition as a}from"./BikeRacingConstants.js";const{width:r,height:c}=s.get("window");export const useBikeRacingStore=e()(t(o((e,t)=>({score:0,timeLeft:i.GAME_DURATION,isPlaying:!1,gameOver:!1,lives:3,obstacles:[],playerBike:{x:a(1,r),y:.65*c,lane:1,width:i.BIKE_WIDTH,height:i.BIKE_HEIGHT},roadOffset:0,particleEffects:[],offset:0,gameDuration:i.GAME_DURATION,setOffset:t=>{e(e=>{e.offset=t;const s=t>0?.75*c:.62*c;e.playerBike.y=s})},startGame:(t,s)=>{const o=t||i.GAME_DURATION;e(e=>{e.score=0,e.timeLeft=o,e.gameDuration=o,e.isPlaying=!0,e.gameOver=!1,e.lives=3,e.obstacles=[],e.roadOffset=0,void 0!==s&&(e.offset=s);const t=(void 0!==s?s:e.offset)>0?.75*c:.62*c;e.playerBike={x:a(1,r),y:t,lane:1,width:i.BIKE_WIDTH,height:i.BIKE_HEIGHT}})},stopGame:()=>{e(e=>{e.score=0,e.timeLeft=e.gameDuration,e.isPlaying=!1,e.gameOver=!1,e.lives=3,e.obstacles=[],e.roadOffset=0;const t=e.offset>0?.75*c:.62*c;e.playerBike={x:a(1,r),y:t,lane:1,width:i.BIKE_WIDTH,height:i.BIKE_HEIGHT}})},resetGame:()=>{e(e=>{e.score=0,e.timeLeft=e.gameDuration,e.isPlaying=!1,e.gameOver=!1,e.lives=3,e.obstacles=[],e.roadOffset=0;const t=e.offset>0?.75*c:.62*c;e.playerBike={x:a(1,r),y:t,lane:1,width:i.BIKE_WIDTH,height:i.BIKE_HEIGHT}})},updateScore:t=>{e(e=>{e.score=e.score+t})},decrementTime:()=>{e(e=>{const t=e.timeLeft-1;t>0?e.timeLeft=t:(e.timeLeft=0,e.isPlaying=!1,e.gameOver=!0)})},addObstacle:t=>{e(e=>{e.obstacles.push(t)})},removeObstacle:t=>{e(e=>{e.obstacles=e.obstacles.filter(e=>e.id!==t)})},updateObstacle:(t,s)=>{e(e=>{for(let o=0;o<e.obstacles.length;o++)if(e.obstacles[o].id===t){Object.assign(e.obstacles[o],s);break}})},movePlayerBike:t=>{e(e=>{const s=Math.max(0,Math.min(i.ROAD_LANES-1,t));e.playerBike.lane=s,e.playerBike.x=a(s,r)})},updateRoadOffset:t=>{e(e=>{e.roadOffset=t})},markObstaclePassed:t=>{e(e=>{for(let s=0;s<e.obstacles.length;s++)if(e.obstacles[s].id===t&&!e.obstacles[s].passed){e.obstacles[s].passed=!0,e.score=e.score+i.POINTS_PER_OBSTACLE_PASSED;break}})},loseLife:()=>{e(e=>{const t=e.lives-1;t>0?e.lives=t:(e.lives=0,e.isPlaying=!1,e.gameOver=!0)})},clearObstacles:()=>{e(e=>{e.obstacles=[]})},addParticleEffect:(t,s)=>{e(e=>{e.particleEffects.push({id:`particle-${Date.now()}-${Math.random()}`,x:t,y:s})})},removeParticleEffect:t=>{e(e=>{e.particleEffects=e.particleEffects.filter(e=>e.id!==t)})}}))));export const useScore=()=>useBikeRacingStore(e=>e.score);export const useTimeLeft=()=>useBikeRacingStore(e=>e.timeLeft);export const useLives=()=>useBikeRacingStore(e=>e.lives);export const useIsPlaying=()=>useBikeRacingStore(e=>e.isPlaying);export const useGameOver=()=>useBikeRacingStore(e=>e.gameOver);export const useObstacles=()=>useBikeRacingStore(e=>e.obstacles);export const usePlayerBike=()=>useBikeRacingStore(e=>e.playerBike);export const useRoadOffset=()=>useBikeRacingStore(e=>e.roadOffset);export const useParticleEffects=()=>useBikeRacingStore(e=>e.particleEffects);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import r from"react";import{Canvas as t,Circle as o,RoundedRect as h,Rect as c,Path as e,Skia as i}from"@shopify/react-native-skia";import a,{useAnimatedStyle as l,withSpring as s}from"react-native-reanimated";import{jsx as f,Fragment as y,jsxs as d}from"react/jsx-runtime";const g=({x:r,y:g,width:n,height:x,color:w,isPlayer:m})=>{const p=l(()=>m?{transform:[{translateX:s(r,{damping:25,stiffness:150,mass:.8})},{translateY:g}]}:{transform:[{translateX:r},{translateY:g}]},[r,g,m]),k=n/2,b=.05*x,u=.25*x,W=.5*x,M=.8*x,j=.45*n,B=.75*n,C=.9*n,v=.65*n,X=.12*x,Y=.88*x,F=.22*n,P=.1*x,q=C/2-F/2;return f(a.View,{style:[{position:"absolute",width:n,height:x},p],children:d(t,{style:{width:n,height:x},children:[f(h,{x:k-C/2+4,y:b+4,width:C,height:.85*x,r:15,color:"rgba(0, 0, 0, 0.3)"}),f(h,{x:k-q,y:Y,width:F,height:P,r:4,color:"#4a4a4a"}),f(h,{x:k-q+2,y:Y+2,width:F-4,height:P-4,r:3,color:"#888888"}),f(h,{x:k-q+4,y:Y+4,width:F-8,height:P-8,r:2,color:"#cccccc"}),f(h,{x:k+q-F,y:Y,width:F,height:P,r:4,color:"#4a4a4a"}),f(h,{x:k+q-F+2,y:Y+2,width:F-4,height:P-4,r:3,color:"#888888"}),f(h,{x:k+q-F+4,y:Y+4,width:F-8,height:P-8,r:2,color:"#cccccc"}),f(e,{path:(()=>{const r=i.Path.Make();return r.moveTo(k-v/2,M),r.lineTo(k-C/2,W+.2*x),r.lineTo(k+C/2,W+.2*x),r.lineTo(k+v/2,M),r.close(),r})(),color:"#ffffff",style:"stroke",strokeWidth:3}),f(e,{path:(()=>{const r=i.Path.Make();return r.moveTo(k-v/2,M),r.lineTo(k-C/2,W+.2*x),r.lineTo(k+C/2,W+.2*x),r.lineTo(k+v/2,M),r.close(),r})(),color:w}),f(e,{path:(()=>{const r=i.Path.Make();return r.moveTo(k-v/2+5,M-5),r.lineTo(k-C/2+5,W+.2*x),r.lineTo(k+C/2-5,W+.2*x),r.lineTo(k+v/2-5,M-5),r.close(),r})(),color:"rgba(255, 255, 255, 0.2)"}),f(h,{x:k-C/2,y:W,width:C,height:.25*x,r:12,color:"#ffffff",style:"stroke",strokeWidth:3}),f(h,{x:k-C/2,y:W,width:C,height:.25*x,r:12,color:w}),f(o,{cx:k,cy:W+.12*x,r:.16*n,color:"#ffffff",style:"stroke",strokeWidth:2}),f(o,{cx:k,cy:W+.12*x,r:.16*n,color:m?"#ffffff":"#555555"}),f(h,{x:k-.11*n,y:W+.08*x,width:.22*n,height:.05*x,r:2,color:m?w:"#333333"}),f(h,{x:k-B/2,y:u,width:B,height:.2*x,r:10,color:w}),f(h,{x:k-.35*B,y:u+.02*x,width:.7*B,height:.06*x,r:5,color:"rgba(255, 255, 255, 0.35)"}),f(c,{x:k-.08*n,y:u,width:.16*n,height:.2*x,color:"rgba(0, 0, 0, 0.15)"}),f(e,{path:(()=>{const r=i.Path.Make();return r.moveTo(k-B/2,u),r.lineTo(k-j/2,b+.1*x),r.lineTo(k+j/2,b+.1*x),r.lineTo(k+B/2,u),r.close(),r})(),color:"#ffffff",style:"stroke",strokeWidth:3}),f(e,{path:(()=>{const r=i.Path.Make();return r.moveTo(k-B/2,u),r.lineTo(k-j/2,b+.1*x),r.lineTo(k+j/2,b+.1*x),r.lineTo(k+B/2,u),r.close(),r})(),color:w}),f(e,{path:(()=>{const r=i.Path.Make();return r.moveTo(k-B/2+5,u),r.lineTo(k-j/2+3,b+.12*x),r.lineTo(k+j/2-3,b+.12*x),r.lineTo(k+B/2-5,u),r.close(),r})(),color:"rgba(255, 255, 255, 0.25)"}),f(h,{x:k-q,y:X,width:F,height:P,r:4,color:"#4a4a4a"}),f(h,{x:k-q+2,y:X+2,width:F-4,height:P-4,r:3,color:"#888888"}),f(h,{x:k-q+4,y:X+4,width:F-8,height:P-8,r:2,color:"#cccccc"}),f(h,{x:k+q-F,y:X,width:F,height:P,r:4,color:"#4a4a4a"}),f(h,{x:k+q-F+2,y:X+2,width:F-4,height:P-4,r:3,color:"#888888"}),f(h,{x:k+q-F+4,y:X+4,width:F-8,height:P-8,r:2,color:"#cccccc"}),f(e,{path:(()=>{const r=i.Path.Make();return r.moveTo(k-j/2,b+.08*x),r.lineTo(k,b),r.lineTo(k+j/2,b+.08*x),r.close(),r})(),color:w}),f(h,{x:k-.15*n,y:b+.02*x,width:.3*n,height:.04*x,r:3,color:"#ffff99"}),f(h,{x:k-.12*n,y:b+.025*x,width:.24*n,height:.025*x,r:2,color:"#ffffdd"}),f(o,{cx:k-C/2-3,cy:u+.1*x,r:.08*n,color:"rgba(100, 200, 255, 0.4)"}),f(o,{cx:k+C/2+3,cy:u+.1*x,r:.08*n,color:"rgba(100, 200, 255, 0.4)"}),f(o,{cx:k-C/2-3,cy:u+.1*x,r:.08*n,color:w,style:"stroke",strokeWidth:2}),f(o,{cx:k+C/2+3,cy:u+.1*x,r:.08*n,color:w,style:"stroke",strokeWidth:2}),f(h,{x:k+v/2-.1*n,y:M-.08*x,width:.07*n,height:.06*x,r:3,color:"#555555"}),f(h,{x:k+v/2-.1*n+1,y:M-.08*x+1,width:.05*n,height:.04*x,r:2,color:"#333333"}),m&&d(y,{children:[f(o,{cx:k+v/2-.07*n,cy:M+.01*x,r:3,color:"rgba(150, 150, 150, 0.5)"}),f(o,{cx:k+v/2-.07*n,cy:M+.04*x,r:4,color:"rgba(150, 150, 150, 0.35)"}),f(o,{cx:k+v/2-.07*n,cy:M+.08*x,r:5,color:"rgba(150, 150, 150, 0.2)"})]}),m&&f(h,{x:k-.1*n,y:W+.18*x,width:.2*n,height:.06*x,r:3,color:"rgba(255, 255, 255, 0.95)"}),f(h,{x:k-.08*n,y:M-.02*x,width:.16*n,height:.02*x,r:2,color:"#ff3333"})]})})},n=(r,t)=>Math.floor(r.x)===Math.floor(t.x)&&Math.floor(r.y)===Math.floor(t.y)&&r.width===t.width&&r.height===t.height&&r.color===t.color&&r.isPlayer===t.isPlayer;export const BikeComponent=r.memo(g,n);BikeComponent.displayName="BikeComponent";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import t from"react";import{Canvas as r,Rect as e,LinearGradient as o,vec as i,Line as h}from"@shopify/react-native-skia";import{BIKE_RACING_COLORS as s,BIKE_RACING_GAME_CONFIG as n}from"../BikeRacingConstants.js";import{jsx as c,jsxs as a}from"react/jsx-runtime";const d=({width:d,height:l,roadOffset:m})=>{const p=n.LANE_WIDTH*n.ROAD_LANES,g=(d-p)/2,k=g,u=m%40;return a(r,{style:{width:d,height:l},children:[c(e,{x:0,y:0,width:d,height:l,children:c(o,{start:i(d/2,0),end:i(d/2,l),colors:[s.SKY_BLUE,"#b0e0e6"]})}),c(e,{x:0,y:0,width:k,height:l,children:c(o,{start:i(0,0),end:i(k,0),colors:[s.GRASS_DARK,s.GRASS_GREEN]})}),c(e,{x:g+p,y:0,width:k,height:l,children:c(o,{start:i(0,0),end:i(k,0),colors:[s.GRASS_GREEN,s.GRASS_DARK]})}),c(e,{x:g,y:0,width:p,height:l,color:s.ROAD_DARK}),[1,2].map(r=>{const e=g+r*n.LANE_WIDTH,o=Math.ceil(l/40)+1;return c(t.Fragment,{children:Array.from({length:o}).map((t,o)=>{const n=40*o-u;return c(h,{p1:i(e,n),p2:i(e,n+30),color:s.ROAD_LINE,strokeWidth:2},`line-${r}-${o}`)})},"lane-"+r)}),c(h,{p1:i(g,0),p2:i(g,l),color:s.ROAD_LINE,strokeWidth:3}),c(h,{p1:i(g+p,0),p2:i(g+p,l),color:s.ROAD_LINE,strokeWidth:3})]})},l=(t,r)=>t.width===r.width&&t.height===r.height&&Math.floor(t.roadOffset/5)===Math.floor(r.roadOffset/5);export const GameBackground=t.memo(d,l);GameBackground.displayName="GameBackground";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import e from"react";import{View as t,Text as r,StyleSheet as o}from"react-native";import{ScoreBoardContainer as n}from"../../../helpers/index.js";import{BIKE_RACING_COLORS as i}from"../BikeRacingConstants.js";import{useScore as l,useTimeLeft as c,useLives as s}from"../BikeRacingStore.js";import{jsx as f,jsxs as a}from"react/jsx-runtime";export const ScoreBoard=e.memo(({offset:o=0})=>{const i=l(),m=c(),h=s(),g=e.useMemo(()=>{const e=m%60;return`${Math.floor(m/60).toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`},[m]);return f(n,{offset:o,backgroundColor:"rgba(255, 102, 0, 0.4)",borderColor:"rgba(255, 102, 0, 0.4)",children:a(t,{style:d.rowContainer,children:[a(t,{style:d.scoreSection,children:[f(r,{style:d.label,children:"SCORE"}),f(r,{style:d.value,children:i})]}),a(t,{style:d.timeSection,children:[f(r,{style:d.label,children:"TIME"}),f(r,{style:[d.value,10>=m&&d.timeWarning],children:g})]}),a(t,{style:d.livesSection,children:[f(r,{style:d.label,children:"LIVES"}),f(t,{style:d.heartsContainer,children:Array.from({length:3}).map((e,t)=>f(r,{style:d.heartIcon,children:h>t?"\u2764\ufe0f":"\ud83d\udda4"},t))})]})]})})});ScoreBoard.displayName="ScoreBoard";const d=o.create({rowContainer:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%"},scoreSection:{flex:1,alignItems:"center"},timeSection:{flex:1,alignItems:"center"},livesSection:{flex:1,alignItems:"center"},label:{fontSize:16,fontWeight:"bold",color:"#ffffff",marginBottom:4,letterSpacing:.5},value:{fontSize:25,fontWeight:"bold",color:"#ffffff"},timeWarning:{color:i.UI},heartsContainer:{flexDirection:"row",gap:4},heartIcon:{fontSize:22}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{BikeComponent}from
|
|
1
|
+
"use strict";export{BikeComponent}from"./BikeComponent.js";export{GameBackground}from"./GameBackground.js";export{ScoreBoard}from"./ScoreBoard.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{BikeRacing}from
|
|
1
|
+
"use strict";export{BikeRacing}from"./BikeRacing.js";export{BikeRacingService}from"./BikeRacingService.js";export{useBikeRacingStore}from"./BikeRacingStore.js";export*from"./BikeRacingConstants.js";
|