trace.java
来自「java编的一个火焰程序」· Java 代码 · 共 39 行
JAVA
39 行
package skyrocket;
import java.awt.Color;
import java.awt.Graphics2D;
class Trace extends Thing {
double velocityX, velocityY;
Trace( Thing thing ) {
super( thing.canvas );
this.color = thing.color;
this.width = thing.width;
this.height = thing.height;
stateX = thing.stateX;
stateY = thing.stateY;
}
void draw( Graphics2D g, int time ) {
g.fillRect( (int)stateX, (int)stateY, width, height );
color = new Color(
(int) ( color.getRed() * canvas.traceDarkerFactor ),
(int) ( color.getGreen() * canvas.traceDarkerFactor ),
(int) ( color.getBlue() * canvas.traceDarkerFactor )
);
if( color.getRed() + color.getGreen() + color.getBlue() < 10 )
stateDead = true;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?