Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Glitch in my game. Cloning Limit?
- iOSwarrior
- Scratcher
4 posts
Glitch in my game. Cloning Limit?
Hello, I am trying to make a tower defense game, similar to that of Dawesme's ‘Gunner Tower Defense’, and seem to have stumbled upon a glitch in my game. At round 3, only 3 enemies come across the screen, and my towers and any loops I have lock up and stop working.
Here is the link to my game:
Tower Defense
Here is the link to my game:
Tower Defense
- AonymousGuy
- Scratcher
1000+ posts
Glitch in my game. Cloning Limit?
It's because your clones aren't being deleted. In your second enemy sprite, it still creates the clones even if wave is less then 9, but then these clones don't run the script that ends up with them being deleted.
EDIT: Oh, and yes. There is a cloning limit. 300 or maybe 301. Something like that. However, when a clone is deleted it no longer exists, so the total amount of them goes down and you can create more.
EDIT: Oh, and yes. There is a cloning limit. 300 or maybe 301. Something like that. However, when a clone is deleted it no longer exists, so the total amount of them goes down and you can create more.
Last edited by AonymousGuy (Feb. 7, 2014 02:37:18)
- iOSwarrior
- Scratcher
4 posts
Glitch in my game. Cloning Limit?
It's because your clones aren't being deleted. In your second enemy sprite, it still creates the clones even if wave is less then 9, but then these clones don't run the script that ends up with them being deleted.
EDIT: Oh, and yes. There is a cloning limit. 300 or maybe 301. Something like that. However, when a clone is deleted it no longer exists, so the total amount of them goes down and you can create more.
I see now, but I have tried to fix this, and can't understand how.
Any way to fix this?
Last edited by iOSwarrior (Feb. 7, 2014 13:54:45)
- AonymousGuy
- Scratcher
1000+ posts
Glitch in my game. Cloning Limit?
Under theIt's because your clones aren't being deleted. In your second enemy sprite, it still creates the clones even if wave is less then 9, but then these clones don't run the script that ends up with them being deleted.
EDIT: Oh, and yes. There is a cloning limit. 300 or maybe 301. Something like that. However, when a clone is deleted it no longer exists, so the total amount of them goes down and you can create more.
I see now, but I have tried to fix this, and can't understand how.
Any way to fix this?
if <(Wave) > [9]> thenblock, simply place a “delete this clone” block:
...
end
when I start as a clone
if <(Wave) > [9]> then
...
end
delete this clone
In fact, it would be more efficient in all of your scripts for deleting clones if you did this instead:
if <touching [Sprite10 v]?> then
change [Lives v] by (-1)
else
if <touching [Sprite9 v]?> then
change [Lives v] by (-1)
else
if <touching [Sprite5 v]?> then
change [Money v] by (pick random (10) to (15))
end
end
end
delete this clone
- iOSwarrior
- Scratcher
4 posts
Glitch in my game. Cloning Limit?
Thanks! The second script broke the game, but the one after the ‘If Wave > 9’ statement worked! New enemies even came in on wave 10!
Thanks.
Thanks.
- cemicle123
- Scratcher
2 posts
Glitch in my game. Cloning Limit?
I ran into this problem with my new project. I made it delete the 6 second old clone delete its self.
- Discussion Forums
- » Help with Scripts
- » Glitch in my game. Cloning Limit?