Maze game timing setup

Hi guys ,

thanks for reading this in advance , i have a question regarding setup a bluebrint for my small game , its actually a maze a 3d maze and i need to setup a time where the player will start and once the time finish i should get a game over and start again , can u help me with this ???

Regards

Hello,

You can use “Get Game Time in Seconds”

With this you can put a button to Start you game, get this time like a “FirstStartSec”.

In your UMG every time get secs and subtract by FirstStartSec, divide it by 60 and you can get min played.

like this -> (“Get Game Time in Seconds” - FirstStartSec)/60 = Min Played… with more work and some validations (If the subtraction is greater than 60, etc) you can make a clock with HH-MM-SS

Regards!

Alternatively, OnBeginPlay you could call a custom event (EventStartTimer). This event starts a timer that loops every second. The event then Adds 1 to an integer (effectively setting the integer to the time passed in seconds). Then you could do a Branch on the integer and check if its bigger than X (time limit for your game). If true, End the game, if not do nothing.

You could also create a Widget that displays the time passed (bind a text field to the value of the integer in your Blueprint).

This should get you started.

Hope this helps!

Thanks guys i really appreciate your help and will do my best to follow both options and fix the time , thanks and best wishes for both of u