Java 我如何制作子弹的旋转图案。(爪哇)

Java 我如何制作子弹的旋转图案。(爪哇),java,Java,因此,我有一个bullet类,其中包含以下代码,我希望能够通过从另一个类创建bullet来旋转这些代码。我该怎么做呢。目前,它在旋转时看起来很柔软,而只是跳到了这个位置,我想看起来像这样 public class Bullet extends GameObject{ private Handler handler; float direction, curve, speed, acceleration; float dirX, dirY; p

因此,我有一个bullet类,其中包含以下代码,我希望能够通过从另一个类创建bullet来旋转这些代码。我该怎么做呢。目前,它在旋转时看起来很柔软,而只是跳到了这个位置,我想看起来像这样

public class Bullet extends GameObject{

    private Handler handler;
    
    float direction, curve, speed, acceleration;
    float dirX, dirY;
    
    public Bullet(int x, int y, ID id, Handler handler, float direction, float speed, float acceleration, float curve) {
        super(x, y, id);
        this.handler = handler;
        this.direction = direction;
        this.speed = speed;
        this.acceleration = acceleration;
        this.curve = curve;
        
    }

    public void tick() {
       direction = direction + curve;
       speed = speed + acceleration;
       
       dirX = (float) xDir(direction);
       dirY = (float) yDir(direction);
       
       x = (int) (x + dirX*speed);
       y = (int) (y + dirY*speed);
       
    }
    
    public static double xDir(float angle){
        double rad = angle * Math.PI/180;
        return Math.cos(rad);
    }
    public static double yDir(float angle){
        double rad = angle * Math.PI/180;
        return -Math.sin(rad);
    }
    
    public void render(Graphics g) {
        g.setColor(Color.magenta);
        g.fillOval(x, y, 8, 8);
    }

    public Rectangle getBounds() {
        return new Rectangle(x ,y, 8, 8);
    }
    
}