Code: Select all
screen qte():
key ["h"] action Jump("qte_continue")
else:
action Jump("qte_fail")
Code: Select all
screen qte():
key ["h"] action Jump("qte_continue")
else:
action Jump("qte_fail")
Try it like
Code: Select all
screen qte_1_scr(right_key, time_to_press, fail_label='', win_label=''):
# just a mark for test purposes
text "qte_1_scr is shown" align (0.5, 0.05)
# to force player interact with the screen
modal True
# hide the screen and jump to fail_label after time is gone
# (if fail_label is specified)
if fail_label:
timer time_to_press action [Hide('qte_1_scr'), Jump(fail_label) ]
# or just hide the screen and process to next line of code
else:
timer time_to_press action [Hide('qte_1_scr'), Return()]
# hide the screen and jump to win_label on right_key press
# (if win_label is specified)
if win_label:
key right_key action [Hide('qte_1_scr'), Jump(win_label)]
# or just hide the screen and process to next line of code
else:
key right_key action [Hide('qte_1_scr'), Return()]
screen qte_2_scr(right_key, time_to_press, fail_label='', win_label=''):
text "qte_2_scr is shown" align (0.5, 0.05)
modal True
for key_ in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ':
if key_ == right_key:
if win_label:
key right_key action [Hide('qte_2_scr'), Jump(win_label)]
else:
key right_key action [Hide('qte_2_scr'), Return()]
else:
if fail_label:
key key_ action [Hide('qte_2_scr'), Jump(fail_label) ]
else:
key key_ action [Hide('qte_2_scr'), Return()]
label start:
"..."
show screen qte_1_scr(right_key='j', time_to_press=7.0, fail_label='fail_lbl', win_label='win_lbl')
"Press j key (you have 7 sec.)..."
label fail_lbl:
"x_x"
jump start
label win_lbl:
"Well done."
show screen qte_1_scr(right_key='z', time_to_press=5.0, fail_label='fail_lbl') # win_label is not specified
"Press z key (you have 5 sec.)..."
"Well done #2."
show screen qte_2_scr(right_key='L', time_to_press=7.0, fail_label='fail_lbl') # win_label is not specified
"Press L (capital) key, the other key counts as fail, (you have 7 sec.)..."
"Well done #3."
show screen qte_2_scr(right_key='U', time_to_press=5.0, win_label='win_2_lbl') # fail_label is not specified
"Press U (capital) key, the other key counts as fail, (you have 5 sec.)..."
"You failed..."
jump start
label win_2_lbl:
"You win!"
return
Users browsing this forum: No registered users