Best option for checkpoint/trigger events in non-linear gameplay?

Looking for suggestions on reaching goals in a level, triggering check points (that you can restart from) and triggering events to happen In game that follows no linear path (takes place in space so you move in all directions).

I thought of using game.timer in cases as 'if game.timer=50 then release bad guys' etc. but if you die and go back to check point can you reset timer or put it back to that time point?

Is there something I can do with tables to assist in this? Like a check list when goals are completed and such.

Any thoughts appreciated.

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    I like to keep it simple, so this will seem archaic, but it does work!

    I have some sort of timer that will trigger events. For example, in my Air Supply games the time will be distance, as that goes up all the time while you're running.

    So, when distance = 3000, trigger UFO.

    Then I will probably add a self.timer to the UFO.

    Once distance = 3000 trigger UFO. Trigger self timer to start.
    When self timer = 2000, trigger UFO again.
    If UFO is destroyed, goes off-screen, then set UFO self timer to 0.


    Essentially what happens is you trigger the UFO first when distance = 3000
    The UFOs timer will make it come back every 2000 clicks of its timer.

    I like to vary it a little too, by making the trigger variable (but not by much).

    e.g. when distance = random(2800,3200) then trigger UFO.

    This makes stuff less predictable.

    Hope some of that makes sense!

    QS =D

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

  • SingleSparqSingleSparq Member Posts: 1,339
    So you use your own timer as opposed to game.timer. That way you can send yourself back to a check point base on a set time (and reset the time accordingly). Okay I'll look at that first. Thanks QS!
  • SingleSparqSingleSparq Member Posts: 1,339
    edited September 2013
    Works well! I have a global integer set for enemies Called enemyHRR (Hold, Release, Retreat) default is 0 (hold) so when time=20 change to 1 (release) and they attack after 6 are killed change to 2 (retreat) and off they go, then 0 to hold again. Rinse and repeat. I keep the kills amount dynamic to so it can be changed to make things harder or easier. I love it when a plan comes together :D
  • quantumsheepquantumsheep Member Posts: 8,188
    \o/

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

Sign In or Register to comment.