diff --git a/assets/maps/test_map.tmx b/assets/maps/test_map.tmx index 796dea9..323d8bc 100644 --- a/assets/maps/test_map.tmx +++ b/assets/maps/test_map.tmx @@ -1,5 +1,5 @@ - + @@ -138,4 +138,12 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + diff --git a/lib/map.rb b/lib/map.rb index 87e9d7f..5c0197d 100644 --- a/lib/map.rb +++ b/lib/map.rb @@ -2,7 +2,7 @@ class IMICRTS class Map Tile = Struct.new(:position, :color, :image, :state, :type) - attr_reader :tiles, :ores + attr_reader :tile_size, :tiles, :ores def initialize(map_file:) @tiled_map = TiledMap.new(map_file) diff --git a/lib/states/game.rb b/lib/states/game.rb index 2738b1f..f671d3e 100644 --- a/lib/states/game.rb +++ b/lib/states/game.rb @@ -90,6 +90,7 @@ class IMICRTS end mouse = @player.camera.transform(window.mouse) + tile = @director.map.tile_at(mouse.x / @director.map.tile_size, mouse.y / @director.map.tile_size) @debug_info.text = %( FPS: #{Gosu.fps} Aspect Ratio: #{@player.camera.aspect_ratio} @@ -104,6 +105,7 @@ class IMICRTS World Mouse Y: #{mouse.y} Director Tick: #{@director.current_tick} + Tile: X: #{tile.position.x} Y: #{tile.position.y} Type: #{tile.type} ).lines.map { |line| line.strip }.join("\n") @debug_info.x = @sidebar.width + 20