Learn Create Your Own Split Screen

Next Page

We're going to display how many berries are left for the spider to find.

If we wanted to make the game more interesting, we'd maybe also have a timer that counts down, so you have to find as many berries as you can in 30 seconds or something. And we'd place the berries randomly. But our goal here is not to build a full game -- you can do that later.

We have a fruit array, and if I'd coded the program differently, checking the length of the fruit array would tell us how many berries are left.

But recall I took the decision to leave dead fruit in the array so I could display red smears where their juicy remains lay. So we can't use the length directly.