So im trying to create a game for a project in my university and my main character is facing the right and can move up and down but i dont know how to do it without him rotating.
private int dir = 1;
setLocation(getX(), getY()+dir); // dir can be multiplied by speed
dir = -dir;