$next_room = ''
class Engine
def initialize(stage)
@stage = stage
puts "succesfully initialized game"
@map = Map.new(@stage)
end
end
class Map
def initialize(start)
@start = start
#puts @start
@rooms = {"roseroom" => method(:enterRose),
"skullroom" => method(:enterSkull)
}
runner(@rooms, @start)
end
def runner(map, start)
$next_room = start
#puts @next_room
while true
room = map[$next_room]
puts $next_room
$next_room = room.call()
#method(:enterSkull).call()
end
end
def enterRose()
@roseroom = Roseroom.new
end
def enterSkull()
@skullroom = Skullroom.new
end
end
class Roseroom
def initialize
puts "succesfully initialized roseroom"
#$next_room = "skullroom"
return "skullroom"
end
def exit
end
end
class Skullroom
def initialize
puts "succesfully initialized skullroom"
Process.exit(1)
end
end
game = Engine.new("roseroom")