Hey,
I’m working on a SimTower clone, and have implemented an a star algorithm successfully, BUT I got huge problems following the path I get from the algo. I got units which can move in that “tower”, and each unit gets an own path as an ArrayList containing waypoints. The problem is, that these waypoints are coordinates from a two dimensional array, which I created on the flow from the information my tower gives. I didn’t implemented my tower tile based, that is not cool… however I have to convert all tower information into an 2dim Array. I think there is no mistake. The problem is to follow the path…
x += (Floor.convertToPixelX(way.get(waycount).x) - x); //moving that unit, not with delta time yet.... works, but creepy
if (Floor.convertToIndexX(x) == way.get(waycount).x && Floor.convertToIndexX(y) == way.get(waycount).y) {
waycount--; //waycount starts with the highest index... the fist part of the way
}
I dont need a 100% solution for this. I need an idea how to implement it better, and make it even work. How would you do this? If you interessted in my Waypoint class, let me know, maybe the whole implementation is crap