Problem with Spawning using loop or loop over table behavior

fmakawafmakawa Member Posts: 565

HI folks,

So I have a function that results in spawning using the loop behaviours. the odd things is though, instead of spawning all the required items, its only spawning the first 10. Some of the items are off screen. May this be the reason? I've used the debugger so I know its counting/creating the index up to the number of items its meant to spawn but I tried find them/view them I only get the first 10. Additionally, when I scroll some of those first 10 get destroyed if they go off screen and I remain with just 8 or 7.
Any ideas what could be causing this?

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @fmakawa, please be a bit more specific about how you spawn, why are some off screen, how large is your scene, how do you scroll?

    By the sounds of it, your actors are spawned 500 pixels outside the bounds of your scene where they get destroyed automatically by the engine.

  • fmakawafmakawa Member Posts: 565

    @Hopscotch I think you nailed it on the head. Must be destroyed because they've gone over.
    My scene is an ipad portrait size and I scroll using a touch and offset mechanism.
    My background does the spawning, with no conditions set as to trigger the spawn. There is a condition to stop the spawn once the required number of actors has been made. The get spawned to a position evenly according to an attribute I've set up and definitely go beyond the 500 pixel limit on my screen (didn't realize there was one- live and learn I suppose.) So how do fix this or work around it?

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited May 2016

    @fmakawa said:
    @Hopscotch I think you nailed it on the head. Must be destroyed because they've gone over.
    My scene is an ipad portrait size and I scroll using a touch and offset mechanism.
    My background does the spawning, with no conditions set as to trigger the spawn. There is a condition to stop the spawn once the required number of actors has been made. The get spawned to a position evenly according to an attribute I've set up and definitely go beyond the 500 pixel limit on my screen (didn't realize there was one- live and learn I suppose.) So how do fix this or work around it?

    You have to spawn within the limits of the scene. If you are expanding the scene at runtime then be sure to expand the scene before the spawn happens.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @fmakawa, you could keep everything the same, just increasing the scene size.

    But it depends what your game does. If you allow endless scrolling then you will run into the same issue somewhere down the line.

    Maybe consider dynamic spawning over time?

  • fmakawafmakawa Member Posts: 565

    @Hopscotch @Lost_Oasis_Games I added more height but I think I hit a stinker. If I'm not mistaken the added size is placed to the top which means I need to offset all my content up so I can actually use said new space? Because even after the newly added space when I scrolled down the actors had disappeared. How do I this?

  • fmakawafmakawa Member Posts: 565

    @Hopscotch dynamic spawning over time wouldn't quite work with what I'm doing since there is no way to tell when they will be needed. Rather, on demand would be better but I would need to be able to backtrack and respawn old ones. Simplest thing at the moment I think would be change scene size and then move content to fit.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @fmakawa said:
    @Hopscotch @Lost_Oasis_Games I added more height but I think I hit a stinker. If I'm not mistaken the added size is placed to the top which means I need to offset all my content up so I can actually use said new space? Because even after the newly added space when I scrolled down the actors had disappeared. How do I this?

    Hmm if they are within the scene area they should not disappear. Once you spawn the. To a spot on the screen they should stay until you destroy them. Anytime you build something scrolling in creator you have to do it knowing the left and bottom are always your start and end points.

  • fmakawafmakawa Member Posts: 565

    True and I have built that way but the change in height comes during run play hence the need to move everything to cater to that. I can't build the scene with the 'right' size before since the 'right' size is dynamic according to how many actors I am spawning which changes.

    @Lost_Oasis_Games said:

    . Anytime you build something scrolling in creator you have to do it knowing the left and bottom are always your start and end points.

Sign In or Register to comment.