Skip to reading
Adventure Mechanics & Effects

End the match and hand back the controls

Edition 0.86.3.4

Build authored boxing, camera moves, weather, attachments, inspectable objects, a radio and two-object puzzles using the existing adventure tools and scripts.

Download PDFView PDF page

LIVE BOXING SCRIPT / G OF G

Append these final functions, select Keep global instance alive, then Apply / Save Script. Save the project. Return to page 6 to connect the starting verb or page 8 to check an existing setup.

Code example
func suspended():
    return (not focused or get_tree().paused or Runtime.system_menu.is_open()
        or not Runtime.active_system_gui_id.is_empty())
Code example
func forget_keys():
    held.clear()
    if live and fighters[0].age >= READY:
        defend(0, "")
Code example
func _notification(what: int) -> void:
    if what == NOTIFICATION_APPLICATION_FOCUS_OUT:
        focused = false
        forget_keys()
    elif what == NOTIFICATION_PAUSED:
        forget_keys()
    elif what == NOTIFICATION_APPLICATION_FOCUS_IN:
        focused = true
Code example
func finish(message):
    live = false
    held.clear()
    Runtime.hide_gui("spar")
    Runtime.set_player_input_enabled(old_input)
    if message != "":
        pose(0, "idle")
        pose(1, "idle")
        Runtime.show_message(message)

Losing focus clears held guard keys so the player cannot return with a key stuck down. With the play window active again, press the guard you want. A loss, draw or withdrawal leaves spar_won unset, and the next interaction restores both fighters to full health.

Page 27 of 29Permalink
Go to page