samples/99_genre_rpg_roguelike/02_roguelike_line_of_sight/app/main.rb
#M oves the user based on their keyboard input and sets values for target cell
M oves the user based on their keyboard input and sets values for target cell
M oves the user based on their keyboard input and sets values for target cell
def input_target_cell
    if inputs.keyboard.key_down.up 
      [state.x, state.y + 1,  0,  1] 
    elsif inputs.keyboard.key_down.down 
      [state.x, state.y - 1,  0, -1] 
    elsif inputs.keyboard.key_down.left 
      [state.x - 1, state.y, -1,  0] 
    elsif inputs.keyboard.key_down.right 
      [state.x + 1, state.y,  1,  0] 
    else
      nil  
    end
  end
def input_target_cell if inputs . keyboard . key_down . up [ state . x , state . y + 1 , 0 , 1 ] elsif inputs . keyboard . key_down . down [ state . x , state . y - 1 , 0 , - 1 ] elsif inputs . keyboard . key_down . left [ state . x - 1 , state . y , - 1 , 0 ] elsif inputs . keyboard . key_down . right [ state . x + 1 , state . y , 1 , 0 ] else nil end end
M oves the user based on their keyboard input and sets values for target cell
M oves the user based on their keyboard input and sets values for target cell
# if "up" key is in "down" state # user moves up # if "down" key is pressed # user moves down # if "left" key is pressed # user moves left # if "right" key is pressed # user moves right # otherwise, empty