Changing a Timer's Time as It's Going

Goodnight GamesGoodnight Games NYCMember, PRO Posts: 184
edited July 2012 in Working with GS (Mac)
I'm currently building a combo system where every time the player kills a new enemy it resets the time.


I'm currently trying to do this by having the timer start when the player kills an enemy it sets off a boolean to start the timer so the rule goes:

If boolean is true:
Timer starts with time based on an attribute called ComboTime. After ComboTime expires all the variables reset and this part works great.

The problem comes when I want the timer to start over at the original time when a new enemy is hit. I did this by having the ComboTime attribute change to 5 every a new enemy is killed when the combo is started. It doesn't seem to be resetting the timer.

I'm not entirely sure this method is working am I doing something wrong or is there a better way?

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @neondevil

    Hi, yes, you need a way to reset the Timer before it starts off again, in a loop mechanism.

    One way to do this: makeyour boolean set to false when an enemy is hit, then immediately after set it back to true again. Make sure you haven't got Run to Completion checked on your Timer.

    This is off the top of my head, but it should work out; if not, I'll checkout something similar I've used in a previous game file for you.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MotherHooseMotherHoose Member Posts: 2,456
    edited July 2012
    @neondevil … when actions/events are specific to an individual actor
    try keeping the control/tracking/running of the those actions/events on that actor

    … have each enemy track its individual hits for combos

    demo: http://www.mediafire.com/?fetfceivn65fuws

    image MH
  • Goodnight GamesGoodnight Games NYCMember, PRO Posts: 184
    You are a poet and a scholar for that. It's not quite what I'm trying to do but I was able to change it with a boolean that activates when pressed and resets the time back so awesome!

    Now I just need to switch it so the combo count and timer are global because all my enemies die in one hit then I should be golden.

  • Goodnight GamesGoodnight Games NYCMember, PRO Posts: 184
    @gyroscope wow I didn't scroll up like a jerk but yeah that seems plausable I'm going to try it right now.
  • Goodnight GamesGoodnight Games NYCMember, PRO Posts: 184
    I've combined both your guy's solutions but I have one last problem. The timer doesn't fully work. The first time it'll just subtract .1 once but the second time it will continually subtract. I need it continually subtracting every time. Any idea guys? Thanks again.

    Here is the code:
    http://i.imgur.com/SK9h6.jpg
Sign In or Register to comment.