Spawning objects faster without losing the space between the objects.

evertevert Member Posts: 266
edited December 2016 in Working with GS (Mac)

Hi all,

I have a little spawner spawning a dotted line. So it spawns a dot every 0.3 sec.
No what i want is to let it go faster over time. That is not very hard to do, but when they spawn faster the space between the dots gets smaller (because they spawn faster). How can i let it go faster without losing that space between the spawns?

For example: 0 = a space and A is a dot.
Now it does 000A00A00A..
But when spawning them faster it does 0A0A0A0A so the space gets smaller.
They space needs to remain the same but the speed needs to go up over time.

Thanks

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2016

    Ahhhhhhhhhh !! :D

  • evertevert Member Posts: 266
    edited December 2016

    @Socks said:
    Ahhhhhhhhhh !! :D

    Very constructive answer! solved the problem! :p
    But yeah any idea?

  • evertevert Member Posts: 266
    edited December 2016

    I can let my object move faster with a game.speed+10 every 10sec if i do this right with the timing of my spawner i can get the 'between' space exactly the same.
    The new problem however is how do i get my spawner timer go faster? I'm not able to create an attribute game.speedtimer with 0.3 as a starting point. I needs to be ether 1 or more

  • SocksSocks London, UK.Member Posts: 12,822

    @evert said:
    Very constructive answer!

    Lol, sorry about that, years of frustration finally tipped me over the edge :D

    @evert said:
    But yeah any idea?

    No, no idea, your explanation is too vague to offer any kind of input, it could mean any number of things.

  • evertevert Member Posts: 266
    edited December 2016

    haha Ok :)
    Here is an example image.

    Dot line A is what I have and what I want.
    But when i move up the timing of the spawner it gives me something like dot line B.
    They spawn closer together.

    When I make them move faster over time i get something like dot line C.
    The space between the spawn objects get bigger.

    I want to keep the line as dotline A but still let them go faster over time.
    So i need to get my spawn and move in sync yes?

    But i can do for the move game.speed+10 every 5sec no problem here.
    But in order to get my dots correct my spawners spawns at (speed) 0.27.
    I'm not able to make a game attribute with a 0.something. Its always 1 or more.

    The dot line goes down and i want it to go down faster over time, but with the space between the dot the same everytime the game faster.

    Edit: wow that image came out big :p

  • IceboxIcebox Member Posts: 1,485

    Why cant you make a game attribute with 0. ? real attributes can be decimal

    You will have to change the timer and speed to get the effect you want. More speed with less time or vice versa .

  • SocksSocks London, UK.Member Posts: 12,822

    @evert said:
    When I make them move faster over time i get something like dot line C.

    I understand the issue, I just haven't got a clue how you are getting there.

  • evertevert Member Posts: 266

    @Icebox said:
    Why cant you make a game attribute with 0. ? real attributes can be decimal

    You will have to change the timer and speed to get the effect you want. More speed with less time or vice versa .

    Well i tried will a real attribute, but how does the minus work?
    game.speed-0.05? i tried something like that, does not really work
    game.speed%2 is not working to, maybe i give it the wrong input.

    @Socks said:

    @evert said:
    When I make them move faster over time i get something like dot line C.

    I understand the issue, I just haven't got a clue how you are getting there.

    To do dot B and C is easly, but A hmmmnnn its killing me :/

  • SocksSocks London, UK.Member Posts: 12,822

    @evert said:
    To do dot B and C is easly, but A hmmmnnn its killing me :/

    Ok, I'll give it a go . . .

    "I have a little spawner spawning a dotted line"

    How is this spawner spawing a dotted line ?

    "No what i want is to let it go faster over time. That is not very hard to do"

    How are you getting the dotted line to spawn faster ?

    "but when they spawn faster the space between the dots gets smaller (because they spawn faster)"

    Why do the spaces between the dots get smaller when the dots spawn faster ?

  • evertevert Member Posts: 266
    edited December 2016

    @Socks
    "How is this spawner spawing a dotted line ?"

    I spawn an object every 0.3 sec

    "How are you getting the dotted line to spawn faster ?"

    Made a game.speed (starting at 100) for the moving object so every 5sec game.speed+10, but i put this on the 'move' of the object because i'm not able to put a decimal on my timer from the spawner.

    "Why do the spaces between the dots get smaller when the dots spawn faster ?"

    If they spawn faster after each other there is less space between them.

    I made an example file (see file)

    Spawner A spawns at a steady speed (0.3sec) with a steady move (100)
    Spawner B spawns at a faster speed (0.1sec) but steady move (100)
    Spawner C spawns at a steady speed (0.3sec) but with faster move (300)
    Spawner D has an attribute controlling its move speed (100) by +10 every 3sec
    If you look at D for lets say 20sec, you will notice because of the acceleration the dots will be further apart every 3sec.

    If i change something to A I get B or C.
    It needs to keep looking like A but but still be faster over time like D.

    Edit: so in order for me to get what i want, i need to get the timer for my spawner and the acceleration moving up at about the same time Problem?: Yes, changing the acceleration every 3sec is easy to do, but it seem i'm not able to get my timer moving from .3 to .25 to .2 to .15 and lower..

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2016

    @evert said:
    @Socks
    "How is this spawner spawing a dotted line ?"

    I spawn an object every 0.3 sec

    I just took a look at your attached project, the dots (that form the dotted line) are being spawned at the top of the screen and then falling downwards (using an Accelerate behaviour), that is how the dotted line is being formed, there is nothing in any of your posts that would tell anyone that this is what is happening - (I wrongly guessed the spawner actor was moving and leaving a trail of dots), without your attached project this is just another forum guessing game (the reason for my "Ahhhhhhhhhh !!" comment)

  • SocksSocks London, UK.Member Posts: 12,822

    @evert said:
    Made a game.speed (starting at 100) for the moving object so every 5sec game.speed+10, but i put this on the 'move' of the object because i'm not able to put a decimal on my timer from the spawner.

    Why are you unable to use a decimal value in your timer ? Are you using the standard Timer behaviour or a custom timer of some kind ?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • evertevert Member Posts: 266
    edited December 2016

    This example makes the space between the spawner to big again. So this is not a sollution because i already have this

    @Socks said:

    @evert said:
    Made a game.speed (starting at 100) for the moving object so every 5sec game.speed+10, but i put this on the 'move' of the object because i'm not able to put a decimal on my timer from the spawner.

    Why are you unable to use a decimal value in your timer ? Are you using the standard Timer behaviour or a custom timer of some kind ?

    i'm able to use a decimal, but i'm not able to change the decimal over time.
    if i make a real game.speed of 0.3 i'm not able to do game.speed-0.1 to get game.speed 0.2

    It won't do anything for some reason.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ArmellineArmelline Member, PRO Posts: 5,367

    It sounds like what you need to do is to work out the relationship between the speed and the spawn time. The faster it moves, the shorter the spawn time.

    So if you're spawning a dot every 0.5s when the actor is moving at 100px/s, then it needs to spawn every 0.25s when the actor is moving at 200px/s. Once you've worked out that relationship, both the demo @tatiang linked of mine and the one he linked of his own allow you to change the spawning time as the speed changes.

  • evertevert Member Posts: 266

    @Armelline said:
    It sounds like what you need to do is to work out the relationship between the speed and the spawn time. The faster it moves, the shorter the spawn time.

    So if you're spawning a dot every 0.5s when the actor is moving at 100px/s, then it needs to spawn every 0.25s when the actor is moving at 200px/s. Once you've worked out that relationship, both the demo @tatiang linked of mine and the one he linked of his own allow you to change the spawning time as the speed changes.

    Yes indeed,
    But i still can't figure how to make it from 0.5 to 0.25, i have a real attribute (game.speedchange) set at 0.5
    when i do every 5 sec change game.speedchange to game.speedchange-0.25 nothing happens, it keeps going at 0.5. So how do i get my real attribute to change? (this one is the spawner time)

    My integer game.speed is set at 100 and does after 5sec change attribute game.speed to game.speed+10 works pretty good! (this one is for my move acceleration)

  • ArmellineArmelline Member, PRO Posts: 5,367
    edited December 2016

    What is your ultimate aim? As using accelerate complicates this and I'm not clear on what you're trying to achieve (other than uniform dots) and why you're using accelerate if so. If they're speeding up, but you're keeping the spawned dots evenly spaced, how is it even going to be noticeable that they're speeding up? I'm struggling to get my head around what your end result is supposed to look like and why, even with the demo project.

  • evertevert Member Posts: 266
    edited December 2016

    I recreated my setup.

    I have a spawner spawning my object according to game.spawn_speed
    I have a dot accelerating with game.move_speed

    and a spawner rules object in my scene setting every 3sec change:
    game.move_speed to game.move_speed+50
    and
    game.spawn_speed to game.spawn_speed-0.25

    Attribute game.move_speed is an integer starting at 100
    Attribute game.spawn_speed is a real starting at 0,5

  • ArmellineArmelline Member, PRO Posts: 5,367
    edited December 2016

    Okay that makes more sense.

    I'd presume my method posted earlier would work, with the spawn timer set to

    1-(speed/200)

    Then as the speed increases, the time between spawns decreases and the gap should remain consistent.

    GS's ability to accurately render the moving dots will start to fail fairly quickly, though, at those speeds.

  • evertevert Member Posts: 266

    @Armelline said:
    Okay that makes more sense.

    I'd presume my method posted earlier would work, with the spawn timer set to

    1-(speed/200)

    Then as the speed increases, the time between spawns decreases and the gap should remain consistent.

    GS's ability to accurately render the moving dots will start to fail fairly quickly, though, at those speeds.

    Could you tell me where i set this 1-(speed/200) in my example? :)
    Thanks

  • evertevert Member Posts: 266

    @Armelline said:
    What is your ultimate aim? As using accelerate complicates this and I'm not clear on what you're trying to achieve (other than uniform dots) and why you're using accelerate if so. If they're speeding up, but you're keeping the spawned dots evenly spaced, how is it even going to be noticeable that they're speeding up? I'm struggling to get my head around what your end result is supposed to look like and why, even with the demo project.

    Send you a demo of my game via dropbox link in a PM, you'll see what i'm trying to do ;)

  • ArmellineArmelline Member, PRO Posts: 5,367

    You can't do what you want with a timer. You need to look at the demo of mine that @tatiang linked, which automatically updates the self-made timer whenever the attributes used are changed.

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2016

    @evert said:
    But i still can't figure how to make it from 0.5 to 0.25, i have a real attribute (game.speedchange) set at 0.5
    when i do every 5 sec change game.speedchange to game.speedchange-0.25 nothing happens, it keeps going at 0.5. So how do i get my real attribute to change? (this one is the spawner time)

    You really need to explain the whole process rather than just one part of it, that's kind of the point of my original post above, without the right information even simple problems turn into random guessing games.

    Taking a look at the project you uploaded, what you weren't clearly communicating was how you were using this attribute (game.speedchange), so it was a near impossible issue to resolve for someone without access to that information.

    The problem is not with the attribute changing . . . if you use a simple Display text behaviour somewhere you can monitor what game.speedchange is doing, and you can see it is going down exactly as you've programmed it to . . . . the problem is with the Timer behaviour, it is set to 'Every', you are giving it a value (the first value it encounters) and then it will iterate the code within it 'every' that value. So any change to the value after the Timer has started doing it's thing will have no effect.

    Think of it like this, you tell a paper boy to post a newspaper in every 3rd house, off he runs down the street, posting in door 1, 4, 7, 10, 13 . . . etc, when he is out of sight and cannot hear you, you then say - in a normal speaking voice - "ok, now change to posting a newspaper in every 5th house" . . . . nothing changes, because you've already sent him on his way with the instruction to post a newspaper in every 3rd house.

    Ok, that's maybe the worst analogy ever, lol :smiley:

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2016

    @Armelline said:
    You can't do what you want with a timer.

    EDIT . . . .basically I've spent 200 words trying to say what @Armelline managed to say in 9.

    :D

  • SocksSocks London, UK.Member Posts: 12,822

    This should do it . . .

Sign In or Register to comment.