我用了数组来画炮弹,炮弹发射的角度是任意的,但运行了好几次却发现炮弹就成一条直线了,是哪里出了问题呢

Shell.java
zzu.baizhan.Feb.Day20th;
java.awt.*;
java.util.Random;
Shell GameObject {
;
Shell() {
= ;
= ;
= ;
= ;
= ;
= Math.()*Math.*;
}
draw(Graphics g) {
Color c = g.getColor();
g.setColor(Color.);
g.fillOval(() , () , , );
+= * Math.();
+= * Math.();
(< || > Constant.- ) {
= Math.- ;
}
(< || < Constant.- ) {
= -;
}
g.setColor(c);
}
}
main:
zzu.baizhan.Feb.Day20th;
javax.swing.*;
java.awt.*;
java.awt.event.KeyAdapter;
java.awt.event.KeyEvent;
java.awt.event.WindowAdapter;
java.awt.event.WindowEvent;
Feb20thPlane JFrame {
Image = Feb20thGameUtil.();
Image = Feb20thGameUtil.();
Image = Feb20thGameUtil.();
Plane =Plane(,,);
Shell []=Shell[];
=;
=;
paint(Graphics g) { g.drawImage(, , , );
g.drawImage(, , , );
.drawSelf(g);
(i = ; i < .; i++) {
[i].draw(g);
}
}
keyMonitor KeyAdapter {
keyPressed(KeyEvent e) {
.addDirection(e);
}
keyReleased(KeyEvent e) {
.minusDirection(e);
}
}
launchFrame() {
.setTitle();
.setSize(Constant., Constant.);
.setLocation(, );
setVisible();
.addWindowListener(WindowAdapter() {
windowClosing(WindowEvent e) {
System.();
}
});
PaintThread().start();addKeyListener(keyMonitor());(i = ; i < .; i++) {
[i] = Shell();
}
}
main(String[] args) {
Feb20thPlane f = Feb20thPlane();
f.launchFrame();
}
PaintThread Thread {
run() {
() {
repaint();
{
Thread.(); } (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}