Is It Possible To Change A Timer While The Game Is Running?

KevinCrossKevinCross London, UKMember Posts: 1,894
edited September 2013 in Working with GS (Mac)
Hi

Does anyone know how to change a timer while a game is running please? Setting the expression of the timer with a self or game attribute doesn't change it once the timer has initially been created.

I'm moving an item in a table down a row every 0.5 seconds, but I want it to move down quicker if the down cursor key is pressed, so changing the timer to 0.1 or 0.05 seconds etc. I have the down key changing the speed attribute.

It's currently:

Timer: Every game.Movement Speed Seconds
Move data down in table

I thought this below fix might have worked but the initials speed is faster than I want and it seems a bit sporadic in moving down.

Timer: Every 0.0 Seconds
Change Attribute: Time In Existence = self.Time % game.Movement Speed
Rule: If Time In Existence = 0
Move data down in table

Thanks in advance

Best Answer

Answers

  • MantoManto Member Posts: 796
    I'm not sure if this works for you, but one way would be to make a rule:

    If down cursor key is pressed
    -- Timer Every 0.1
    -- Move data
    otherwise
    -- Timer Every 0.5
    -- Move data
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    Thanks @Manto1, but I was hoping to not have to have two rules, so as not to duplicate the code for moving the data but I'll give it a go.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Thanks @Manto1 that example is exactly what was needed! :) I just need to work out how to switch it to mine.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Well that's pants. Accepting an answer removes attachments. Here's the file @Manto1 attached in case anyone else wants a copy.
Sign In or Register to comment.