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

#1 2010-05-19 17:54:12

adiguy17
Scratcher
Registered: 2010-05-04
Posts: 17

How to make a sprite run out of ammo

I was wonder how to stop a sprite from shooting a gun if it runs out of ammo. I already made a variable call "Ammo" and made it reduce by 1 if it shoots. Help me please.

Offline

 

#2 2010-05-19 17:56:03

Ratty1967UK
Scratcher
Registered: 2007-05-16
Posts: 88

Re: How to make a sprite run out of ammo

you're almost there... all you need to do now is to stop your ammo from shooting when "Ammo = 0"

Offline

 

#3 2010-05-19 18:27:50

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How to make a sprite run out of ammo

This is not an advanced topic!!!


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#4 2010-05-19 18:43:45

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: How to make a sprite run out of ammo

ScratchReallyROCKS wrote:

This is not an advanced topic!!!

Who's to say what's "advanced"?

Code:

When I receive "fire":
  if <not (ammo < 1) >:
    change ammo by -1
    //do your firing stuff here

Hope this helps!


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#5 2010-05-19 19:24:31

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How to make a sprite run out of ammo

fullmoon wrote:

Who's to say what's "advanced"?

I'm not saying it's a bad topic, I just think it should go in the 'All About Scratch' category.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#6 2010-05-20 05:21:41

Ratty1967UK
Scratcher
Registered: 2007-05-16
Posts: 88

Re: How to make a sprite run out of ammo

ScratchReallyROCKS wrote:

fullmoon wrote:

Who's to say what's "advanced"?

I'm not saying it's a bad topic, I just think it should go in the 'All About Scratch' category.

it's a fair point... not exactly rocket science this one  smile

Offline

 

#7 2010-05-20 16:22:09

TheSaint
Scratcher
Registered: 2008-11-04
Posts: 1000+

Re: How to make a sprite run out of ammo

Ratty1967UK wrote:

ScratchReallyROCKS wrote:

fullmoon wrote:

Who's to say what's "advanced"?

I'm not saying it's a bad topic, I just think it should go in the 'All About Scratch' category.

it's a fair point... not exactly rocket science this one  smile

To that person though, it may seem like an "advanced" question. This is all based on perspective, and the title "advanced" is a little ambiguos.

Offline

 

#8 2010-05-20 16:51:13

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How to make a sprite run out of ammo

TheSaint wrote:

To that person though, it may seem like an "advanced" question. This is all based on perspective, and the title "advanced" is a little ambiguos.

Yes but I have seen a lot of topics like this that have been moved and this one probably will too. No offense. And by comparison to the other topics in this forum, this is not really advanced.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#9 2010-05-21 02:09:24

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: How to make a sprite run out of ammo

Don't worry - posting a thread in the wrong forum and getting it moved isn't a bad thing.  smile
....................................
Use this in the script that fires the bullet:

if <ammo > 0>
   firing
   scripts
   go
   here
endif


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

Board footer