Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » experience required: how do I broadcast a clone's position?
- Kanae_Toyomi
-
Scratcher
6 posts
experience required: how do I broadcast a clone's position?
I have a game where you are the boss, and there's a certain thunder attack that I wish the AI would step back from, but I have no way to have it point towards the attack, turn 180 and move back, because distance to sprite doesn't account for clones.
- 10goto10
-
Scratcher
1000+ posts
experience required: how do I broadcast a clone's position?
Are they both clones?
Usually people will store the x and y position of a clone (The thunder clone?) into variables either constantly in a forever loop or after receiving a broadcast. If multiple clones are involved in your project you might need to store them in a list using their cloneID as their item number.
The the AI clone would point to the thunder (clone?) using
You mentioned distance. Is that also something you needed?
It might help if you shared your project and posted a link.
Usually people will store the x and y position of a clone (The thunder clone?) into variables either constantly in a forever loop or after receiving a broadcast. If multiple clones are involved in your project you might need to store them in a list using their cloneID as their item number.
The the AI clone would point to the thunder (clone?) using
define Point towards x: (Target X) y: (Target Y)
point in direction ([atan v] of (((Target X::custom) - (x position)) / ((Target Y::custom) - (y position)))::operators)
You mentioned distance. Is that also something you needed?
It might help if you shared your project and posted a link.
- Kanae_Toyomi
-
Scratcher
6 posts
experience required: how do I broadcast a clone's position?
I dunno, it's more of I need the AI to point towards a clone, the link's right here though
- Kanae_Toyomi
-
Scratcher
6 posts
experience required: how do I broadcast a clone's position?
thank you very much
- 10goto10
-
Scratcher
1000+ posts
experience required: how do I broadcast a clone's position?
I'm a little confused. The “Player Hitbox” sprite will currently dodge the “warningLightning” sprite and its clone because they are both at the same location.
However, I've modified your code to dodge the clone of “warningLightning” wherever it is on the screen.
I'm not sure that this is what you want but at least it shows how to point to a clone (so the sprite can then turn away).
Remix is here: https://scratch.mit.edu/projects/1255850598/
However, I've modified your code to dodge the clone of “warningLightning” wherever it is on the screen.
I'm not sure that this is what you want but at least it shows how to point to a clone (so the sprite can then turn away).
Remix is here: https://scratch.mit.edu/projects/1255850598/
- Kanae_Toyomi
-
Scratcher
6 posts
experience required: how do I broadcast a clone's position?
thanks c:
- tolimoli
-
Scratcher
32 posts
experience required: how do I broadcast a clone's position?
I think it is not possible to broadcast a clone's position but you can use variables. Like:
Idk if the blocks above is what I wanted
when I start as a clone
if <> then
<touching [Player v] ?>
set [Your Variable v] to [1]
end
Idk if the blocks above is what I wanted

- Discussion Forums
- » Help with Scripts
-
» experience required: how do I broadcast a clone's position?