Why isn't my timer working?

  • Hi I have this for a 10 second timer but my player doesn't go invincible for 10 seconds.

    Any ideas on how to rectify this?

  • imho, you can use a global variable,

    • add global variable (value = 0)
    • you can still use action 1 until line 6
    • system >>> every 1 second,,, system >>> add 1 to (global variable)
    • system >>> (global variable) = 10,,, use your action line 8 - end

    try it

    mochiz

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This isn't a timer, but a wait action..

    Could be better to use the timer behaviour for something like this though

    give the player timer behaviour

    instead of the wait action use start timer for 10 seconds

    and on timer - setthe actions now below the wait action..

    I would actually choose to put all events concerning collision with enemies in a group and de-activate that group during the "invincible" period..

  • mochiz did you mean like this, I did it but it only lasts one second

  • right after adding 1 to GOD, you are setting GOD to 10, so the adding 1 action is useless..

    Also this happens every second no matter what..

    I guess you only want to add 1 while the powerup is working, so you should add a condition for that

    instead of the set god to ten action, create a system compare variable GOD = 10 event and add the actions to that..

    This event should only trigger once while true, so you should add that condition..

  • Thanks guys LittleStain I decided to try your method which worked well many thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)