Change the rate of Spawning Enemies

jkornoffjkornoff Member Posts: 55
edited November -1 in Working with GS (Mac)
Hi, and thanks in advance for the help.

I have two enemies. The initial spawn rate is one every 2 and 5 seconds respectively. Easy.

But now I am trying to slowly increase that rate over time. The longer you survive, the more often the enemies spawn.

I guess I'm not clear on how to change a game integer attribute. I've got a game.Level attribute set at 1. My enemies spawn using a timer set at every game.Level+1 and game.Level+4. So initially every 2 and 5 seconds.

Even after reading the tutorials I haven't successfully been able to change the game.Level value it seems.

Comments

  • iDeveloperziDeveloperz Member Posts: 1,169
    How did you get them to spawn?
  • jkornoffjkornoff Member Posts: 55
    I have two timer rules attached to the background, each timer has a Spawn Actor behavior inside it.
  • jkornoffjkornoff Member Posts: 55
    What I'm trying to do is something as simple as create a timer that says, every 5 seconds, change game.Level to game.Level-.2

    But that doesn't work for me.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    it's an attribute right?

    create a new actor called timer (or whatever you want). Make it a 25 x 25 actor and just put it outside the field of view.

    Create a timer in it
    every 10 seconds
    change attribute game.Level to game.Level+1

    as long as game.Level is an integer, that will increase it by 1 every five seconds.

    then in your spawner, create a few rules

    if game.Level < 5
    timer every 5 sec
    spawn actor

    if game.Level < 10
    timer every 3 sec
    spawn actor

    if game.Level < 15
    timer every 1 sec
    spawn actor

    etc.

    something like that should work.
  • jkornoffjkornoff Member Posts: 55
    Wow. That did it. I tweaked some of your suggestions a but to get the exact results I needed, but your's was an idea I hadn't thought of.

    Thank you!
Sign In or Register to comment.