Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CustomAStar:
- extends AStar
- var high_cost_points = []
- func _estimate_cost( id_a, id_b ):
- if (id_a in high_cost_points or id_b in high_cost_points):
- return get_point_pos(id_a).distance_to(get_point_pos(id_b)) * 2
- # else
- return get_point_pos(id_a).distance_to(get_point_pos(id_b))
- func _ready():
- var astar = CustomAStar.new()
- # [ Add points ]
- astar.high_cost_points = [ 3, 5, 47, etc. ] # IDs of points
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement