can't spawn large objects off screen

Benk10

  • Posts: 21
Hi,

I'm making an Asteroids clone and I've got small, medium, and large asteroids. I'm working on the spawning behavior now. Small asteroids spawn off-screen just fine but big ones don't even though the logic is exactly the same.  They can all spawn in-screen. The asteroid sizes are about  16x32, 32x64, and 64x128 pixels, if that's relevant.

Any ideas why this is happening?

colburt187

  • *
  • Posts: 2416
Maybe try putting always simulate on them?

camaleonyco

  • Posts: 204
Maybe your big asteroids are being created outside of the "active" area of the game.
Quote
Off Screen Actors Become Inactive

Something you may notice is that actors that are off screen stop working, as if they froze in time. We do this to preserve performance.

Nevertheless, there are cases where you want an actor to be active regardless of whether it’s on or off screen.
http://www.stencyl.com/help/viewArticle/114

If your small asteroids are entering the active area before "falling asleep", they will act normal even you create them off-screen.

Wherever you are creating those asteroids, add a "make (last created actor) always active" block. You can also change the "active" area with the "Set Offscreen Bounds" block (http://www.stencyl.com/blocks/viewCategory/scene-view/offscreen).

Benk10

  • Posts: 21
Thanks for the help.

I tried both suggestions but neither works.
Debug statements for printing the last created actor reveal that the bigger asteroids do indeed get created. So why aren't they arriving from off-screen even with "set always active?"

« Last Edit: May 05, 2016, 01:44:08 pm by Benk10 »

camaleonyco

  • Posts: 204
Do all the asteroids share the same properties on the Physics tab?

yoplalala

  • *
  • Posts: 1632
Could you post a screenshot of how're you spawning them ?

Benk10

  • Posts: 21
I solved the problem (sort of)

The small asteroids had the "wrap around screen" behavior but I had forgotten to give it to the others. Adding it fixed the problem, but I don't understand why. You should be able to create active things offscreen and launch them into the screen without requiring this behavior.