How to give the player an extra life?

Blitz3D Forums/Blitz3D Beginners Area/How to give the player an extra life?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'd suggest not doing what Stayne suggests as he replaces one error with another. His won't award an extra life unless your score stops dead on 25,000. If it goes from 24,999 to 25,001 then you don't get an extra life. It works fine in his example because he hardcodes the score so that it only ever increases by 100, but if you just copy it into your game and go, you may not immediately notice the problem until you start changing the scores.

Rather I would have a function which awards points:

Function AwardPoints(Pts%)
   If PlayerScore<25000
      If PlayerScore+Pts>=25000
         PlayerLives=PlayerLives+1
      End If
   End If
   PlayerScore=PlayerScore+Pts
End Function