Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make a seeking projectiles shoot at clones
- glitchiestofthemall
- Scratcher
100+ posts
How to make a seeking projectiles shoot at clones
my seeking projectiles shoot in 1 place because its following the original sprite but never the clones how do I make it shoot 3 bullets and all 3 bullet will seek the zombies but wont all seek the same one
when I receive [ wakeup]
if <[happy] = [true]> then
set [ work on scratch] to [true]
else
move (0) steps
end
- ludum_factorem9823
- Scratcher
6 posts
How to make a seeking projectiles shoot at clones
Hi!
To do this is sadly not very easy. It involves having to update each clone's X and Y positions and store them in a list. Only then can you add a script to shoot toward that location. I would be happy to give more information if you want!
-Ludum_Factorem9823
To do this is sadly not very easy. It involves having to update each clone's X and Y positions and store them in a list. Only then can you add a script to shoot toward that location. I would be happy to give more information if you want!
-Ludum_Factorem9823
- LFF2004
- Scratcher
66 posts
How to make a seeking projectiles shoot at clones
Or you might be able to do it using Griffpatch's video on youtube called Code Ai swarms you could make it where a missile clone starts tracking the zombies when they get close enough.
It might work… but I hope this helps you
-LFF2004
It might work… but I hope this helps you
-LFF2004
If you like multiplayer and/or shooter games then this is the studio for you!
A studio where you can share multiplayer games and shooter games!
And where you can find multiplayer games and shooter games!
Unfortunately… there are not much games in the studio yet
If you like those kind of games, then please give it support by adding games to it!
I hope that it will soon be full of multiplayer and/or shooter games!
But I need your help…
Click here to go to the studio.
Thank you!
- -Qlec-
- Scratcher
100+ posts
How to make a seeking projectiles shoot at clones
when I start as a cloneWhenever you change the clone's position, you have to run the “update position” custom block within the clone script. Next, you should set this code as the projectile code (feel free to modify how much it moves). Use the pointing code demonstrated below:
update position :: custom
define update position
add (x position) to [clone x v]
add (y position) to [clone y v]
define point towards x: (target x) y: (target y)
point in direction ([atan v] of (((target x) - (x position)) / ((target y) - (y position)))
if <(target y) < (y position)> then
turn cw (180) degrees
end
... :: hat
point towards x: (item (...) of [clone x v] :: list) y: (item (...) of [clone y v] :: list)
move (5) steps
scratch fact of the day whenever i feel like changing it: Oddly enough, the (item ( ) of list) and (item # of ( ) in list) blocks can be placed where boolean blocks are supposed to go. This calls on the Boolean() function in JavaScript (the language Scratch is coded in), or whatever other boolean coercion method exists. Numbers and booleans behave as expected, with 0 (but, incorrectly, not -0), “” (empty string), and “false” (the string) converting to false. Everything else converts to true, so stuff like NaN seem to be interpreted as strings.
set [foo v] to [something]Select this, then press Shift + Down
forever {
set [foo v] to (join (foo)(foo))
} :: control
// just your typical code
green is {
an ({apple :: hat #8fd97e}@addInput::ring #55993a) :: #7bc24f cap
}some text<>{
if not (☁ score :: pen) {
{rainbow [#de0909][#ffaa0d][#ffe70a][#7ccf00][#00cf79][#0072cf][#8d00cf] :: #7bc24f reporter}@addInput :: hat pen
}:: #6a8c32
} block [with v] ([text] :: #a8cc5a) ? :: #6a8c32
- glitchiestofthemall
- Scratcher
100+ posts
How to make a seeking projectiles shoot at clones
dang but could you explain I was really excited about making this Hi!
To do this is sadly not very easy. It involves having to update each clone's X and Y positions and store them in a list. Only then can you add a script to shoot toward that location. I would be happy to give more information if you want!
-Ludum_Factorem9823
when I receive [ wakeup]
if <[happy] = [true]> then
set [ work on scratch] to [true]
else
move (0) steps
end
- glitchiestofthemall
- Scratcher
100+ posts
How to make a seeking projectiles shoot at clones
Code Ai swarms you could make it where a missile clone starts tracking the zombies when they get close enough.this might be better than what I asked for I could just make the 3 clones gunup or down accordingly and then when a sprite is within x distance than it will track Or you might be able to do it using Griffpatch's video on youtube called
It might work… but I hope this helps you
-LFF2004
when I receive [ wakeup]
if <[happy] = [true]> then
set [ work on scratch] to [true]
else
move (0) steps
end
- LFF2004
- Scratcher
66 posts
How to make a seeking projectiles shoot at clones
Code Ai swarms you could make it where a missile clone starts tracking the zombies when they get close enough.this might be better than what I asked for I could just make the 3 clones gunup or down accordingly and then when a sprite is within x distance than it will track Or you might be able to do it using Griffpatch's video on youtube called
It might work… but I hope this helps you
-LFF2004
Good! I wish you luck!
-LFF2004
If you like multiplayer and/or shooter games then this is the studio for you!
A studio where you can share multiplayer games and shooter games!
And where you can find multiplayer games and shooter games!
Unfortunately… there are not much games in the studio yet
If you like those kind of games, then please give it support by adding games to it!
I hope that it will soon be full of multiplayer and/or shooter games!
But I need your help…
Click here to go to the studio.
Thank you!
- glitchiestofthemall
- Scratcher
100+ posts
How to make a seeking projectiles shoot at clones
what is the … in the item … of clone x/ywhen I start as a cloneWhenever you change the clone's position, you have to run the “update position” custom block within the clone script. Next, you should set this code as the projectile code (feel free to modify how much it moves). Use the pointing code demonstrated below:
update position :: custom
define update position
add (x position) to [clone x v]
add (y position) to [clone y v]define point towards x: (target x) y: (target y)
point in direction ([atan v] of (((target x) - (x position)) / ((target y) - (y position)))
if <(target y) < (y position)> then
turn cw (180) degrees
end
... :: hat
point towards x: (item (...) of [clone x v] :: list) y: (item (...) of [clone y v] :: list)
move (5) steps
when I receive [ wakeup]
if <[happy] = [true]> then
set [ work on scratch] to [true]
else
move (0) steps
end
- glitchiestofthemall
- Scratcher
100+ posts
How to make a seeking projectiles shoot at clones
okay im getting confused I got the time to try but I don't really know what to do and I dont know where to put certain lines of code so when the bullet gets close ot seeks the zombie, Ive tried what the other person said but it works very weird when there are multiple clones on the screenCode Ai swarms you could make it where a missile clone starts tracking the zombies when they get close enough.this might be better than what I asked for I could just make the 3 clones gunup or down accordingly and then when a sprite is within x distance than it will track Or you might be able to do it using Griffpatch's video on youtube called
It might work… but I hope this helps you
-LFF2004
Good! I wish you luck!
-LFF2004
when I receive [ wakeup]
if <[happy] = [true]> then
set [ work on scratch] to [true]
else
move (0) steps
end
- -Qlec-
- Scratcher
100+ posts
How to make a seeking projectiles shoot at clones
the clone number that you want to point towardswhat is the … in the item … of clone x/ywhen I start as a cloneWhenever you change the clone's position, you have to run the “update position” custom block within the clone script. Next, you should set this code as the projectile code (feel free to modify how much it moves). Use the pointing code demonstrated below:
update position :: custom
define update position
add (x position) to [clone x v]
add (y position) to [clone y v]define point towards x: (target x) y: (target y)
point in direction ([atan v] of (((target x) - (x position)) / ((target y) - (y position)))
if <(target y) < (y position)> then
turn cw (180) degrees
end
... :: hat
point towards x: (item (...) of [clone x v] :: list) y: (item (...) of [clone y v] :: list)
move (5) steps
scratch fact of the day whenever i feel like changing it: Oddly enough, the (item ( ) of list) and (item # of ( ) in list) blocks can be placed where boolean blocks are supposed to go. This calls on the Boolean() function in JavaScript (the language Scratch is coded in), or whatever other boolean coercion method exists. Numbers and booleans behave as expected, with 0 (but, incorrectly, not -0), “” (empty string), and “false” (the string) converting to false. Everything else converts to true, so stuff like NaN seem to be interpreted as strings.
set [foo v] to [something]Select this, then press Shift + Down
forever {
set [foo v] to (join (foo)(foo))
} :: control
// just your typical code
green is {
an ({apple :: hat #8fd97e}@addInput::ring #55993a) :: #7bc24f cap
}some text<>{
if not (☁ score :: pen) {
{rainbow [#de0909][#ffaa0d][#ffe70a][#7ccf00][#00cf79][#0072cf][#8d00cf] :: #7bc24f reporter}@addInput :: hat pen
}:: #6a8c32
} block [with v] ([text] :: #a8cc5a) ? :: #6a8c32
- Oumuamua
- Scratcher
1000+ posts
How to make a seeking projectiles shoot at clones
my seeking projectiles shoot in 1 place because its following the original sprite but never the clones how do I make it shoot 3 bullets and all 3 bullet will seek the zombies but wont all seek the same one
https://scratch.mit.edu/projects/744925956/ go and see if this demo helps
- glitchiestofthemall
- Scratcher
100+ posts
How to make a seeking projectiles shoot at clones
it works but inly really if one sprite is on screenthe clone number that you want to point towardswhat is the … in the item … of clone x/ywhen I start as a cloneWhenever you change the clone's position, you have to run the “update position” custom block within the clone script. Next, you should set this code as the projectile code (feel free to modify how much it moves). Use the pointing code demonstrated below:
update position :: custom
define update position
add (x position) to [clone x v]
add (y position) to [clone y v]define point towards x: (target x) y: (target y)
point in direction ([atan v] of (((target x) - (x position)) / ((target y) - (y position)))
if <(target y) < (y position)> then
turn cw (180) degrees
end
... :: hat
point towards x: (item (...) of [clone x v] :: list) y: (item (...) of [clone y v] :: list)
move (5) steps
when I receive [ wakeup]
if <[happy] = [true]> then
set [ work on scratch] to [true]
else
move (0) steps
end
- glitchiestofthemall
- Scratcher
100+ posts
How to make a seeking projectiles shoot at clones
this looks very promising im at my classes currently so I will report back latermy seeking projectiles shoot in 1 place because its following the original sprite but never the clones how do I make it shoot 3 bullets and all 3 bullet will seek the zombies but wont all seek the same one
https://scratch.mit.edu/projects/744925956/ go and see if this demo helps
when I receive [ wakeup]
if <[happy] = [true]> then
set [ work on scratch] to [true]
else
move (0) steps
end
- legendary34678
- Scratcher
1000+ posts
How to make a seeking projectiles shoot at clones
Would this demo help you out at all?
Can you beat my latest game?
Have you heard of the X Y Problem?
Please check out me projects please I'm desperate –> Idle Balls, Candy Grab!, Don't Move Your Mouse!, Rude Robot, Tic Tac Toe, Memory Game, Corn Maze, and Idle Balls PEN EDITION!
Oh, hey! I have 100+ posts now!
Oh, hey! I have 500+ posts now! (8/26/22)
Oh, hey! I have 1000+ posts now! (9/23/22)
(Thanks to @AntonL1kesPotato for helping me figure out how to add a signature!)
- Discussion Forums
- » Help with Scripts
- » How to make a seeking projectiles shoot at clones