mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-15 15:52:34 +00:00
Minor tweaks
This commit is contained in:
@@ -127,13 +127,13 @@ class IMICRTS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def draw_radius
|
def draw_radius
|
||||||
Gosu.draw_circle(@position.x, @position.y, @radius, ZOrder::ENTITY_RADIUS, @player.color)
|
Gosu.draw_circle(@position.x, @position.y, @radius, ZOrder::ENTITY_RADIUS, @player.color, 360 / 18)
|
||||||
end
|
end
|
||||||
|
|
||||||
def draw_gizmos
|
def draw_gizmos
|
||||||
Gosu.draw_rect(@position.x - @radius, @position.y - (@radius + 2), @radius * 2, 2, Gosu::Color::GREEN, ZOrder::ENTITY_GIZMOS)
|
Gosu.draw_rect(@position.x - @radius, @position.y - (@radius + 2), @radius * 2, 2, Gosu::Color::GREEN, ZOrder::ENTITY_GIZMOS)
|
||||||
|
|
||||||
if @pathfinder && @pathfinder.path_current_node && Setting.enabled?(:debug_pathfinding) && @pathfinder.path.first
|
if Setting.enabled?(:debug_pathfinding) && @pathfinder && @pathfinder.path_current_node
|
||||||
Gosu.draw_line(
|
Gosu.draw_line(
|
||||||
@position.x, @position.y, Gosu::Color::RED,
|
@position.x, @position.y, Gosu::Color::RED,
|
||||||
@pathfinder.path_current_node.tile.position.x, @pathfinder.path_current_node.tile.position.y, Gosu::Color::RED,
|
@pathfinder.path_current_node.tile.position.x, @pathfinder.path_current_node.tile.position.y, Gosu::Color::RED,
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class IMICRTS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def at_goal?
|
def at_goal?
|
||||||
@current_node.tile.grid_position.distance(@goal) < 1.1
|
@current_node.tile.grid_position.distance(@goal) <= 0.9
|
||||||
end
|
end
|
||||||
|
|
||||||
def seek
|
def seek
|
||||||
@@ -211,7 +211,7 @@ class IMICRTS
|
|||||||
distance = node.tile.grid_position.distance(@goal)
|
distance = node.tile.grid_position.distance(@goal)
|
||||||
cost = node.cost
|
cost = node.cost
|
||||||
|
|
||||||
if distance < fittest_distance && cost < fittest_cost
|
if distance + cost < fittest_distance + fittest_cost
|
||||||
fittest = node
|
fittest = node
|
||||||
fittest_distance = distance
|
fittest_distance = distance
|
||||||
fittest_cost = cost
|
fittest_cost = cost
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class IMICRTS
|
|||||||
Gosu.draw_rect(@box.min.x, @box.min.y, @box.width, @box.height, Gosu::Color.rgba(50, 50, 50, 150), Float::INFINITY) if @box
|
Gosu.draw_rect(@box.min.x, @box.min.y, @box.width, @box.height, Gosu::Color.rgba(50, 50, 50, 150), Float::INFINITY) if @box
|
||||||
end
|
end
|
||||||
|
|
||||||
@debug_info.draw
|
@debug_info.draw if Setting.enabled?(:debug_info_bar)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|||||||
Reference in New Issue
Block a user