samples/04_physics_and_collisions/05_box_collision_2/app/main.rb
# Stores/exports world collection's info (coordinates, sprite number) into a file
Stores/exports world collection's info (coordinates, sprite number) into a file
Stores / exports world collection ' s info ( coordinates sprite number ) into a file
def inputs_export_stage
    if inputs.keyboard.key_down.e 
      export_string = state.world.map do |x, y, sprite_number| 
        "#{x},#{y},#{sprite_number}"                           
      end
      gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) 
      state.map_saved_at = state.tick_count 
    end
  end
def inputs_export_stage if inputs . keyboard . key_down . e export_string = state . world . map do | x , y , sprite_number | "#{x},#{y},#{sprite_number}" end gtk . write_file ( MAP_FILE_PATH , export_string . join ( "\n" ) ) state . map_saved_at = state . tick_count end end
Stores/exports world collection's info (coordinates, sprite number) into a file
Stores / exports world collection ' s info ( coordinates sprite number ) into a file
# if "e" is pressed # stores world info in a string # using string interpolation # writes string into a file # frame number (passage of time) when the map was saved