Mouse directed attack with 4 possible outcomes and animation based on attack.

Hi, i am trying to build simple hack n slash combat system(NOT A WHOLE GAME);
I want player to attack the direction in which mouse is pointed.
I managed to get simple code to achieve just the right angle:

          [b] [i]entyma[/i] = my entity manager //  [i]getX/Yos[/i] is getter for x/y offset // [i]Mb[/i] is mouseinput // [i]moy/x[/i] is mouse y/x [/b]



	int centerX = (int)(handler.getWorld().getEntyma().getPlayer().getX()-handler.getCamera().getXos());

	int centerY = (int)(handler.getWorld().getEntyma().getPlayer().getY()-handler.getCamera().getYos());

	double angle = Math.toDegrees(Math.atan2(centerY - handler.getMb().getMoy(), centerX - handler.getMb().getMox()));

I know its a bit messy, but im just starting with java, and i want to explore by practice, so yeah, i need it to play attack animation and generate rectangle and if that rectangle touches or overlaps with enemy/entity it deals dmg/prints to console that it hit(need just indicator that shows that it works).
Can you please tell me how to get this code better and preferably face me in the right direction? :slight_smile:
Thanks.
Btw. This is my first post here, hi everyone! Im learning java since dec 4th. xD