Code: Select all
init 15 python:
qte_bar = 90
qte_clicks = 0
qte_zone_1 = 0
qte_zone_2 = 0
qte_score = 0
qte_hit = False
qte_speed = 1
qte_point_pos = 700
qte_button_pressed = 0
qte_bar_side = 0
init:
transform qte_point_move(frp):
xpos 560 + frp *7
subpixel True
ypos qte_point_pos
screen qte_minigame:
if qte_clicks < 1:
add "qte_bar1.png" align(0.5, 0.85)
if qte_clicks < 2:
add "qte_bar2.png" align(0.5, 0.90)
if qte_clicks < 3:
add "qte_bar3.png" align(0.5, 0.95)
add "qte_point.png" at qte_point_move(qte_bar)
text "[qte_bar] Bar value" align(0.5,0.2)
text "[qte_clicked] clicked | [qte_button_pressed] Pressed" align(0.5,0.3)
text "[qte_hit] hit" align(0.5,0.4)
text "[qte_point_pos] pos" align (0.5, 0.5)
text "[qte_bar_side] side" align (0.5, 0.6)
if qte_clicked < 3:
key "K_SPACE":
if qte_button_pressed == 0:
if qte_bar >= qte_zone_1 and qte_bar <= qte_zone_2:
action [SetVariable("qte_clicked", qte_clicked + 1), SetVariable("qte_button_pressed", qte_button_pressed +1), SetVariable("qte_point_pos", qte_point_pos + 60), SetVariable("qte_hit", True), SetVariable("qte_zone_1", qte_zone_1 + 3), SetVariable("qte_zone_1", qte_zone_2 - 3), SetVariable("qte_speed", qte_speed + 0.5), SetVariable("qte_score", qte_score + 1)]
else:
action [SetVariable("qte_clicked", qte_clicked + 1), SetVariable("qte_button_pressed", qte_button_pressed +1), SetVariable("qte_point_pos", qte_point_pos + 60), SetVariable("qte_hit", False), SetVariable("qte_zone_1", qte_zone_1 + 3), SetVariable("qte_zone_1", qte_zone_2 - 3), SetVariable("qte_speed", qte_speed + 0.5)]
else:
action NullAction()
screen qte_timer_left:
timer 0.0001 repeat True action [If(qte_bar > 0, SetVariable("qte_bar", qte_bar - qte_speed)), If(qte_bar <= 0, Hide("qte_timer_left"), Show("qte_timer_right")), If(qte_bar <= 0, SetVariable("qte_button_pressed", 0))]
screen qte_timer_right:
timer 0.0001 repeat True action [If(qte_bar < 100, SetVariable("qte_bar", qte_bar + qte_speed)), If(qte_bar >= 100, Hide("qte_timer_right"), Show("qte_timer_left")), If(qte_bar >= 100, SetVariable("qte_button_pressed", 0))]
screen qte_timer_main:
timer 500.0 action Jump("end_minigame")
label start_minigame:
$ qte_point_pos = 700
$ qte_clicked = 0
$ qte_score = 0
$ qte_zone_1 = 30
$ qte_zone_2 = 70
$ qte_speed = 1
$ qte_button_pressed = 0
$ qte_bar = renpy.random.randint(1, 99)
$ qte_bar_side = renpy.random.randint(0, 1)
if qte_bar_side == 0:
show screen qte_timer_left
else:
show screen qte_timer_right
show screen qte_timer_main
call screen qte_minigame
label end_minigame:
hide screen qte_minigame
hide screen qte_timer_left
hide screen qte_timer_right
$ renpy.pause(0.3)
jump end #continue game