Question on time

mikbiomikbio Member Posts: 54
edited November -1 in Working with GS (Mac)
Hi, i've made a game where there are some random spawns every 2 second, ho can i make the spawns become faster with the passing time.

Il' try to explain myself better. I have this behavior :

Every 2 secs change attribute game.atribute = (1,16)

now i would like to change that atribute every second after 1 minute of game and every 0,5 seconds after 2 mins and so on.

I hope someone can help me finding the solution to my problem.

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    I like to use a counter that counts up 1 every second.

    You can then tell the game to do stuff at certain points.

    For example:
    Make an integer variable called 'counter'

    In an actor put in the rule:
    Timer: Every 1 second
    Change attribute counter to counter +1

    Then put an actor somewhere to display the counter variable while you're testing your game. You can judge when you want something to happen.

    In your case it's quite easy as you want it after a minute.

    So you'd have a rule that says

    If Counter is less than 60 , spawn every two seconds

    If counter is greater than or equal to 60, spawn every second

    If counter is greater than or equal to 120, spawn every .5 seconds.

    That might help, though I'm sure there are more efficient ways..!

    Good luck!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • outsidethebyteoutsidethebyte Member Posts: 115
    Use the actor's (the one that is spawning) time value and a local attribute.

    Example:

    Constrain self.SpawnRate to (self.Time/60)

    Timer Every (1/self.SpawnRate)
    Spawn

    I haven't actually tested this, but it makes sense.

    After 10 seconds, self.SpawnRate would equal 0.1666666, so it would spawn every 6 seconds.

    After 120 Seconds, self.SpawnRate would equal 2, so it would spawn every .5 seconds, and get faster rapidly.

    You could mess with the ratios to get your desired rate of change.

    For more help, contact me at http://outsidethebyte.com/design.html (I'll email you a more detailed answer)
  • mikbiomikbio Member Posts: 54
    Thank you very much for your help, i've used both methods and they both work great.
Sign In or Register to comment.