Variables and scores - Newly guides

Open the Bubble Pop tap game, find the score variable, change what things are worth, and add a bonus rule.

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:

Test the edge: what happens at exactly 0? At exactly 20?

Done when

Open on Newly