Trying to write the correct formulas for drawing round hitboxes

This commit is contained in:
2026-04-02 18:05:07 +03:00
parent 58550ae93a
commit 27bbcee37a
6 changed files with 33 additions and 19 deletions

View File

@ -1,5 +1,7 @@
package gui;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
@ -79,7 +81,14 @@ public class EditableCanvas extends JPanel implements MouseListener, MouseMotion
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(image, 0, 0, this);
if(image!=null) {
g.drawImage(image, 0, 0, this);
g.setColor(Color.darkGray);
g.drawRect(0, 0, image.getWidth(), image.getHeight());
g.setColor(Color.RED);
g.fillOval(image.getWidth()/2, image.getHeight(), 2, 2);
g.setColor(Color.green);
}
if(entity != null) {
drawing((Graphics2D)g);
}