🐦 Minigame “Flappy”
The Flappy minigame is a classic side-scrolling obstacle dodging game. The player must keep the pet airborne and avoid pipe-like obstacles to increase their score.
🎮 Core Gameplay Summary
The player presses and holds to ascend with increasing flap force.
Releasing stops upward momentum.
Colliding with any object ends the game.
Points are earned by passing between pipes.
🧱 Pipe Configuration
Pipes are spawned by the PipeSpawner
script. You can edit the difficulty and pacing from this component:
pipePrefab
Prefab that represents a pipe (must include the PipeMoveLeft
script).
initialSpawnInterval
Time between pipe spawns at the start of the game.
initialPipeSpeed
How fast pipes move from right to left.
pipeSpawnYCenter
Vertical center for pipe spawning.
pipeSpawnYVariation
Random height offset added to each pipe spawn.
Difficulty Scaling
speedIncreaseInterval
How often (in seconds) the pipe speed increases.
pipeSpeedIncrement
How much the pipe speed increases each interval.
spawnRateIncreaseInterval
How often the spawn interval is reduced.
spawnIntervalReduction
How much the interval is reduced per change.
🐦 Flappy Player Settings
Controlled by the FlappyPlayerController
script:
maxFlapForce
The maximum vertical velocity when holding.
chargeDuration
Time required to reach maximum flap force.
holdCycleDelay
Cooldown before a new flap can be initiated.
Tips
Hold to build upward force gradually.
Use
AudioManager.Singleton.PlayAudio()
to play flap or hit sounds.Rigidbody2D must be attached, and gravity is enabled only after the game starts.
⭐ Adding Score Triggers
The ScoreTrigger
component is used on invisible trigger zones placed between pipes. When the player passes through:
Ensure these triggers:
Have a Collider2D set as trigger.
Use Tag = Player on the player GameObject.
🎬 Game Flow
Managed by MiniGameFlappy
:
StartGame()
– Called when player first taps to begin.AddScore(int amount)
– Called by trigger zones.GameOver(bool won)
– Ends the session and shows theEndGamePopup
.Restart()
– Reloads the current scene.Exit()
– Returns to the Home screen.
Reward and best score are stored via:
🛠 How to Modify the Game
✅ To Add or Modify Pipes
Edit the pipePrefab to change its appearance or collision shape.
Ensure it includes:
The
PipeMoveLeft
script.One or more
ScoreTrigger
objects placed in the gap between top and bottom pipes.
✅ To Change Difficulty
Tweak the
initialPipeSpeed
,spawnRateIncreaseInterval
, and scaling values inPipeSpawner
.
✅ To Change Pet Behavior
Adjust
maxFlapForce
andchargeDuration
inFlappyPlayerController
.
📦 Summary
Modify pipe speed and spawn rate
PipeSpawner
Change player physics
FlappyPlayerController
Adjust UI & scoring
MiniGameFlappy
Handle pet spawn
GameInstance.Instance.InstantiatePetModel()
Assign audio and VFX
In each respective component (UI, player, spawner)
Last updated