samples/99_genre_rpg_roguelike/02_roguelike_line_of_sight/app/main.rb
def input_move
    x, y, x_diff, y_diff = input_target_cell

    return unless dungeon_cell_exists? x, y # player can't move there if a dungeon cell doesn't exist in that location
    return if enemy_at x, y # player can't move there if there is an enemy in that location

    state.x += x_diff # increments x by x_diff (so player moves left or right)
    state.y += y_diff # same with y and y_diff ( so player moves up or down)
    update_line_of_sight # updates visible cells
  end
# Updates x and y values of the player, and updates player's line of sight
Updates x and y values of the player, and updates player's line of sight
Updates x and y values of the player and updates player ' s line of sight
def input_move
    x, y, x_diff, y_diff = input_target_cell
    return unless dungeon_cell_exists? x, y 
    return if enemy_at x, y 
    state.x += x_diff 
    state.y += y_diff 
    update_line_of_sight 
  end
def input_move x , y , x_diff , y_diff = input_target_cell return unless dungeon_cell_exists? x , y return if enemy_at x , y state . x += x_diff state . y += y_diff update_line_of_sight end
Updates x and y values of the player, and updates player's line of sight
Updates x and y values of the player and updates player ' s line of sight
# player can't move there if a dungeon cell doesn't exist in that location # player can't move there if there is an enemy in that location # increments x by x_diff (so player moves left or right) # same with y and y_diff ( so player moves up or down) # updates visible cells