Trading Lives For Time Function

BlitzPlus Forums/BlitzPlus Beginners Area/Trading Lives For Time Function

shmup(Posted 2013) [#1]
I'd like to alter the following code so that instead of ending the game if you trade your last life for time, it will prevent you from doing so when you are on your last life. Therefore, hitting the space-bar when you only have one life left will do nothing.

;#####################################################
; LivesForTime() - Let the player trade life for time
;#####################################################
;
Function LivesForTime()

If KeyHit(57) Then

lives=lives-1
seconds=seconds+10

If lives < 1 Then game_over = True

End If

End Function

Ending the game by trading your last life for time is pointless, so my current code does need an overhaul! Any advice, most appreciated.

--
shmup


Who was John Galt?(Posted 2013) [#2]
Think in English-

if the key is hit AND you have > one life, decrease lives by one and add 10 seconds.


shmup(Posted 2013) [#3]
Oh wow!

/me slaps forehead and turns beetroot...

Thanks John.


Who was John Galt?(Posted 2013) [#4]
No need for the vegetable impression, it wasn't a stupid question. :)