increasing difficulty

RocketBrainRocketBrain Member, PRO Posts: 269
edited November -1 in Working with GS (Mac)
hey all, need some help.

in the timer behavior can the time be a value such as game.difficulty?

the game i'm working on needs that time to be reduced gradually so i tried doing

timer: every game.difficulty second
spawn actor: actor1

timer: every game.difficulty second
change attribute: game.difficulty = game.difficulty - 1

in my mind that should make game.difficulty go down by 1 second every round, and then spawn an actor that many seconds.

so set the starting value at 10.

first round every 10 seconds it spawns actor one.
next round every 9 seconds..
next round every 8 seconds..
....

but it doesnt work. any ideas?

Comments

  • RocketBrainRocketBrain Member, PRO Posts: 269
    hmmm should i be using a rule?
  • synthesissynthesis Member Posts: 1,693
    Make the spawn timer (10,9,8...) also a variable that dynamically reduces by 1.
    Use a game counter that ticks up with each spawn that counts how many actors are spawned.
    Then in an invisible controller actor...have a rule that states:

    [ DEFAULTS ON SCENE START ]
    change attribute: game.gameOver = false
    change attribute: game.roundID = 1
    change attribute: game.spawnCount = 0

    RULE:
    when game.spawnCount = self.spawnsPerRound and game.gameOver = false
    .....game.roundID = game.roundID + 1
    .....game.spawnCount = 0 (this resets the counter for the next round)
    .....RULE (EMBEDDED IN ABOVE RULE):
    ..........when game.roundID = 11
    ..........game.gameOver = true (this will shut off the loop when 10 rounds are complete)

    Then have in your game's controller actor as well...below (and separate from) the above rule:
    RULE: when game.gameOver = false
    ...Timer: every [ 10 - game.roundID ] seconds >>
    .......spawn actor >> actor1
    (this will spawn an actor from 10 to 1 seconds with a reduction by 1 second each round)

    Then in your separate spawning actor...
    RULE:
    game.spawnCount = game.spawnCount + 1

    Another way to do your spawn timer is:
    Timer: every [ 2 - (game.roundID * 0.1) ] seconds >>>
    .....spawn actor >> actor 1
    This will make the actors spawn every 2 seconds at first round...then reduce by 0.1 seconds to 1 second by the end of the 10th round.
  • synthesissynthesis Member Posts: 1,693
    The key to working out logic sequences like this is to take everything 1 tiny step at a time making sure each step is executed flawlessly before programming the next step. Don't try to do things simultaneously...do things in a sequence.
  • RocketBrainRocketBrain Member, PRO Posts: 269
    thanks bud, that really helped.
Sign In or Register to comment.