Virtual Pet Game Template
  • VIRTUAL PET GAME TEMPLATE
  • Getting Started
    • 🎯 Project Setup Guide
    • 🧩 Home Scene Overview
    • 🗺️ UI Main Menu
    • 🗺️ LoadingManager
    • 🗺️ GameInstance
    • 🗺️ ToolsManager
    • 🗺️ AudioManager
    • 🗺️ LanguageManager
    • 🗺️ MonetizationManager
    • 🗺️ PlayerSave
  • Modifying the project
    • 🐾 How to Add a New Pet
    • 📜How Add a New Pet Rules
    • 💰 How to Add a New Currency
    • 🍎 How to Add a New Food Item
    • 🧢 Adding a New Accessory
    • 🎮 How to Add a New Minigame
  • Modifying Minigames
    • 🌤️ Minigame "Jump Sky"
    • 🍔 Minigame "Food Flicker"
    • 🐦 Minigame “Flappy”
    • 💎 Minigame “Gem Hunter”
Powered by GitBook
On this page
  • 🎮 Core Gameplay Summary
  • 🧱 Pipe Configuration
  • 🐦 Flappy Player Settings
  • ⭐ Adding Score Triggers
  • 🎬 Game Flow
  • 🛠 How to Modify the Game
  • 📦 Summary
  1. Modifying Minigames

🐦 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:

Property
Description

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

Field
Description

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:

Field
Description

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:

MiniGameFlappy.Instance.AddScore(1);

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 the EndGamePopup.

  • Restart() – Reloads the current scene.

  • Exit() – Returns to the Home screen.

Reward and best score are stored via:

endGamePopup.Initialize(score, rewardCurrencyId, score, won, "FlappyGame");

🛠 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 in PipeSpawner.

✅ To Change Pet Behavior

  • Adjust maxFlapForce and chargeDuration in FlappyPlayerController.


📦 Summary

Action
Where to Edit

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)

Previous🍔 Minigame "Food Flicker"Next💎 Minigame “Gem Hunter”

Last updated 28 days ago