samples/13_path_finding_algorithms/04_early_exit/app/main.rb
# 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 star2_clicked?
      state.current_input = :star2
    elsif target_clicked?
      state.current_input = :target
    elsif target2_clicked?
      state.current_input = :target2
    elsif wall_clicked?
      state.current_input = :remove_wall
    elsif wall2_clicked?
      state.current_input = :remove_wall2
    elsif grid_clicked?
      state.current_input = :add_wall
    elsif grid2_clicked?
      state.current_input = :add_wall2
    end
  end
def detect_input if inputs . mouse . up state . current_input = :none elsif star_clicked? state . current_input = :star elsif star2_clicked? state . current_input = :star2 elsif target_clicked? state . current_input = :target elsif target2_clicked? state . current_input = :target2 elsif wall_clicked? state . current_input = :remove_wall elsif wall2_clicked? state . current_input = :remove_wall2 elsif grid_clicked? state . current_input = :add_wall elsif grid2_clicked? state . current_input = :add_wall2 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 star in the second grid is clicked # When the target in the no second grid is clicked # When the target in the second grid is clicked # When a wall in the first grid is clicked # When a wall in the second grid is clicked # When the first grid is clicked # When the second grid is clicked