From a95849d5c7fe652eb223d2cdcb0dcc9f7ef33341 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Fri, 25 Oct 2019 17:41:16 -0500 Subject: [PATCH] Minor tweaks --- lib/entity.rb | 4 ++-- lib/pathfinding/base_pathfinder.rb | 4 ++-- lib/states/game.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/entity.rb b/lib/entity.rb index 3018d14..31f7406 100644 --- a/lib/entity.rb +++ b/lib/entity.rb @@ -127,13 +127,13 @@ class IMICRTS end 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 def draw_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( @position.x, @position.y, Gosu::Color::RED, @pathfinder.path_current_node.tile.position.x, @pathfinder.path_current_node.tile.position.y, Gosu::Color::RED, diff --git a/lib/pathfinding/base_pathfinder.rb b/lib/pathfinding/base_pathfinder.rb index acca276..284e008 100644 --- a/lib/pathfinding/base_pathfinder.rb +++ b/lib/pathfinding/base_pathfinder.rb @@ -114,7 +114,7 @@ class IMICRTS end def at_goal? - @current_node.tile.grid_position.distance(@goal) < 1.1 + @current_node.tile.grid_position.distance(@goal) <= 0.9 end def seek @@ -211,7 +211,7 @@ class IMICRTS distance = node.tile.grid_position.distance(@goal) cost = node.cost - if distance < fittest_distance && cost < fittest_cost + if distance + cost < fittest_distance + fittest_cost fittest = node fittest_distance = distance fittest_cost = cost diff --git a/lib/states/game.rb b/lib/states/game.rb index bd6a5c3..5a6a7e8 100644 --- a/lib/states/game.rb +++ b/lib/states/game.rb @@ -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 end - @debug_info.draw + @debug_info.draw if Setting.enabled?(:debug_info_bar) end def update