class Location

Attributes

description[RW]
east[RW]
name[RW]
north[RW]
south[RW]
west[RW]

Public Class Methods

all() click to toggle source
# File lib/minitest/game/location.rb, line 20
def all
  locations = []
  sanctuary = Location.new(
    "Sanctuary",
    "A place you feel safe.",
    Place.new("G-Mart", "A shop to buy things. Y'know buy tings."),
    Place.new("Central Park", "A park in the centre of Sanctuary. Nearby is a cafe. Strange, there are 6 friends sitting on a sofa."),
    Place.new("Sanctuary Museum", "A museum that includes the history of Sanctuary. Suprised?"),
    Place.new("The Bench", "A bench on top of a hill where you can see everything. It's pretty so you go there a lot.")
  )
  city_of_the_bc = Location.new(
    "City of the BC",
    "A weird and wonderful city. It hides things because it cares. Not sure if that makes thing right...",
    Place.new("Inside Out", "A club that makes you feel all the emotions."),
    Place.new("Restaurant Name", "A restaurant where the owner could not think of a better name."),
    Place.new("The Forest", "A forest with no goblins."),
    Place.new("The Lake", "A lake with no sword stuck in the middle.")
  )
  locations.push(sanctuary)
  locations.push(city_of_the_bc)
end
new(name, description, north, east, south, west) click to toggle source
# File lib/minitest/game/location.rb, line 9
def initialize(name, description, north, east, south, west)
  @name = name
  @description = description
  @north = north
  @east = east
  @south = south
  @west = west
end

Public Instance Methods

places() click to toggle source

public instance methods

# File lib/minitest/game/location.rb, line 44
def places
  [self.north, self.east, self.south, self.west]
end
to_s() click to toggle source
# File lib/minitest/game/location.rb, line 48
def to_s
  puts "You magically spawn to " + self.name + "."
  puts "'You have arrived at " + self.name + ". Hope you have enjoyed your Fast Travel experience!'"
  puts "North of you is " + self.north.name + " - " + self.north.description
  puts "East of you is " + self.east.name + " - " + self.east.description
  puts "South of you is " + self.south.name + " - " + self.south.description
  puts "West of you is " + self.west.name + " - " + self.west.description
end