- Home /
Move character back to original position?
So I have a 2d character that follows waypoints that I have set up, and if the player gets too close then it will begin to chase the player until it catches them or the player escapes. The problem is I'd like to have the character return back to its original position, so im wondering if I could somehow record the steps the character takes and then have them repeat those backwards, or should i save myself time and effort and have it just be reset onto the track after a certain amount of time? I can list my code or pictures or anything else if you'd like, thank you!!!
i'm guessing the character travels based on a random set to each way point?
Nah it follows 4 waypoints in order, so like 0 ->1 ->2 ->3 ->2 ->1 ->0 etc etc.
You could have waypoints setup all over the level and just get the enemy to go to the closest waypoint and have the enemy follow the waypoints back to his start waypoint when the player escapes. Or just record the initial position in the start method and send the enemy back there when the player escapes. If there are a lot of objects/colliders in the way, I would choose the first option.
yes, you can do either. we can't see or play your game so we can't say which is approapriate. when your player escapes or is captured, and if your chasing character is off screen then why not take the easier approach if the user cant see it. otherwise, a pathfinding algo or playing moves backwords would be appropiate
Your answer

Follow this Question
Related Questions
Patrol enemy going back to origine after reaching a Waypoint 1 Answer
How do I get the speed of the enemy slowed down? 1 Answer
How do I keep the enemies from moving to waypoints in other rooms? 1 Answer
Camera rotation around player while following. 6 Answers
Problem with waypoints and positon+rotation changing 0 Answers