Game Timer
Billyd1
Member Posts: 133
Hi , is there away to make the game timer go down showing a colored bar when the time is running down instead of numbers.
Thanks
Thanks
Comments
This could also run off an actor's timer too if you don't want to account for overall game time from scene/level to scene/level.
Then you can create a timer actor and place it in the scene. You constrain this actor's width to a math expression based on the value of "game.Timer - SceneTime". You will want to multiply that value by some constant to scale the width accordingly (i.e. multiply by numbers smaller than 1.0 to shrink it and numbers larger than 1.0 to enlarge it). You would probably want to set this actor's initial width to "SceneTime" (i.e. in the actor prototype).
Since the coordinates of an actor are at its center, you will then need to also constrain the timer actor's X position to be "OrigXPositionWhereYouPlacedIt - (floor(game.Timer - SceneTime) / 2)". That will ensure it looks like it is getting smaller but always anchored by its left side. If you leave out this step, the time "bar" will always be centered no matter what time is left (which you may very well want). You may need to play around with this bit a little.
If you want an outline around the time bar (to show its full size to give perspective when it starts to shrink), either layer another outline box actor the appropriate width/height behind the timer bar or you can animate the shrinkage effect and forget everything I told you here except for the first paragraph since you will use something similar in deciding which graphic to use based on the "game.Time - SceneTime" value.