I am trying to code a game and I want my png (character) to face the direction of the movement so I tried to make it flip horizontally everytime I clicked "s" (move left) but it would happen repeatedly and would just keep happening. I only want it to flip once when I click "s".
public void act() { if(Greenfoot.isKeyDown("d")) { setLocation(getX()+5, getY()); setRotation(360); } if(Greenfoot.isKeyDown("a")) { getImage().mirrorHorizontally(); setLocation(getX()-5, getY()); } }