Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Cloning won't work
- SSAstudent12
-
Scratcher
8 posts
Cloning won't work
https://scratch.mit.edu/projects/804127167/ - cloning system won't work. It previously worked, but after I made changes to the sprite2 sprite it stopped working!
- Jman1111
-
Scratcher
54 posts
Cloning won't work
How are the clones supposed to behave? I see that you are increasing the global chunk count by 1 every time a new clone is created which causes the local chunk count to always be less than 10 causing the clones to infinitely create clones of themselves.
Last edited by Jman1111 (Feb. 24, 2023 20:36:28)
- SSAstudent12
-
Scratcher
8 posts
Cloning won't work
the clones are simply supposed to generate in newly explored areas.
also- I got them to work, however, I want them basically to act like trees: they procedurally generate where the character hasn't explored yet. (similarly to chunks in Minecraft– that was where I got the idea)
One other problem– how do I get rid of them collecting at the border of the viewport?
also- I got them to work, however, I want them basically to act like trees: they procedurally generate where the character hasn't explored yet. (similarly to chunks in Minecraft– that was where I got the idea)
One other problem– how do I get rid of them collecting at the border of the viewport?
- Jman1111
-
Scratcher
54 posts
Cloning won't work
It looks like this is because your trees are not centered in the costume sprite editor, so their position looks to be offset when they reach the edge of the screen. You can fix this by dragging your tree to the center of the editor and it should snap exactly. Additionally, scratch has built in sprite fencing which does not let sprites to normally be moved offscreen but there are some workarounds. One workaround I know is to create a duplicate costume of the sprite you want to go off-screen that is at least twice as big, then move, then switch back the original costume.
switch costume to [big v]
move (sprint?) steps
switch costume to [original v]
- SSAstudent12
-
Scratcher
8 posts
Cloning won't work
also- I want all trees not near Sprite1 to despawn. I tried making an invisible sprite that, if not touching a tree, would make it despawn. However, this causes my computer to freeze up whenever I run it. What am I doing wrong?
- Jman1111
-
Scratcher
54 posts
Cloning won't work
I see three problems.
-
<touching [ v] ?>
Touching sensing does not work with hidden sprites. To get around this you can useset [ ghost ] effect to (100)
show
Make sure sprite4 is not hidden. The ghosting effect will make the sprite appear invisible even though it technically is being displayed. - Your project is freezing because you are deleting and creating many clones at the same time. I do not know the exact technical cause of this, but you can fix this by adding a wait 1 second block before you delete the clone when not touching sprite 4.
if <not <touching [Sprite4 v] ?>> then
change [global_chunk_count v] by (-1)
wait (1) secs
delete this clone
end - You need to also apply the previous workaround for the sprite fencing to the forever loop for the cloned sprites not just the original.,
- PlatypusBoyProgram
-
Scratcher
11 posts
Cloning won't work
When ever I make clone of a sprite that already has clones it doesn't clone, here is my code
P.S there's only 10 clones
when [e v] key pressed
next costume
when [space v] key pressed
create clone of [myself v]
when green flag clicked
forever
go to [Cursor v]
end
P.S there's only 10 clones
Last edited by PlatypusBoyProgram (June 9, 2024 22:09:16)
- Dagriffpatchfan
-
Scratcher
1000+ posts
Cloning won't work
The when space key presses is received by all clones, it quickly spirals out of control, if you have one clone it creates two clones instead of the one you where looking for, if you have 100 clones, it creates 101 here's a fix
when green flag clickedType must be a for this sprite only variable
set [type v] to [me]
when I start as a clone
set [type v] to [clone]
when [space v] key pressed
if <(type) = [me]> then
create clone of [myself v]
end
Last edited by Dagriffpatchfan (June 12, 2024 11:40:38)
- zrgiam
-
Scratcher
1 post
Cloning won't work
I am trying to make a insect simulator. I am trying to create clones of enemies, put in all the code and it worked. But after making upgrades to the enemy sprite, the clone wouldn’t show. Please help!
- IcWasHere
-
Scratcher
1 post
Cloning won't work
Hey, guys. I am having trouble with cloning sprites. I am working on this game titled “Time Traveln' Cowboy,” but the enemy sprites stopped cloning after passing through a few levels (The game has multiple different stages). The sprites are in the center and there should be no other code interfering with the enemy clones. There is only two that can delete the enemy clones, which can detect if the Arm sprite is touching the enemy clone when this certain broadcast is sent out. When I went to test it out, the enemy clones weren't there but the two programs didn't light up like they usually do when they detect the Arm sprite or broadcast.
- deck26
-
Scratcher
1000+ posts
Cloning won't work
Hey, guys. I am having trouble with cloning sprites. I am working on this game titled “Time Traveln' Cowboy,” but the enemy sprites stopped cloning after passing through a few levels (The game has multiple different stages). The sprites are in the center and there should be no other code interfering with the enemy clones. There is only two that can delete the enemy clones, which can detect if the Arm sprite is touching the enemy clone when this certain broadcast is sent out. When I went to test it out, the enemy clones weren't there but the two programs didn't light up like they usually do when they detect the Arm sprite or broadcast.Create your own topic please. People helping are not expecting to see a new request for help at the end of an old, solved request for help.
- Bomb_School
-
New Scratcher
1 post
Cloning won't work
Need a little help with my game, Death Rush. It is a top-down zombie shooter, but the player can't shoot it if the player is on the edge. I am using clones for the bullets. Please help!
- N8_D_GR8_1
-
Scratcher
1000+ posts
Cloning won't work
Need a little help with my game, Death Rush. It is a top-down zombie shooter, but the player can't shoot it if the player is on the edge. I am using clones for the bullets. Please help!Read the post above you. Please make a new topic instead of posting on someone else's.
- Discussion Forums
- » Help with Scripts
-
» Cloning won't work








