📄 cannonball.java
字号:
import java.awt.*;//to be more specific, java.awt.Point does the jobpublic class CannonBall extends Ball { public CannonBall (Point loc, int r, double dx, double dy) { super(loc, r); //invoke Ball's constructor setMotion(dx, dy); } public static final double GravityEffect = 0.3; public void move () { changeInY += GravityEffect; //short for changeInY = changeInY + GravityEffect; super.move(); //update the ball position }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -