yeah, that would be cloning, which is only in the scratch 2.0 beta.
With 1.6 (It's 1.6, right?) you could only do this through having a bunch of copies of the zombie, so "zombie", "zombie1", "zombie2", etc.
and then using
<<>or<>>so that it will detect if touching any of the zombies.
Offline
xlk wrote:
yeah, that would be cloning, which is only in the scratch 2.0 beta.
With 1.6 (It's 1.6, right?) you could only do this through having a bunch of copies of the zombie, so "zombie", "zombie1", "zombie2", etc.
and then using<<>or<>>so that it will detect if touching any of the zombies.
It's 1.4, not 1.6 xD. Yeah, follow his advice and you can use multiple 'or' blocks too.
<<>or<<<>or<>>>>The red isn't supposed to be there, woops.
Offline
no i mean like what happends i have that same script for a bullet but what happends after it touches the other sprite (a zombie ) the zombie dissapears but the bullets keeps going and makes the other sprites (more zombie dissapear too ) i dont know how to make it not do that like in term make a bullet sprite only touch 1 zombie and thats its and killing it what happends 1 bullet kills all the zombie in a row that are in a front line
Offline
Instead of using multiple "or" inputs, which would be a hassle if you had multiple zombies, you could put something like this in the bullet's script:
repeat until <<touching [edge v]> or <touching color [zombie's color]>> move [number of steps] end if <touching [edge v]> hide end if <touching [zombie's color]> hide change [score v] by [1] endThat would work, assuming that you don't have anything the same color as the zombie on the stage. You could also put the "change score" block in the zombie if you don't want it in the bullet like this:
if <touching [bullet v]> hide change [score v] by [1] endOf course, you would change the "bullet" part to whatever the name of your bullet sprite is.
Last edited by cobraguy (2013-04-09 20:58:31)
Offline
i get it but the problem im getting is the the bullet is always going straight after it touches the color but instead of normal is hiding but it keeps going making all the other zombies hide too.
Let me explain it to you better , im making a 2d zombie game where you have a main sprite the survivor and hes staying at a place while zombies go after him and the zombies come in a straight line from the left , im getting the problem that the bullet sprite kills al the zombie with only 1 shot ( makes all the zombie sprite go hiding ) i want that the shot bullet sprite only makes 1 zombie hide
Offline
for bullet:
IF touching colour <zombie's colour> hide
Offline
How about this script in the zombies:
if <touching [bullet v]?> broadcast [hide bullet v]Then this in the bullet:
When I receive [bullet hide v] hideIf that doesn't work, then you could have a variable to say if the bullet is "allowed" to kill a zombie.
Offline
I have made a game very similar to this you are trying to achive. Its called survive the night. click my name, then go to 'survive the night, then download and look through the scripts. It has exactly what you should need. good luck!
Offline