cannonball.java

来自「一些JAVA的小程序」· Java 代码 · 共 18 行

JAVA
18
字号
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 + =
减小字号Ctrl + -
显示快捷键?