This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-07-15 10:31:01

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Ammunition Variable.

I need help on the variable that uses ammo.I want it so if i run out ammo i cant shoot,and if i find ammunition i can use the gun again.

Offline

 

#2 2008-07-15 10:51:43

Fireicedude
Scratcher
Registered: 2007-10-24
Posts: 43

Re: Ammunition Variable.

keroro645 wrote:

I need help on the variable that uses ammo.I want it so if i run out ammo i cant shoot,and if i find ammunition i can use the gun again.

This is really simple.

1. Create a variable called Ammunition or ammo or whatever you want to call it.
2. Have a sprite that is the ammo.
3. When <player> is touching ammo set ammunition to 100. Then for the ammo sprite, if touching player hide. 

That'll fix your reloading issue, but for the "not being able to shoot thing" try this:
This will make it so you have an on/off thing for the shooting.

Create a new variable called (shooting?)

If <shooting?> = 1 then if space key pressed broadcast bullet

So now you can only shoot when shooting? = 1

Now we will combine the variables.

If ammo = 0 set shooting to zero.

Hope that helped. If you need me to explain it a little better or organize it better, just ask.  wink

If you would prefer, you can download a project of mine that has the same ideas. Its about getting fuel for your jetpack, pretty much the same thing as reloading. http://scratch.mit.edu/projects/Fireicedude/154879

Last edited by Fireicedude (2008-07-15 10:54:50)

Offline

 

#3 2008-07-15 12:09:09

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Ammunition Variable.

This really helped.
Thanks

Last edited by keroro645 (2008-07-15 12:09:20)

Offline

 

#4 2008-07-15 14:11:58

Fireicedude
Scratcher
Registered: 2007-10-24
Posts: 43

Re: Ammunition Variable.

keroro645 wrote:

This really helped.
Thanks

Welcome!

Offline

 

#5 2008-07-15 14:13:28

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Ammunition Variable.

Offline

 

#6 2008-07-15 14:17:25

Fireicedude
Scratcher
Registered: 2007-10-24
Posts: 43

Re: Ammunition Variable.

keroro645 wrote:

Check it out.

Wow! It turned out really nice. I like how its set up.

Offline

 

#7 2008-07-15 23:48:25

stuntman021
Scratcher
Registered: 2008-07-15
Posts: 8

Re: Ammunition Variable.

What about hitting a single target?

Offline

 

#8 2008-07-16 09:10:32

Fireicedude
Scratcher
Registered: 2007-10-24
Posts: 43

Re: Ammunition Variable.

stuntman021 wrote:

What about hitting a single target?

You need help with that? or are you suggesting that?

Offline

 

Board footer