Class: Walker

Inherits:
Object
  • Object
show all
Defined in:
lib/misc/walker.rb

Instance Method Summary collapse

Constructor Details

#initialize(dungeon) ⇒ Walker

Returns a new instance of Walker.



3
4
5
# File 'lib/misc/walker.rb', line 3

def initialize( dungeon )
  @dungeon = dungeon
end

Instance Method Details

#directionsObject



7
8
9
# File 'lib/misc/walker.rb', line 7

def directions
  Hash[ @dungeon.hallways.directions( @dungeon.current_room ).map{ |e| [ e.to_s[0], e ] } ]
end

#main_loopObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/misc/walker.rb', line 11

def main_loop
  loop do
    _directions = directions
    p _directions

    direction = gets.chomp
    direction = _directions[direction]
    p direction

    p @dungeon.set_next_room( direction )
    @dungeon.draw_current_room( 'out/room.jpg'  )

  end
end