Project link: Bird hatching simulator by Devant Studios
What is happening in the project, and what do you want to happen instead?
Screenshots of code:
Project link: Bird hatching simulator by Devant Studios
What is happening in the project, and what do you want to happen instead?
Screenshots of code:
When clones > 0, you are increasing this game variable, then creating that many clones. However, when you do that, the condition is still true, so you will repeatedly increase 1, then create that many clones.
Additionally, every clone will also be running that rule.
So if clone was originally set to 1
, then you clone twice (since you increase by one), then you have two clones that each clone three times (increased by one again) = 6 clones, then 6 * 4 = 24 clones, then 24 * 5 = 120 clones, then 120 * 6 = 720 clones in less than 1/10 of a second.[1]
You probably want to make these changes:
check once if
block) that the “(self) total clones” is less than your target amount of clones (i.e. (self) total clones < ▶️ Clone
)that’s n! (n factorial) clones – quite a lot if you know what I’m saying ↩︎
Or just do
When clones > 0 {
Set clone to clones
Set clones to 0
Repeat times clone {
Create a clone of this object
}
}
Another way to do it (using AE’s secret block)
When clones > 0 {
Set clone to clones
Set clones to 0
Create a clone of this object times (clone)
}
The second one is how Spy Guy 96 and I spawn enemies in our platformers.
I’ve had clones crash my project too (and I was cloning one at a time too), but that was mainly because it was running player 3.0.0, which is not as stable as player 2.2.3, tho it’s still a good idea to fix the issue so something like this don’t happen again…
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.