samples/99_genre_rpg_roguelike/02_roguelike_line_of_sight/app/main.rb
def render_enemies
    state.enemies.map do |e| # for each enemy in the collection
      alpha = 255 # set opacity (full transparency)

      # Outputs an enemy using a label.
      outputs.labels << [
                   left_margin + 20 +  e.x * grid_size, # positions enemy's "r" text in center of grid square
                   bottom_margin + 35 + e.y * grid_size,
                   "r", # enemy's text
                   1, 1, *white, alpha]

      # Creates a red border around an enemy.
      outputs.borders << [grid_x(e.x), grid_y(e.y), grid_size, grid_size, *red]
    end
  end
# Outputs enemies onto the screen.
Outputs enemies onto the screen.
Outputs enemies onto the screen .
def render_enemies
    state.enemies.map do |e| 
      alpha = 255 
      outputs.labels << [
                   left_margin + 20 +  e.x * grid_size, 
                   bottom_margin + 35 + e.y * grid_size,
                   "r", 
                   1, 1, *white, alpha]
      outputs.borders << [grid_x(e.x), grid_y(e.y), grid_size, grid_size, *red]
    end
  end
def render_enemies state . enemies . map do | e | alpha = 255 outputs . labels << [ left_margin + 20 + e . x * grid_size , bottom_margin + 35 + e . y * grid_size , "r" , 1 , 1 , * white , alpha ] outputs . borders << [ grid_x ( e . x ) , grid_y ( e . y ) , grid_size , grid_size , * red ] end end
Outputs enemies onto the screen.
Outputs enemies onto the screen .
# for each enemy in the collection # set opacity (full transparency) # Outputs an enemy using a label. # positions enemy's "r" text in center of grid square # enemy's text # Creates a red border around an enemy.