Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Jeff3301 |
My project is a 2d topdown game with a lot of enemies, and my move function that uses get_simple_path and tile navigation is consuming a lot of performance.
Here is my code:
var point = 0
func move():
target = navigation.get_simple_path(global_position,GameManager.playerNode.global_position,false)
if global_position == target[point]:
point += 1
motion = (target[point] - position).normalized() * moveSpeed
move_and_slide(motion)
pass
This function is running on _physics_proccess(delta)
ya try not to do it each time/frame… only when path needs to change. if click or input or etc
rakkarage | 2020-07-13 03:34