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.


;Extra lives definition at start of your program
global extralife_at[5]
extralife_at[0] = 10000
extralife_at[1] = 25000
extralife_at[2] = 50000
extralife_at[3] = 100000
extralife_at[4] = 200000
global extralife_id

extralife_id = 0 ;Reset to the first extra life score

;In your game
if extralife_id < 5 then ;Avoid an array overflow
   if score >= extralife_at[extralife_id] then
      lives = lives + 1
      extralife_id = extralife_id + 1 ;Point to the next extra life score
   endif
endif