something akin to:
Code: Select all
def hit():
health -= 10
renpy.vpunch()
Code: Select all
def hit():
health -= 10
renpy.vpunch()
Code: Select all
renpy.with_statement(vpunch)
Code: Select all
Exception: Cannot start an interaction in the middle of an interaction, without creating a new context.
Code: Select all
renpy.invoke_in_new_context(renpy.with_statement(vpunch))
Code: Select all
renpy.call_in_new_context(shake)
label shake:
with vpunch
return
Code: Select all
init python:
def do_a_punch():
renpy.with_statement(vpunch)
screen test_vpunch:
modal True
key "w" action Function(do_a_punch)
label start:
show screen test_vpunch
pause
Code: Select all
label do_a_punch:
with vpunch
return
This is something completely different. renpy.vibrate() is about making your Android phone vibrate, if supported. The question was about making the screen visually shake using vpunch. And as I wrote, calling a label (either via a screen or a python function) works without problems.
Code: Select all
def do_a_punch():
renpy.transition(vpunch)
renpy.restart_interaction()
What screen is hiding during the vpunch? Nothing is hiding on my end calling that label.
Code: Select all
init python:
def do_a_vpunch():
renpy.call("do_a_punch")
screen vpunch_test:
modal True
button:
text "Punch"
action Function(do_a_vpunch)
label do_a_punch:
with vpunch
label start:
call screen vpunch_test
Calling a label stops current interaction. Called screens are transient: they are automatically hidden at the end of interaction. Move transition (and vpunch as a subset of it) use only new_widget, so if a screen is hidden between interactions, it is not visible buring transition.
Screens can be shown using transition. Since 'vpunch' affects the whole screen, you can show some empty screen using it. Like
Code: Select all
screen test_scr():
textbutton "ClickMe!" action Show("shake_scr", vpunch) align(0.5, 0.5)
screen shake_scr():
timer 0.5 action Hide("shake_scr")
# The game starts here.
label start:
"..."
show screen test_scr
"... ..."
hide screen test_scr
"___"
call screen test_scr
"?!"
Don't call the screen, but show it. You can hide it whenever you want anyway. Everything works fine this way.
Code: Select all
label start:
show screen vpunch_test
Users browsing this forum: Bing [Bot]