๐ Minigame "Food Flicker"
The Food Flicker minigame is a reflex-based game where the player catches falling food items while avoiding bad items. The gameplay progresses through multiple stages, each with its own difficulty.
๐ Overview
๐ Good Foods: Add score and gold when caught.
๐ Bad Foods: Penalize the player when caught or missed.
๐ช Coins: Grant additional gold.
๐ฅ Game Over: Triggered by too many missed foods or by completing all stages.
๐ How to Add New Stages
Each stage is defined using the StageDefinitionFoodFlick
ScriptableObject.
โ Creating a New Stage
Right-click in the Project window โ Create โ PetCareGame โ Minigame-FoodFlick โ Stage Definition
Configure the following properties:
spawnRate
Delay (in seconds) between item drops.
maxMissed
Max number of missed foods allowed before failure.
scoreThreshold
Score required to pass this stage.
goodFoodPrefabs
Array of prefabs considered "good" (to catch).
badFoodPrefabs
Array of prefabs considered "bad" (to avoid).
coinPrefab
The coin prefab to spawn occasionally.
coinChance
Probability [0โ1] of spawning a coin.
badFoodChance
Probability [0โ1] of spawning a bad food.
All prefabs must have a Collider2D and the script
FoodItemGame
attached.
๐ง Assigning Stages to the Spawner
Locate the
FoodDropSpawner
object in theMinigame_FoodFlick
scene.Drag and drop your new
StageDefinitionFoodFlick
asset(s) into thestages
list in the Inspector.
The game will transition between stages as the player scores enough points (
scoreThreshold
).
๐งฉ Editing or Creating New Food Prefabs
All food items must have:
A Collider2D with
isTrigger
enabled.The
FoodItemGame
script attached.Tag: Untagged (can vary depending on how it's used).
Layer: optional, but ensure proper collision.
Set the following on FoodItemGame
:
foodType
: Good or Bad.scoreValue
: Score the item grants when caught.catchSound
/missSound
: Optional SFX.
๐ฎ Player Movement & Controls
Player logic is handled by FoodPlayerController
. You can:
Change movement speed via
moveSpeed
.Adjust horizontal limits with
maxXPosition
.
The pet model is instantiated at runtime using
GameInstance.Instance.InstantiatePetModel()
inside the controller.
๐ Ending the Game
The game ends in two scenarios:
The player catches enough food to meet the last stageโs
scoreThreshold
(win).The player misses too many items (
maxMissed
reached) (lose).
Upon ending:
Final score and gold are shown.
Coins are added to the player using
PlayerSave.AddCoin()
.Best score is saved via
PlayerSave.SetBestScore("FoodFlick", currentScore);
๐ Summary Checklist
โ
New stage created using StageDefinitionFoodFlick
โ
Assigned to the FoodDropSpawner.stages
list
โ
Food prefabs properly configured with FoodItemGame
โ
Game auto-transitions between stages based on score
โ
Game over occurs on fail or final stage completion
Last updated