How to make the sound increase the note as it goes through a sequence, like the game Helix Jump

Hi, you need to save/set the number of passed rings (integer variable). Every time it passes a ring play the sound and increase the pitch of the sound.
And set the number count back to 0 if the sequence stops.