samples/99_genre_rpg_roguelike/02_roguelike_line_of_sight/app/main.rb
# Adds new elements into the canvas collection and sets their values.
Adds new elements into the canvas collection and sets their values.
Adds new elements into the canvas collection and sets their values .
def calc_canvas
    return if state.canvas.length > 0 
    15.times do |x| 
      15.times do |y|
        state.canvas << state.new_entity(:canvas) do |c| 
          c.x = x 
          c.y = y
          c.border = [left_margin   + x * grid_size,
                      bottom_margin + y * grid_size,
                      grid_size,
                      grid_size,
                      *white, 30] 
        end
      end
    end
  end
def calc_canvas return if state . canvas . length > 0 15 . times do | x | 15 . times do | y | state . canvas << state . new_entity ( :canvas ) do | c | c . x = x c . y = y c . border = [ left_margin + x * grid_size , bottom_margin + y * grid_size , grid_size , grid_size , * white , 30 ] end end end end
Adds new elements into the canvas collection and sets their values.
Adds new elements into the canvas collection and sets their values .
# return if canvas collection has at least one element # 15 times perform an action # declare canvas element as new entity # set position # sets border definition