mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-13 06:52:33 +00:00
Added spawn points to test_map, Debug text now shows type of tile under mouse
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.2" tiledversion="1.2.4" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="32" tileheight="32" infinite="0" nextlayerid="5" nextobjectid="1">
|
||||
<map version="1.2" tiledversion="1.2.4" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="32" tileheight="32" infinite="0" nextlayerid="6" nextobjectid="7">
|
||||
<tileset firstgid="1" source="../tilesets/default.tsx"/>
|
||||
<tileset firstgid="5" source="../tilesets/ore.tsx"/>
|
||||
<layer id="3" name="terrain" width="64" height="64">
|
||||
@@ -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
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="5" name="spawns">
|
||||
<object id="5" name="Spawn" type="spawn" x="1551" y="1714">
|
||||
<point/>
|
||||
</object>
|
||||
<object id="6" name="Spawn" type="spawn" x="176" y="402">
|
||||
<point/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
</map>
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user