Godot Learning - Part 5

Dialogue Boxes Part 2

  var stopInteracting = false

  # only continue if everything is ok
  if isInteracting and isAllowedToContinueInteracting and Input.is_action_just_released("ui_accept"):
    emit_signal("continue_interaction", "next")
    isAllowedToContinueInteracting = false

  # have to release the key to continue
  if !Input.is_action_pressed("ui_accept"):
    isAllowedToContinueInteracting = true

  if canMove && !isInteracting:
    if interactTarget && Input.is_action_just_released("ui_accept"):
      isInteracting = true
      emit_signal("start_interaction", self)
      isAllowedToContinueInteracting = false

  if stopInteracting:
    isInteracting = false
    stopInteracting = false

This gets a little weird with a menu system, though, as I want the DialogBox to control input. I may move Player and DialogBox Input handling up to Main and send it down to the appropriate objects based on game state.

  # CoolCat.gd

  var cat setget set_cat

  func set_cat(newCat):
    cat = newCat
    do_cat_things()

  func _process():
    if somethingHappens:
      cat = "meow" # do_cat_things is not called.