Where does the score live?
Bubble Pop keeps your score in a variable: a named box the program reads and changes. Today you'll find it, change the rules, and add one of your own.
1. Play a round
Press Play. Pop bubbles. Gold ones are worth more; spiky ones cost you. Notice the clock.
2. Find the variable
Open Game.cs (select the Game object, then Script). Near the top:
```csharp
var score = 0;
```
That's the box. Use Find (Ctrl+F) for score and look at every line it's on. Sort them into two piles: lines that change it (score += 1) and lines that only read it (ShowScore).
3. Change the rules
In Properties change Seconds to 15 and Speed to 5. Play. Faster, shorter.
Now in Pop:
```csharp
score += b.Name == "GoldBubble" ? 5 : 1;
```
Make gold worth 10. Before you press Play, say out loud what the score will be after one gold pop.
4. Add your own rule
Pick one and write the if for it:
- Reaching 20 points adds 5 seconds to the clock:
if (score >= 20) seconds += 5; - A spiky bubble at 0 points ends the round early.
- Every fifth pop is worth double (a
popscounter andpops % 5 == 0).
Test the edge: what happens at exactly 0? At exactly 20?
Done when
- You can point at where
scoreis declared, changed and shown. - Two values are different from the original, and you predicted their effect first.
- One new
ifrule works and you tested its edge case.