Jmelo129 / TD-Game

Planning for the Tower Defense Game
0 stars 0 forks source link

Enemies Route Following #2

Closed ghost closed 9 months ago

ghost commented 9 months ago

The enemies are not following the path we created for them. They are not turning in the correct spots. The enemies either turn the wrong direction or miss the turn completely.

ghost commented 9 months ago

The issue was resolved by checking in advance if the squares around the enemies were either a path tile or a regular tile (1 or 0 in map 2D array), and then turning appropriately.

ghost commented 9 months ago

The problem was apparently not resolved. We created a new map because the first one we used was just a trial map. In the actual map we created, we had multiple turns so the path tiles were too close together. When the enemies check for the surrounding squares, they detect the other path tiles close to them and assume they're still on the path when they need to turn.

ghost commented 9 months ago

We were able to resolve the issue by adding more if statements to further reinforce the code and make sure that all possibilities were covered when the enemies had to turn. To check if this issue was truly resolved, we changed the map multiple times and the enemies followed the path perfectly.