Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » enemy spawn script
- thor-tcg
- Scratcher
8 posts
enemy spawn script
im trying to make a script which spawns enemies on the edge and they walk towards you, i did it a while back but i dont remember how i did it, please help
- orangetheory
- Scratcher
500+ posts
enemy spawn script
We can use clones to do this.
when green flag clicked
hide
forever
create clone of [myself v]
wait (delay) secs
end
when I start as a clone
show
go to x: (-190 or 190, whatever x you want::grey) y: (pick random (180) to (-180))
repeat until <<touching [weapon v] > or <touching [player v] >>
point towards [player v]
move (speed::grey) steps
end
delete this clone
-Frisbee- -Cricket--Basketball--Forums--Mapping--Coding--Trigonometry master--Mathematics King--Future Prime Minister--Intro-Maker-
I know HTML/CSS, and JavaScript, and with these coding skills I have made some decent projects! Test them out below!
~Archery~Cops + Robbers~
Want an intro, outro, music, effects, or more? Check out the intro shop!
The forum helpers, a place where we help people in the forums
- thor-tcg
- Scratcher
8 posts
enemy spawn script
it works fine but they only spawn on one side @orangetheory
Last edited by thor-tcg (Aug. 22, 2021 15:51:34)
- Thingied
- Scratcher
1000+ posts
enemy spawn script
Can you link the project that has the script? Can't find anything wrong with the script so might have done something wrong. it works fine but they only spawn on one side @orangetheory
- thor-tcg
- Scratcher
8 posts
enemy spawn script
https://scratch.mit.edu/projects/562495529/Can you link the project that has the script? Can't find anything wrong with the script so might have done something wrong. it works fine but they only spawn on one side @orangetheory
- Thingied
- Scratcher
1000+ posts
enemy spawn script
my brain died :(
Replace the go to block with this:
Replace the go to block with this:
if <(pick random(1)to(2)) = [1]> then
if <(pick random(1)to(2))=[1]> then
set x to (244)
else
set x to (-244)
end
set y to (pick random(180)to(-180))
else
if <(pick random(1)to(2))=[1]> then
set y to (180)
else
set y to (-180)
end
set x to (pick random(244)to(-244))
end
- thor-tcg
- Scratcher
8 posts
enemy spawn script
my brain died :(thanks man
Replace the go to block with this:if <(pick random(1)to(2)) = [1]> then
if <(pick random(1)to(2))=[1]> then
set x to (244)
else
set x to (-244)
end
set y to (pick random(180)to(-180))
else
if <(pick random(1)to(2))=[1]> then
set y to (180)
else
set y to (-180)
end
set x to (pick random(244)to(-244))
end
- orangetheory
- Scratcher
500+ posts
enemy spawn script
That's not my problem, just change the x position it works fine but they only spawn on one side @orangetheory
-Frisbee- -Cricket--Basketball--Forums--Mapping--Coding--Trigonometry master--Mathematics King--Future Prime Minister--Intro-Maker-
I know HTML/CSS, and JavaScript, and with these coding skills I have made some decent projects! Test them out below!
~Archery~Cops + Robbers~
Want an intro, outro, music, effects, or more? Check out the intro shop!
The forum helpers, a place where we help people in the forums
- Discussion Forums
- » Help with Scripts
- » enemy spawn script