- class Room
- attr_accessor :contents, :description
- class Contents
- attr_accessor :contents
- def initialize contents
- @contents = contents
- class Player
- attr_accessor :inventory
- class Map
- def initialize
- airlock1 = Room.new
- airlock1.description = "The airlock of a space station. It contains:"
- airlock1.contents = Contents.new ["Spacesuit", "Clipboard", "Flashlight"]
- science_lab = Room.new
- science_lab.description = "You're in the science lab. It contains:"
- science_lab.contents = Contents.new ["Plasma Cutter", "Chemicals", "USB Drive"]
- mess_hall = Room.new
- mess_hall.description = "You're in the mess hall. It contains:"
- crew_quarters = Room.new
- crew_quarters.description = "You're in the crew quarters. It contains:"
- @map = [[airlock1, science_lab],[mess_hall, crew_quarters]]
- @current_room_position = [0,0]
- def move direction
- case direction
- when "UP"
- if @current_room_position  > 0
- @current_room_position  -= 1
- when "DOWN"
- if @current_room_position  < @map.size-1
- @current_room_position  += 1
- when "LEFT" # unimpemented
- when "RIGHT" #unimplemented
- puts @map[@current_room_position][@current_room_position].description
- map = Map.new
- while input = gets.chomp()
a guest May 21st, 2013 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data