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

#1 2012-05-27 10:50:38

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Make something hide after touching something more than once?

In a game I'm working on, you need to shoot a zombie three times before it dies. How can you do this. For the projectile, I tried this script with multiple zombies, but it didn't work.
The projectile:

When gf clicked
forever
if <touching [zombie1 v]>
hide
change [shots v] by (1)
end
The Zombie
When gf Clicked
Forever
if <shots = (3)>
hide
end
The only difference between the script for other zombies was that I called the variable other things for each of them, like shots 1, shots 2, etc.
I'd appreciate all the help I can get! Thanks!  big_smile


http://i48.tinypic.com/2072ctw.gif

Offline

 

#2 2012-05-27 11:03:25

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: Make something hide after touching something more than once?

Just add a

wait until <not <touching [zombie1 v]?>>
at the bottom of your 'if' in the projectile's script.

Last edited by SciTecCf (2012-05-27 11:03:39)


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#3 2012-05-28 02:14:33

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: Make something hide after touching something more than once?

powerpoint56 wrote:

In a game I'm working on, you need to shoot a zombie three times before it dies. How can you do this. For the projectile, I tried this script with multiple zombies, but it didn't work.
The projectile:

When gf clicked
forever
if <touching [zombie1 v] ? >
hide
change [shots v] by (1)
wait until <not <touching [zombie1 v]?>>
end
The Zombie
When gf clicked
forever
if < (shots) = (3) >
hide
end
The only difference between the script for other zombies was that I called the variable other things for each of them, like shots 1, shots 2, etc.
I'd appreciate all the help I can get! Thanks!  big_smile

Fixed, and added SciTecCf's script.


http://trinary.tk/images/signature_.php

Offline

 

Board footer