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

#1 2013-04-05 23:42:31

schobel
New Scratcher
Registered: 2013-03-21
Posts: 6

help with shooting scripl

how can i make a sprite be the same like i want to have bunch of zombies with the same name so i can use it in script like if touching hide

Offline

 

#2 2013-04-06 06:30:32

xlk
Scratcher
Registered: 2013-03-18
Posts: 57

Re: help with shooting scripl

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

 

#3 2013-04-06 11:04:15

7734f
Scratcher
Registered: 2010-12-23
Posts: 500+

Re: help with shooting scripl

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.


http://internetometer.com/image/38992.png   http://i37.tinypic.com/2qixx6c.png

Offline

 

#4 2013-04-09 17:17:53

schobel
New Scratcher
Registered: 2013-03-21
Posts: 6

Re: help with shooting scripl

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

 

#5 2013-04-09 20:53:34

cobraguy
Scratcher
Registered: 2009-11-18
Posts: 100+

Re: help with shooting scripl

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]
end 
That 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]
end
Of 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)


Fruit Fighter, when your food eats you.
http://i.imgur.com/8CR6Lnj.png?1

Offline

 

#6 2013-04-10 18:33:55

schobel
New Scratcher
Registered: 2013-03-21
Posts: 6

Re: help with shooting scripl

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

 

#7 2013-04-11 08:10:53

NamorTheFirst
New Scratcher
Registered: 2013-04-10
Posts: 60

Re: help with shooting scripl

for bullet:
IF touching colour <zombie's colour> hide

Offline

 

#8 2013-04-11 08:49:17

schobel
New Scratcher
Registered: 2013-03-21
Posts: 6

Re: help with shooting scripl

i have all those scrips but some how it still makes all the zombie dissapear D: im trying to work on it a project i need to make i was trying diferent scripts but still doesnt work

Offline

 

#9 2013-04-11 13:05:46

cobraguy
Scratcher
Registered: 2009-11-18
Posts: 100+

Re: help with shooting scripl

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]
hide
If that doesn't work, then you could have a variable to say if the bullet is "allowed" to kill a zombie.


Fruit Fighter, when your food eats you.
http://i.imgur.com/8CR6Lnj.png?1

Offline

 

#10 2013-04-11 13:14:24

Bowser_Jr
Scratcher
Registered: 2012-04-06
Posts: 100+

Re: help with shooting scripl

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.  big_smile  good luck!


http://i1323.photobucket.com/albums/u591/ryan_hope1/e5e4c157-0449-4aae-ac37-a2cfaef18e90_zps1bd763f0.jpg

Offline

 

Board footer