Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Cloning worked initially, now the clones delete themselves upon creation.
- ScratchTheCat221
-
Scratcher
5 posts
Cloning worked initially, now the clones delete themselves upon creation.
I'm making an RPG, and I want to put all of the attacks for one boss in sprite, so that I don't need to make a sprite for every single projectile.
Here's a link:
https://scratch.mit.edu/projects/307446583/
The main issue is found in the sprite entitled “Lumina Atk”. Each column of codes represents one attack. To trigger the attack, you simply activate the blocks at the very top, the ones that have the (Show) Block and (Switch Costume) Block. The images are in this link https://imgur.com/a/FfCEkPI


The first set of blocks activates the code by switching to the first costume and creating the clones. Then the second set of blocks causes the clones to act the way I want (to move downwards and play a sound). I've found that when I activate it, the main sprite appears, then the clones don't appear or do anything, and I'm assuming that they're deleting immediately.
At first I thought it's because of the Forever bracket I'm using in the second set of blocks, but removing it and replacing it with a “Repeat Until (My Condition)” did not work either. The baffling thing is I had this code working perfectly before. Then, the next time I loaded it up, this issue appeared.
The column of code at the very end works the same as before, and functions normally. It might be because it doesn't create so many clones, but it can be repeated without consequence.
At this point, I think it's a glitch because it worked fine before, then I saved and closed it, then I opened again and now it doesn't work. Variable blocks and values are not involved in this specific code either, so the problem isn't from resetting values.
Here's a link:
https://scratch.mit.edu/projects/307446583/
The main issue is found in the sprite entitled “Lumina Atk”. Each column of codes represents one attack. To trigger the attack, you simply activate the blocks at the very top, the ones that have the (Show) Block and (Switch Costume) Block. The images are in this link https://imgur.com/a/FfCEkPI


The first set of blocks activates the code by switching to the first costume and creating the clones. Then the second set of blocks causes the clones to act the way I want (to move downwards and play a sound). I've found that when I activate it, the main sprite appears, then the clones don't appear or do anything, and I'm assuming that they're deleting immediately.
At first I thought it's because of the Forever bracket I'm using in the second set of blocks, but removing it and replacing it with a “Repeat Until (My Condition)” did not work either. The baffling thing is I had this code working perfectly before. Then, the next time I loaded it up, this issue appeared.
The column of code at the very end works the same as before, and functions normally. It might be because it doesn't create so many clones, but it can be repeated without consequence.
At this point, I think it's a glitch because it worked fine before, then I saved and closed it, then I opened again and now it doesn't work. Variable blocks and values are not involved in this specific code either, so the problem isn't from resetting values.
- colinmacc
-
Scratcher
1000+ posts
Cloning worked initially, now the clones delete themselves upon creation.
Your “when I start as a clone” block for “star1” has the delete clone block in the wrong place - It should be inside the if condition.
By the way, because of the loops at the top, you are creating 40 bullet clones every time - is that what you want to happen?
By the way, because of the loops at the top, you are creating 40 bullet clones every time - is that what you want to happen?
- ScratchTheCat221
-
Scratcher
5 posts
Cloning worked initially, now the clones delete themselves upon creation.
AAAAH Thanks so much for the help!
I won't be running all these codes alongside each other, these blocks are more like a template for me to put into the attack pattern code, which will be the one that actually runs during the game.
Thanks so much again!
I won't be running all these codes alongside each other, these blocks are more like a template for me to put into the attack pattern code, which will be the one that actually runs during the game.
Thanks so much again!
- Discussion Forums
- » Help with Scripts
-
» Cloning worked initially, now the clones delete themselves upon creation.