time variable in minigame
I made a minigame in my vn where there's a circle constantly falling down a bar and you have to press space to get it in the desired section of the bar. If you stay at any section for 5.0 seconds, you will go to the corresponding label to that section. Right now, my code works fine. But I want there to be text to the right of the bar that says "x seconds left until you go to the label". X being 5.0 minus how long you already spent there. But I don't know how to get a value of how long you already spent there from renpy's timer thing. I tried to use python's time.time() thing, but I don't know how to implement something like that. My code is below.
init python:
renpy.image("circle", "minigame circle")
renpy.image("happy", "minigame happy")
renpy.image("neutral", "minigame neutral")
renpy.image("sad", "minigame sad")
yCoor = 100
def minigame():
global yCoor
if yCoor<800:
yCoor += 10
if yCoor<100:
yCoor = 100
def up():
global yCoor
yCoor-=80
screen game:
add "bg room-blurred"
add "minigame bar" xpos 1000 xanchor 0.5 ypos 100 yanchor 0.0
add "circle" xpos 1000 xanchor 0.5 ypos yCoor yanchor 0.0
if yCoor < 250:
add "happy" xpos 100 ypos 100 xanchor 0.0 yanchor 0.0
timer 5.0 action Jump("temp1")
elif yCoor < 520:
add "neutral" xpos 100 ypos 100 xanchor 0.0 yanchor 0.0
timer 5.0 action Jump("temp2")
else:
add "sad" xpos 100 ypos 100 xanchor 0.0 yanchor 0.0
timer 5.0 action Jump("temp3")
key "K_SPACE" action Function(up)
timer (1.0/30.0) repeat True action Function(minigame)