@@ -6,8 +6,8 @@ extends Node2D
66
77const BASE_LINE_WIDTH = 3.0
88const DRAW_COLOR :Color = Color .WHITE
9- const OFFSET_POSITIONS = Vector2 (10 ,30 )
10- const OFFSET_WEIGHT = Vector2 (10 ,- 10 )
9+ const OFFSET_POSITIONS = Vector2 (10 , 30 )
10+ const OFFSET_WEIGHT = Vector2 (10 , - 10 )
1111
1212var _debug_connections = false
1313var _debug_position = false
@@ -18,27 +18,26 @@ var _debug_path = true
1818
1919func _process (delta ):
2020 queue_redraw ()
21- pass
2221
2322
2423func draw_arrow (src , dst , color , width , aa = true ):
2524 var angle = 0.6
2625 var size_head = 20
2726 var head : Vector2 = (dst - src ).normalized () * size_head
28- draw_line (src , dst - head / 2 , color , width , aa )
29- draw_polygon ([dst , dst - head .rotated (angle ), dst - head .rotated (- angle ) ], [color ,color ,color ])
27+ draw_line (src , dst - head / 2 , color , width , aa )
28+ draw_polygon ([ dst , dst - head .rotated (angle ), dst - head .rotated (- angle ) ], [ color , color , color ])
3029
3130
3231func _draw ():
33- if _debug_connections :
32+ if _debug_connections :
3433 _draw_connections ()
35- if _debug_position :
34+ if _debug_position :
3635 _draw_positions ()
37- if _debug_weights :
36+ if _debug_weights :
3837 _draw_weights ()
39- if _debug_costs :
38+ if _debug_costs :
4039 _draw_costs ()
41- if _debug_path :
40+ if _debug_path :
4241 _draw_path ()
4342
4443
@@ -61,13 +60,13 @@ func _draw_weights():
6160 var position_weight = map .astar_node .get_point_position (id )
6261 var cost = map .astar_node .get_point_weight_scale (id )
6362 draw_string (
64- font ,
65- position_weight + OFFSET_WEIGHT ,
66- str (cost ),
67- HORIZONTAL_ALIGNMENT_FILL ,
68- - 1 ,
69- 16 ,
70- Color .RED
63+ font ,
64+ position_weight + OFFSET_WEIGHT ,
65+ str (cost ),
66+ HORIZONTAL_ALIGNMENT_FILL ,
67+ - 1 ,
68+ 16 ,
69+ Color .RED
7170 )
7271
7372
@@ -76,13 +75,13 @@ func _draw_positions():
7675 var position_label = map .astar_node .get_point_position (id )
7776 var position_map = map .local_to_map (map .to_local (map .astar_node .get_point_position (id )))
7877 draw_string (
79- font ,
80- position_label + OFFSET_POSITIONS ,
81- str (position_map ),
82- HORIZONTAL_ALIGNMENT_FILL ,
83- - 1 ,
84- 16 ,
85- Color .RED
78+ font ,
79+ position_label + OFFSET_POSITIONS ,
80+ str (position_map ),
81+ HORIZONTAL_ALIGNMENT_FILL ,
82+ - 1 ,
83+ 16 ,
84+ Color .RED
8685 )
8786
8887
@@ -92,7 +91,7 @@ func _draw_connections():
9291 var position_start = map .astar_node .get_point_position (id )
9392 var position_end = map .astar_node .get_point_position (id_con )
9493 var direction = (position_end - position_start )
95- draw_arrow (position_start , position_end - direction / 4.0 , Color (0.0 , 1.0 , 1.0 , 1.0 ), BASE_LINE_WIDTH * 2 , true )
94+ draw_arrow (position_start , position_end - direction / 4.0 , Color (0.0 , 1.0 , 1.0 , 1.0 ), BASE_LINE_WIDTH * 2 , true )
9695
9796
9897func _draw_costs ():
@@ -102,13 +101,13 @@ func _draw_costs():
102101 var position_cost_end = map .astar_node .get_point_position (id_con )
103102 var cost = map .astar_node ._compute_cost (id , id_con )
104103 draw_string (
105- font ,
106- (position_cost_start + position_cost_end )/ 2.0 ,
107- str ("%.2f " % cost ),
108- HORIZONTAL_ALIGNMENT_CENTER ,
109- - 1 ,
110- 16 ,
111- Color .PINK
104+ font ,
105+ (position_cost_start + position_cost_end ) / 2.0 ,
106+ str ("%.2f " % cost ),
107+ HORIZONTAL_ALIGNMENT_CENTER ,
108+ - 1 ,
109+ 16 ,
110+ Color .PINK
112111 )
113112
114113
0 commit comments