More informative map
This commit is contained in:
parent
d1e549dacd
commit
f8717dc2bc
@ -18,7 +18,31 @@ router.add "st" do
|
||||
end
|
||||
|
||||
router.add "m" do
|
||||
world.map.print
|
||||
size = world.map.size
|
||||
(0...size).each do |x|
|
||||
if x == 0
|
||||
printf "+"
|
||||
(0...size).each do |y|
|
||||
printf "---+"
|
||||
end
|
||||
print "\n"
|
||||
end
|
||||
printf "|"
|
||||
(0...size).each do |y|
|
||||
printf "%c%d%d|", world.map.get(x, y).letter, x, y
|
||||
end
|
||||
print "\n"
|
||||
printf "|"
|
||||
(0...size).each do |y|
|
||||
printf "%3d|", world.map.get(x, y).cur
|
||||
end
|
||||
print "\n"
|
||||
printf "+"
|
||||
(0...size).each do |y|
|
||||
printf "---+"
|
||||
end
|
||||
print "\n"
|
||||
end
|
||||
end
|
||||
|
||||
router.add "harv {x} {y}" do |p|
|
||||
|
@ -30,10 +30,18 @@ module Game
|
||||
self.set(CrystalTile.new(Point.new(2, 2), 100))
|
||||
end
|
||||
|
||||
def size
|
||||
SIZE
|
||||
end
|
||||
|
||||
def get(point : Point) : Tile
|
||||
@data[key(point)]
|
||||
end
|
||||
|
||||
def get(x : Int32, y : Int32) : Tile
|
||||
@data[key(Point.new(x, y))]
|
||||
end
|
||||
|
||||
def set(tile : Tile)
|
||||
@data[key(tile.point)] = tile
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user