samples/13_path_finding_algorithms/03_breadcrumbs/app/main.rb
def detect_input
    # When the mouse is up, nothing is being edited
    if inputs.mouse.up
      state.current_input = :none
    # When the star in the no second grid is clicked
    elsif star_clicked?
      state.current_input = :star
    # When the target in the no second grid is clicked
    elsif target_clicked?
      state.current_input = :target
    # When a wall in the first grid is clicked
    elsif wall_clicked?
      state.current_input = :remove_wall
    # When the first grid is clicked
    elsif grid_clicked?
      state.current_input = :add_wall
    end
  end
# Determines what the user is editing and stores the value
# Storing the value allows the user to continue the same edit as long as the
# mouse left click is held
Determines what the user is editing and stores the value
Storing the value allows the user to continue the same edit as long as the
mouse left click is held
Determines what the user is editing and stores the value Storing the value allows the user to continue the same edit as long as the mouse left click is held
def detect_input
    if inputs.mouse.up
      state.current_input = :none
    elsif star_clicked?
      state.current_input = :star
    elsif target_clicked?
      state.current_input = :target
    elsif wall_clicked?
      state.current_input = :remove_wall
    elsif grid_clicked?
      state.current_input = :add_wall
    end
  end
def detect_input if inputs . mouse . up state . current_input = :none elsif star_clicked? state . current_input = :star elsif target_clicked? state . current_input = :target elsif wall_clicked? state . current_input = :remove_wall elsif grid_clicked? state . current_input = :add_wall end end
Determines what the user is editing and stores the value
Storing the value allows the user to continue the same edit as long as the
mouse left click is held
Determines what the user is editing and stores the value Storing the value allows the user to continue the same edit as long as the mouse left click is held
# When the mouse is up, nothing is being edited # When the star in the no second grid is clicked # When the target in the no second grid is clicked # When a wall in the first grid is clicked # When the first grid is clicked