samples/06_save_load/01_save_load_game/app/main.rb
# Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection.
Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection.
Outputs a collection of highlights using an array to set their values and also rejects certain values from the collection .
def render_highlights
    state.layout.highlights.each do |h| 
        h.lifetime -= 1 
      end
      outputs.solids << state.layout.highlights.map do |h| 
        [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] 
      end
      state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 }
  end
def render_highlights state . layout . highlights . each do | h | h . lifetime -= 1 end outputs . solids << state . layout . highlights . map do | h | [ h . x , h . y , h . w , h . h , h . color , 255 * h . lifetime / h . max_lifetime ] end state . layout . highlights = state . layout . highlights . reject { | h | h . lifetime <= 0 } end
Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection.
Outputs a collection of highlights using an array to set their values and also rejects certain values from the collection .
# for each highlight in the collection # decrease the value of its lifetime # outputs highlights collection # sets definition for each highlight # transparency changes; divide lifetime by max_lifetime, multiply result by 255 # reject highlights from collection that have no remaining lifetime