Hey everyone, i am trying to program a basic fish tank and am having trouble with the swimming AI.
It is for a kids game so it doesnt have to be anything too accurate or realistic but what I am trying to do is get the fish to swim toward where its head is facing. I have that working so far with AffineTransform rotations and translations, however when the fish is swimming to the right (0 degrees) and hits the wall, I add 180 degrees to its angle and that causes it to swim back in the other direction.
However the problem with that is the fish image is then upside and I am not sure how to fix that. I am guessing I can just check if the angle is within a certain range (90 - 270?) the image will be flipped vertically?
Any help, advice or suggestions is appreciated.