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

#1 2008-06-09 20:26:40

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

Variables?

I need help with variables.In this Shooter i want it so that when the ammo variable reaches 0 you cant shoot no more.

Offline

 

#2 2008-06-09 20:40:09

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: Variables?

On Sprite 6:

When Flag Clicked:

Set ammo to 100.

Forever
hide
go to character
point towards mouse pointer
     If  mouse down?
     If ammo > 0
     Change ammo by -1
     Show
         Repeat until touching edge
         Move 40 steps.


You can change the 100 to whatever number you want for how much ammo you want to be available.

Offline

 

#3 2008-06-09 20:53:36

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

Re: Variables?

I updated it Look at it now.

Offline

 

#4 2008-06-09 21:02:02

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

Re: Variables?

Yeah i want it so that  the gun would stop shooting after the ammo variable goes to 0 .i need the script.

Offline

 

#5 2008-06-09 21:13:56

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Variables?

Put the shooting script in one of these:

[blocks]<forever>[/blocks]
[blocks]<if><( <{ Ammo  }> <>> 100 )>[/blocks]
[blocks]<{ Do your shooting script  }>[/blocks]
[blocks]<end>[/blocks]


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#6 2008-06-09 21:54:53

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Variables?

And I really like how you aren't just  saying "How do I make this game?" but instead asking advice on different parts and pieces of your project


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#7 2008-06-10 11:36:33

dbal
Scratcher
Registered: 2007-07-19
Posts: 100+

Re: Variables?

keroro645 wrote:

I need help with variables.In this Shooter i want it so that when the ammo variable reaches 0 you cant shoot no more.

In case you still need help on variables, I explain a little about them in my online tutorials.  Just click on the Scratch link in my signature.


Dick Baldwin - Don't get stuck scratching. When you master Scratch, move on up to more serious programming languages. Free online programming tutorials:
Scratch - Alice - Java - C# - C++ - JavaScript - XML - Python - DSP

Offline

 

Board footer