Discuss Scratch

AgAgga
Scratcher
78 posts

Sprite follow clone

I am making a game where there are birds. The birds are cloned sprites as they come at different times in the game (and potentially places). I am trying to make another sprite follow these clones whenever a clone is made. How can I do this? Is it possible?
footsocktoe
Scratcher
1000+ posts

Sprite follow clone

AgAgga wrote:

I am making a game where there are birds. The birds are cloned sprites as they come at different times in the game (and potentially places). I am trying to make another sprite follow these clones whenever a clone is made. How can I do this? Is it possible?

Yes, it's possible, I think. One sprite can follow another sprite and the clone of a sprite is identical to the sprite so one sprite can follow another sprite's clone. However, you will need a clone ID system for the clones and an IF/THEN block so that the sprite only follows one particular clone of the sprite and not the sprite itself.

I haven't tested the above so I could be completely wrong. Somebody will let me know.


SHOOT THE SPACE MONSTERS! ….. A game everyone can play! Bright colors, bonky sounds!
THE 12 BALLS OF CRAZY AL ……. New scrolling adventure game!

AgAgga
Scratcher
78 posts

Sprite follow clone

Could you pls explain what u mean by Clone ID.
dual_creator43
Scratcher
1000+ posts

Sprite follow clone

AgAgga wrote:

Could you pls explain what u mean by Clone ID.
A clone ID system is a way to do a unique thing for each clone made. A way you could make one is like this:
when green flag clicked
repeat (the number you want)
create clone of [myself v]
end
when I start as a clone
change [ID v] by (1)
if <(ID) = [1]> then
do something for clone 1
else
if <(ID) = [2]> then
do something for clone 2
else
if <(ID) = [3]> then
do something for clone 3
else
if <(ID) = [4]> then
do something for clone 4
else
... // and so on
end
end
end
end

I'm dual_creator43, and I hope I've done well with anything. (Projects, forum replies, etc.) My Scratch habits include:
  • checking my inbox
  • being active in the forums
  • working on my projects (sometimes)
Check out more about me by clicking here or here. Happy Scratching!

My most famous quote: “Nothing good ever comes from posting near the end of a page.”
This is probably the best post anyone has ever made for me.
Don't you hate it when your signature isn't big enough to show everything you put in it?

But I guess it doesn't matter since you're (probably) using Shift+↓.
AgAgga
Scratcher
78 posts

Sprite follow clone

So how can this help me in my original question? I don't understand
Thanks for the explanation though!

Last edited by AgAgga (July 22, 2017 16:27:37)

footsocktoe
Scratcher
1000+ posts

Sprite follow clone

AgAgga wrote:

So how can this help me in my original question? I don't understand
Thanks for the explanation though!

@asivi has a clone following clone tutorial project

The clone ID system idea makes each clone an individual instead of one of a group.


SHOOT THE SPACE MONSTERS! ….. A game everyone can play! Bright colors, bonky sounds!
THE 12 BALLS OF CRAZY AL ……. New scrolling adventure game!

danielhal
Scratcher
100+ posts

Sprite follow clone

When a clone is made, you could set 2 variables to it's x and y position then have the chasing sprite glide to the position of those variables each time one spawns.
For example:
In the bird sprite
when I start as a clone
set [x v] to (x position)
set [y v] to (y position)
broadcast [followSprite v]
In the following sprite
when I receive [followSprite v]
glide (1) secs to x: ((x)) y: ((y))
AgAgga
Scratcher
78 posts

Sprite follow clone

Thanks! That really helped. (No sarcasm there) (<- No sarcasm there either)
footsocktoe
Scratcher
1000+ posts

Sprite follow clone

AgAgga wrote:

Thanks! That really helped. (No sarcasm there) (<- No sarcasm there either)

Well, dang it, where's the sarcasm? It's got to be somewhere.


SHOOT THE SPACE MONSTERS! ….. A game everyone can play! Bright colors, bonky sounds!
THE 12 BALLS OF CRAZY AL ……. New scrolling adventure game!

AVchez
Scratcher
10 posts

Sprite follow clone

um that doesnt help can u make it more simplerpls?

Last edited by AVchez (June 10, 2020 19:30:47)

AVchez
Scratcher
10 posts

Sprite follow clone

when green flag clicked
AVchez
Scratcher
10 posts

Sprite follow clone

when green flag clicked
Kami-ko
Scratcher
100+ posts

Sprite follow clone

when green flag clicked
create clone of [myself v]

danielhal wrote:

When a clone is made, you could set 2 variables to it's x and y position then have the chasing sprite glide to the position of those variables each time one spawns.
For example:
In the bird sprite
when I start as a clone
set [x v] to (x position)
set [y v] to (y position)
broadcast [followSprite v]
In the following sprite
when I receive [followSprite v]
glide (1) secs to x: ((x)) y: ((y))

Last edited by Kami-ko (June 10, 2020 19:41:31)


Check out Super Battle Machine Boxing here!!!

Kami-ko is short for kami no ko (神の子)
SPICYCHICKN
Scratcher
54 posts

Sprite follow clone

No necroposting please.

when [HEAT v] > (9000)
say [CAUTION]

Powered by DjangoBB