I have a shooter game I'm making. And I have an Ammo variable. I'm trying to make it so that when the score reaches 0, you can't shoot and the score can't go below 0.
Anybody know how I can do this?
Offline
matthewlowery wrote:
I have a shooter game I'm making. And I have an Ammo variable. I'm trying to make it so that when the score reaches 0, you can't shoot and the score can't go below 0.
Anybody know how I can do this?
[blocks]<when green flag clicked>
<forever if><( <{ AMMO }> <<> 0 )>
<set{ AMMO }to( 0
<end>
<when[ shoot key ]key pressed>
<if><( <{ AMMO }> <>> 0 )>
[insert shooting scripts here]
<end>[/blocks]
Last edited by technoguyx (2009-02-05 08:10:35)
Offline
all you have to do is
<when green flag clicked>
<forever if> <( <{ score }> <<> 0 )>
<set{ ammo }to( 0
<end>
Offline
If using space to shoot, use this:
<when green flag clicked>
<forever>
<if> <key[ Space ]pressed?>
Change Ammo by -1
<if> <( Ammo <>> 0 )>
Do Shoot Actions
<end>
<end>
<end>
You can replace the When Flag Clicked, Forever, If with a When Space Key Pressed if you want.
Last edited by Zelda123 (2009-02-05 12:17:50)
Offline