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

#1 2011-10-18 00:30:02

Trev92
New Scratcher
Registered: 2011-10-17
Posts: 6

Need help with zombie game?

I have it set so when you get a math equation right, you get 1 point, and when you shoot you loose one point of ammunition.  I can't for the life of me figure out how to make it so you can't shoot when you get to 0 for ammunition(which includes stopping the gunfire, and the muzzle flash).  I've been trying for about an hour and it just doesn't want to work, any help would be greatly appreciated. Also, in my code I have...

Ask(join(what is)(x+y)and wait. 

with this the zombie says "what is6" and gives the answer, how would I hide that one as well? thank you anyone

Offline

 

#2 2011-10-18 00:54:11

Fordark
Scratcher
Registered: 2010-08-02
Posts: 100+

Re: Need help with zombie game?

For the shooting problem, use the if block.
[if (ammo > 0)]
[do this]
possibly [else] if you want it to do something when it's out of ammo.

The (x + y) block makes Scratch compute the value and states the value of that problem. For example if I want it to say what the answer to 4 + 4 is, then I would use that block. However, if I want it to just say "4 + 4", then you would type it out instead of using the ( + ) block.
To state the question itself, you have to join the join blocks.
(join [What is](join [x](join [+][y])


http://dl.dropbox.com/u/34855482/Fordarksig.png

Offline

 

#3 2011-10-18 00:58:54

Trev92
New Scratcher
Registered: 2011-10-17
Posts: 6

Re: Need help with zombie game?

when I do the If/Else statement for the shooting problem, should I make it so when ammo<=0 it needs to stop the script or what? What I had for that was
If Ammo<0
stop script
but every time I clicked it still shot, so I'm very lost :s

Offline

 

#4 2011-10-18 01:12:59

Fordark
Scratcher
Registered: 2010-08-02
Posts: 100+

Re: Need help with zombie game?

Trev92 wrote:

when I do the If/Else statement for the shooting problem, should I make it so when ammo<=0 it needs to stop the script or what? What I had for that was
If Ammo<0  <--- That's your problem. You set it to ammo < 0, which you shoot if the ammo is less than zero. You need to set it to ammo > 0, so that it does the execution if ammo is 1 or higher.
stop script
but every time I clicked it still shot, so I'm very lost :s

You don't have to make an else script, it could just be a simple  [if ammo > 0] script.


http://dl.dropbox.com/u/34855482/Fordarksig.png

Offline

 

#5 2011-10-18 01:37:01

Trev92
New Scratcher
Registered: 2011-10-17
Posts: 6

Re: Need help with zombie game?

even doing the ammo > 0 followed by stop script doesn't work.  I still continue to fire and the ammo counter goes into the negatives.
I'm trying to get it so that when you solve the problem, you get 1 bullet.  if you had 0 bullets before that you would now have one, and if you shot it you would be back to 0.  at that point you shouldn't be able to shoot anymore, or get negative bullets.  Here is the program if you want to look at the code

http://scratch.mit.edu/projects/Trev92/2089736

Offline

 

#6 2011-10-18 01:40:34

Trev92
New Scratcher
Registered: 2011-10-17
Posts: 6

Re: Need help with zombie game?

for the shooting bit, i have the normal code (when stage is clicked, change ammo count by -1) if ammo<0 stop script) and it seems like it should work, but it doesn't  sad

Offline

 

#7 2011-10-18 02:11:07

Trev92
New Scratcher
Registered: 2011-10-17
Posts: 6

Re: Need help with zombie game?

nvm I got the ammo deal, but I still cant get the zombie to stop saying the answer

Offline

 

#8 2011-10-18 20:12:24

Fordark
Scratcher
Registered: 2010-08-02
Posts: 100+

Re: Need help with zombie game?

Trev92 wrote:

nvm I got the ammo deal, but I still cant get the zombie to stop saying the answer

Fordark wrote:

The (x + y) block makes Scratch compute the value and states the value of that problem. For example if I want it to say what the answer to 4 + 4 is, then I would use that block. However, if I want it to just say "4 + 4", then you would type it out instead of using the ( + ) block.
To state the question itself, you have to join the join blocks.
(join [What is](join [x](join [+][y])


http://dl.dropbox.com/u/34855482/Fordarksig.png

Offline

 

Board footer