Discuss Scratch

deck26
Scratcher
1000+ posts

the cloning tutorial: the basics of cloning.

90josh09 wrote:

I'm making tabs / totally accurate battle simulator on scratch and it uses clones as the people but i don't know how to make the clones go towards each other and attack each other and attack when there in range and i don't know how to make the clones have health. does any know how to do any of those thing's? i will be really happy if any could tell me a way of doing them.
If you read this thread you'll see the advice that it is better to create your own new topic than to post on this old topic. Posting here is unlikely to get much attention.
SumitraKan
Scratcher
44 posts

the cloning tutorial: the basics of cloning.

Hi!
I wonder how do we limit to creating ONLY ONE clone at a time?
Thanks
1
deck26
Scratcher
1000+ posts

the cloning tutorial: the basics of cloning.

SumitraKan wrote:

Hi!
I wonder how do we limit to creating ONLY ONE clone at a time?
Thanks
1
Best to create your own topic.
CamshaftDevil
New Scratcher
1 post

the cloning tutorial: the basics of cloning.

Hello! I am trying to make a game that you could say runs like Space Invaders. I have a ship and a bullet that both move together, and the bullet clones and goes forwards at the enemies. I was wondering though, how to make the bullet not follow the ship's X-axis movements and to only make it go straight up.
deck26
Scratcher
1000+ posts

the cloning tutorial: the basics of cloning.

CamshaftDevil wrote:

Hello! I am trying to make a game that you could say runs like Space Invaders. I have a ship and a bullet that both move together, and the bullet clones and goes forwards at the enemies. I was wondering though, how to make the bullet not follow the ship's X-axis movements and to only make it go straight up.
Create your own topic please.
digthebone
Scratcher
500+ posts

the cloning tutorial: the basics of cloning.

deck26 wrote:

CamshaftDevil wrote:

Hello! I am trying to make a game that you could say runs like Space Invaders. I have a ship and a bullet that both move together, and the bullet clones and goes forwards at the enemies. I was wondering though, how to make the bullet not follow the ship's X-axis movements and to only make it go straight up.
Create your own topic please.
People are completely welcome to ask questions in this thread; I stated in the conclusion they can.
digthebone
Scratcher
500+ posts

the cloning tutorial: the basics of cloning.

CamshaftDevil wrote:

Hello! I am trying to make a game that you could say runs like Space Invaders. I have a ship and a bullet that both move together, and the bullet clones and goes forwards at the enemies. I was wondering though, how to make the bullet not follow the ship's X-axis movements and to only make it go straight up.
Thank you for asking! This is very simple to fix. First of all, you will need to create a trigger for the spaceship to summon these bullet clones, which im sure you already did. Here is an example:

when [Space v] key pressed
create clone of [ v]

second of all, you will have to make the bullets a seperate sprite. Otherwise, you will only be cloning the spaceship itself too, and finding a way around this can be time consuming and uneccesary. Therefore, I do suggest making a spaceship sprite and a seperate bullet sprite. The spaceship will then create a clone of the seperate bullet sprite, which is simple. In the dropdown of the “create clone of” box, you should be able to select your seperate bullet sprite.

create clone of [Bullet v]

Now the spaceship will be creating a clone of the bullet sprite, but what now? The bullet will be coming from the spaceship, so we are first going to have to make sure the bullet spawns where the spaceship is. We will need to make sure the bullet is visible obviously, and then we can control the bullets movements. The script should look something like this:

when I start as a clone     // this is for the bullet sprite
go to [Spaceship v]
show
// the rest should be your code for the bullet sprite.

Hopefully this answered all your questions! This should allow the bullet to move on its own, and not on the course of the spaceships X-axis. If you have any more questions relating to clones, I am glad to answer them in this thread, or you can ask someone in the Help With Scripts forum!

Last edited by digthebone (Dec. 6, 2019 21:12:51)

elmao23
New Scratcher
1 post

the cloning tutorial: the basics of cloning.

Hi there,

Everytime I try to clone something it makes hundreds of clones. I only want to make 5. How can I stop this from happening.
JordanTheKid
New Scratcher
3 posts

the cloning tutorial: the basics of cloning.

elmao23 wrote:

Hi there,

Everytime I try to clone something it makes hundreds of clones. I only want to make 5. How can I stop this from happening.
Make sure you have a code that makes it so when the sprite has 5 clones stop the script. i would use a variable.
digthebone
Scratcher
500+ posts

the cloning tutorial: the basics of cloning.

elmao23 wrote:

Hi there,

Everytime I try to clone something it makes hundreds of clones. I only want to make 5. How can I stop this from happening.
repeat (5)
create clone of [myself v]
end

You might have been doing this on accident:

forever
create clone of [myself v]
end

Dont use a forever loop unless you want it to constantly be making clones. Of course, there are exceptions to this, but I dont want to get too in depth.

to make it end the script, but this block after the code:

stop [this script v] 

Last edited by digthebone (Jan. 13, 2020 16:33:47)

tommygun154
Scratcher
2 posts

the cloning tutorial: the basics of cloning.

How Do you delete all your clones on the screen at one time

Last edited by tommygun154 (March 26, 2020 23:31:09)

Gamer_Herobrine
Scratcher
7 posts

the cloning tutorial: the basics of cloning.

I have a problem I need each clone to know what clone it is but I have 80-something clones help maybe?
I will do the other method for know but if someone knows a better way then plz tell me!

Last edited by Gamer_Herobrine (March 31, 2020 18:55:17)

Oumuamua
Scratcher
1000+ posts

the cloning tutorial: the basics of cloning.

Nice topic, every troll loves it!
JDABEST87
Scratcher
2 posts

the cloning tutorial: the basics of cloning.

I don't understand, it's ok tho, I'll get there someday.
Oumuamua
Scratcher
1000+ posts

the cloning tutorial: the basics of cloning.

WOWCrAzY000 wrote:

Is it possible for the clones to interact with one another (I'm trying to do an if statement when two different clones touch)

This topic was created when Scratch was Scratch 2.
In that version clones detect touching themselves.



Currently, in Scratch 3, clones don't detect themselves but detect the others as “name of parent sprite”

T1EFL1ES
Scratcher
3 posts

the cloning tutorial: the basics of cloning.

deck26 wrote:

digthebone wrote:

f_deruvo wrote:

Hi all
may I ask about clones how is possible to get the distance between two clones? Is it not easy like distance between two sprite.. Thanks
first record the x and y coordinates of the first clone. Then the second. subtract the x coordinate by the other x and the y coordinate by the other y and you should have your answer.
Try to check the date of the post you're responding to! I doubt they were still waiting for a response.
yup
T1EFL1ES
Scratcher
3 posts

the cloning tutorial: the basics of cloning.

tommygun154 wrote:

How Do you delete all your clones on the screen at one time


when green flag clicked
forever
delete this clone
end
T1EFL1ES
Scratcher
3 posts

the cloning tutorial: the basics of cloning.

SumitraKan wrote:

Hi!
I wonder how do we limit to creating ONLY ONE clone at a time?
Thanks
1
when green flag clicked
create clone of [ ?????]
stop [ all]
ghjklo_09
Scratcher
4 posts

the cloning tutorial: the basics of cloning.

Oumuamua
Scratcher
1000+ posts

the cloning tutorial: the basics of cloning.

ghjklo_09 wrote:


Do you really think that your is funny some way?

Guys if you are not going to add some relevant info into an old topic, please, avoid to post anything.
Thanks???

Powered by DjangoBB