'moveto' go faster over time

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

hi all,

I need my actors spawning faster progressively.
My actors are moving from the right to the left.
Here is how they spawn, now they need to go faster progressively.

Thanks

Comments

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

    @evert said:
    hi all

    The random function produces an integer value . . . so 0.5 will give you 0

    If you want a 'real' value you can just throw a little maths at it.

    So for random(0.5,5) you could use random(50,500)/100

    Also, once the timer has set its random value, it will always produce that random value, so a timer that says Every 1 second change XXX to random(0.5,1) will either give you a 0 every second (with no change are timer progresses) or a 1 every second (with no change are timer progresses) - the random value once set will not change.

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

    Here is how I would do it . . .

    Demo: https://www.mediafire.com/?5os0ff2hflml497

    (you may have to add .gameproj onto the end of the file name if it won't open for you)

  • evertevert Member Posts: 266
    edited December 2014

    @socks Yes i've got what you mean!
    But i think i asked my question wrong.

    They spawning on itself is good and the way it spawns to, but it needs to go faster over time, now there is a random spawning system so you got something like this:
    -- _ _ -_ - --- __ - (random) but its more the speed from right to left that needs to go faster. See it like flappy bird, you got the bars heading from right to left. They need to go faster over time but the way they are positioned is random.

    So i've got random positioning now, and the way they move from right to the left must go faster over time. you showed me a faster spawning. (also thanks)

  • evertevert Member Posts: 266
    edited December 2014

    Hi all,

    I had a question over here but i asked it wrong (http://forums.gamesalad.com/discussion/74555/speeding-up-spawning-progressively)

    So i'll start again.
    i have a 'move to' for one of my spawning objects. Its goes from the right to the left at a speed of 65.
    Now lets say i want the first 5 objects to spawn (random) on the right and move to the left at a speed of 65. (this i've got)

    But what the problem is, that if i want to spawn the next 5 objects and move them at a speed of 65 i need to find a way to add +25 speed to those 5 objects. So the first 5 at 65, the second 5 at 65+25= 90 speed. and so on...

    I tried an integer+25 with a timer, but what happens then is that the object spawns at 0speed and ads 25 speed every 2 sec to that same object. This is not what i'm looking for.

    Thanks

    Move to on object/actor:

    Spawning trigger:

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

    @evert said:
    . . . it needs to go faster over time

    Here you go: https://www.mediafire.com/?95dbdkqguav2op0

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

    To speed up actors over time, create a real attribute called game.actorSpeed and set it to a value such as 10. In each actor, set the Move behavior speed to game.actorSpeed. Then use a timer that changes game.actorSpeed:


    Every 5 seconds
    Change Attribute game.actorSpeed to game.actorSpeed*1.5

    For example, if you set game.actorSpeed (real attribute) to 10, then every 5 seconds it will increase by 50%: 10, 15, 22.5, 33.75. Or you could just add a constant to the speed every so many seconds.

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

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

    I've merged your two threads. We prefer to keep everything related to one question in a single thread.

    But what the problem is, that if i want to spawn the next 5 objects and move them at a speed of 65 i need to find a way to add +25 speed to those 5 objects. So the first 5 at 65, the second 5 at 65+25= 90 speed. and so on...

    You could try adding an integer game attribute called game.spawnCount and add one to it each time an actor is spawned. Then in the spawned actor, Change Attribute self.speed to 65+(ceil(game.spawnCount/5)-1)*25. And use self.speed as the MoveTo speed.

    Note: The ceil() math function rounds up to the nearest whole number. So when game.spawnCount is 1, that entire expression will return 65+(1-1) * 25=65. When game.spawnCount is 6, that expression will return 65+(2-1) * 25=90. When game.spawnCount is 11, that expression will return 65+(3-1) * 25=115, etc. By the way, you can test out math expressions in Spotlight in OS X. Just type something like "65+(ceil(11/5)-1) * 25" without the quotes and then substitute any number you like for 11.

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

  • evertevert Member Posts: 266

    yes! fixed it! thanks guys!

Sign In or Register to comment.