How to spawn without leaving a gap?

Well I made a random spawner, I made an integer called Random X & I told it to change attribute random(155,612) every 5 seconds. Then I put the Random X in my spawner and its working perfectly! The problem is that when the 5 seconds is up it tends to make a huge gap which I don't want. I want a continuous line that changes its position.. How would I do this? Thanks :)

Comments

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    bump?

  • ArmellineArmelline Member, PRO Posts: 5,354

    Perhaps take a look at my spawn speed control demo. I'm not entirely sure if your problem is what I think it is, but if so that might help.

    Follow the demos link in my signature.

  • jsorr2jsorr2 Member Posts: 279

    I'm not sure what you mean. Are you saying 5 seconds is too long? Or after the first 5 seconds it takes longer for some reason?

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Armelline‌ & @jsorr2‌ I want it to change its spawning position without leaving a gap. Like a continuous line that just changes its position.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    But without leaving a gap when it does change its spawning postion

  • jsorr2jsorr2 Member Posts: 279
    edited December 2014

    In the spawner, ever 0.5 seconds spawn actors ontop of spawner. and every 5 seconds, change position of spawner. that way when it changes position, its still spawning actors every 0.5 seconds.

    You should upload an example template so we can tamper with it. or a youtube video of the problem.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @josrr I made this very quick template with the same exact coding! You'll see when the 5 seconds are up it changes position but it leaves a gap when it does, I want it to change position but to leave that gap when it does

  • http_gamesaladhttp_gamesalad Member Posts: 1,340
    edited December 2014

    @jsorr2 & @Armelline

    This one is for Windows If youre on windows

    image

    This one is for Mac if youre on mac

    image

  • ArmellineArmelline Member, PRO Posts: 5,354
    edited December 2014

    I still don't really understand the issue. It seems to do exactly what you describe in the first post.

    Can you take a screen shot and point an arrow at the gap you're talking about?

  • http_gamesaladhttp_gamesalad Member Posts: 1,340
    edited December 2014

    @armelline when the 5 seconds are up and its time to change its x position sometimes it makes a black gap. I want the white line to change its position but without leaving a black gap. I want the white line to flow continuously without leaving a black gap but changing its position. Understand now?

  • ArmellineArmelline Member, PRO Posts: 5,354

    No. Sorry :D Is this the gap you're referring to?

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Armelline‌ yup! Exactly what I'm talking about

  • ArmellineArmelline Member, PRO Posts: 5,354

    Well that gap is appearing because you're moving the spawner to a random location. It is exactly what would be expected from your logic and the description you gave. Can you draw a picture of what you want to be happening?

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @armlline I would like there to be a white line where the gaps are

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Armelline‌ something as close to possible like this Image and video hosting by TinyPic

  • ArmellineArmelline Member, PRO Posts: 5,354

    In that case, you need to be spawning another actor there. Off the top of my head, you'll need to record the previous and new X position of the spawner. The spawn a new actor halfway between, and set it to change its width to the distance between Old.Spawn.Location.X-Line.Width and New.Spawn.LocationX+Line.Width.

    That'll get the effect you want. You'll need to make sure your spawning is accurate, though.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340
    edited December 2014

    @Armelline‌ how would I spawn the old and new position? & how would I tell the spawner to spawn that connecting platform?

  • ArmellineArmelline Member, PRO Posts: 5,354

    You don't spawn the old and new position, you record them. Have game attributes for old.x and new.x, and when the spawner moves, record the current position to old.x before it moves, and once it moves record that location in new.x. After doing that, but before spawning the first of the new spawns for that location, spawn the connector.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Armelline‌ so it would be change attribute game.oldX to self.position.x and in the timer it'll put change attribute game.newX to self.position.x?

    I'm really confused where to put all this stuff & in which timer and or rule..

    Would you mind just typing out what I'm supposed to do because it's not working when I try..

  • ArmellineArmelline Member, PRO Posts: 5,354
    edited December 2014

    Think about the steps you'd take if you were the computer.

    • First, you need to note where the spawner is currently located - putting this in new.x.
    • Next, you "spawn" the actors and move them down the page.
    • When the 5s is up, you need to make note of where the spawner "was" - putting this in old.x.
    • You then need to move the spawner to the new position.
    • Then you note where the spawner now is - putting this in new.x.
    • Now you know where the spawner was and is, you can take the connecting actor and put it on the page, stretching it until it covers the whole "gap".
    • Then you move it down the page, like with the other actors.
    • Then you start spawning the new actors.

    Follow that through in your logic and you should get it to work :D

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @armlline would I use a change attribute or constrain attribute? I was asking if you could tell me the coding to put in

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Armelline Like I don't know if to use change attribute or constrain it! That's where I get confused.. I know its going to be something like "game.oldx" to "self.position.x" but I don't know which behavior to use. If you tell the coding to put in that'll be great!

  • ArmellineArmelline Member, PRO Posts: 5,354

    Should only be needing change attributes.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Armelline bro this isnt working at all.. Could you just tell me what to put in? I've been re reading this for like an hour now and trying to put those words into coding but its working or not making sense to me.. Can you just tell me what to put in and end my confusion?

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    bump?

  • jsorr2jsorr2 Member Posts: 279

    My best guess is this:

    2 attributes:
    Old x and new x.

    The first actor you have on the game,
    Change attribute new x to self.positon.x

    After 5 seconds change old x to new x.

    Then when another actor is spawned after 5 seconds have the same rules:

    Change attribute new x to self.position.x

    So for example, old x = 50, new x = 100

    You want to spawn a third, bridge actor to fill the gap in between the 2 main actors.

    So bridge actor x = the number in between new x and old x(75), and the width of that actor is the complete difference of the two numbers. So bridge actor width = (100-50)

    Now we need to figure out the Y of the bridge actor. Let's say the height of the normal actor is 200 and the Y position is 300 (of the 1st actor). To find the bottom of the 1st normal actor to spawn a bridge under it, just divide the height by 2, then minus that from its Y position. So 300-(200/2)=200

    So now you have the y and x position to give to the bridge actor.

    When bridge actor is spawned- change attribute self.Y to 200 and self.x to 75.
    Change attribute self.width to 50.

    Hopefully that will spawn an actor in between the 2 normal actors to fill the gap.

  • jsorr2jsorr2 Member Posts: 279
    edited December 2014

    I'll have a play with your template tomorrow if I have time and you still cant figure it out (its 3am here!). It should be simple.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @jsorr2 thanks! really appreciate you taking time to help me with this issue! :)

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @jsorr2‌ have you had time to play with the template?

  • ArmellineArmelline Member, PRO Posts: 5,354

    I was really hoping we'd be able to get you to the solution without just handing it to you on a plate - people learn much better that way.

    But now I just feel mean not showing you how to do it, so here.

    Made with the latest Mac RC, but you should be able to open it.

Sign In or Register to comment.