Oh, it is also not really needed that the calculation is done every act-cycle. You only need to execute it once (or once every time something changed).
I just saw this image here https://i.gyazo.com/a5aeacfa6056d5a15af753f781274b06.png and noticed that something had to be wrong with the calculation of the shortest distance.
You distance method should be "return Math.hypot(x1-x2, y1-y2);". To test that your method doesn't work, execute this line:
System.out.println(2^2);
It prints 0 and that's not what you want to do. ^ is the XOR in Java, not the for powering a number. To calculate 2^2, you would need to use Math.pow(2, 2). The hypot method is a shortcut for Euclidian distances (= square-root of the sum of squared distances in each direction).
I made my Pac-Man game with the help of this article: http://www.gamasutra.com/view/feature/3938/the_pacman_dossier.php?print=1 Was really helpful for me.
You can shoot portals with right and left mouse button and if both exist and you move into one, you come out of the other. The game crashes if there is only one and you move into it though.
2018/8/14
Pac Man
2018/8/14
Almost a solution to the Traveling Salesman Problem
2018/8/14
Almost a solution to the Traveling Salesman Problem
2018/8/14
Almost a solution to the Traveling Salesman Problem
2018/7/23
Pac-Man
2018/7/23
Pac-Man
2018/3/11
pacman 2k18
2018/1/27
A Pig's Dream (unfinished)
2018/1/21
Portal project