Spawn Actor acts strange (SOLVED)

mvsprojects

  • Posts: 71
I'm working on a smaller project, next to Boing Ball, and I want to have my character avoide getting crushed by heavy crates. I know how to make the crate spawn within the screen boundaries, but when I test it out in real-time, Crates spawn all over the place! I even set when to spawn a crate and it still spawns like crazy. How can I minimize this?

« Last Edit: December 22, 2011, 12:45:31 pm by mvsprojects »
Boing Ball coming soon...
Co-Opetative coming soon...

MV's Projects- Something to Enable

Hectate

  • *
  • Posts: 4643
The contents of the "always" wrapper will run many times a second, up to 60 I believe. If you just put that in there, it will run the "create actor" code that many times every second - hence you have too many spawning.

Use the time blocks to limit how frequently one is created. Also, don't put the time blocks in under always or it will only get worse, use the "when created" wrapper instead and the "do every" block fr timing.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

mvsprojects

  • Posts: 71
It is better, but the random spawning only got slower, so, what can I do now?
Boing Ball coming soon...
Co-Opetative coming soon...

MV's Projects- Something to Enable

rob1221

  • *
  • Posts: 9472
Put that spawning block under "when created" instead.

Hectate

  • *
  • Posts: 4643
1. You're using an Actor Behavior. I suggest using a Scene Behavior to control spawning actors. If you have it as an actor behavior and that actor gets removed, your behavior may cease to operate as intended.

2. Move your blocks to When Created as previously noted.

3. If you want them to spawn more frequently, use a smaller amount of time. Right now you have it set for every 2 seconds. You could set it for 1 second, or .5 seconds (a half of a second), or however long you want it to be between new blocks.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

mvsprojects

  • Posts: 71
Thank you. The behavior is fixed and I can now continue.
Boing Ball coming soon...
Co-Opetative coming soon...

MV's Projects- Something to Enable