No announcement yet.

Increasing the time.

  • Filter
  • Time
  • Show
Clear All
new posts

    Increasing the time.

    I'm creating a collecting game, but I am having issues. My main goal is to increase the time by 5 seconds for every ball collected. What do I need to do to complete the function?


    Are you using timers?

    If not, you could use the node called 'SetTimerByFunctionName' and setting the 'Time' input to 1 and the 'Looping' boolean to true. Then make a function, name it 'UpdateTimeRemaining' and make sure that you type the name of the function inside the 'FunctionName' input of your 'SetTimerByFunctionName' node. Create an integer called 'RemainingTime', set it's default value, and then decrement it by 1 in the 'UpdateTimeRemaining' function. Optionally, if you want your game to be over when the time is up, you can make a branch node after setting the remaining time to check if it is greater then 0.

    For the incrementing part, create an 'OnActorBeginOverlap' event on your actor that has the timer and cast the 'OtherActor' to your ball class. If the cast is successful, you can add 5 to your 'TimeRemaining' variable, so the timer (which will run every second) will decrement the updated value.

    I hope this will help you.
    Last edited by Kontur; 06-13-2016, 10:06 PM.