Stuck at enemy movement
- by Syed
I am making a TD game in unity, Initially I made all of my enemy movements frame rate dependent say:
I had a grid point1 at -22.65 and other at -21.1, diagrammatically:
(-22.65) _________(-21.1)_______(-21.1+1.55) ......
so the distance on x axis between two points is 1.55, divided it by 25 jumps with each enemy jump of 0.062 of each frame. On reaching on next point of grid the enemy find again its path. All went fine until I have requirement of FastForward and Pause feature. I used timeScale property of unity but it wont work as they are frame dependent. I also tried double speed of enemy on clicking fast forward button at any time, it has some issues that enemy jumps are now less and it fails to reach on next grid point.
Could someone suggest me solution to my problem. Do I need to change the enemy movement code to make it frame independent ?? I need the enemy to reach on the grid specific point I also need later to slow down any one enemy's speed when tower fires on it. Thnx