📄 dotthree.java
字号:
package FireFlower;
import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;
import java.util.Vector;
//此式样是随机的式样
class DotThree extends Dot{
public DotThree(Color col,int endX,int endY){
super(col, endX, endY);
pace=20;
}
public LittleDot[] initBlast(){
//初始化爆炸的情况
final int ONE=20;//这是爆炸的第一圈的半径
Random rand=new Random();
int blastX=endPoint.x-ONE*circle;
int blastY=endPoint.y-ONE*circle;
if(Math.random()<0.3){
for(int i=0;i<ld.length;i++){
ld[i]=new LittleDot(rand.nextInt(ONE*circle*2+20)+blastX,
rand.nextInt(ONE*circle*2+20)+blastY,
new Color(rand.nextInt(256),rand.nextInt(256),rand.nextInt(256)));
}//for
}//if
else {
for(int i=0;i<ld.length;i++){
ld[i]=new LittleDot(rand.nextInt(ONE*circle*2)+blastX,
rand.nextInt(ONE*circle*2)+blastY,
col);
}//for
}//else
col=new Color(225,203,114);
size=10;
state=3;
return ld;
}
public LittleDot[] blast(){
//处理爆炸的情况
final int EVERY=40;//爆炸的每圈的半径
if(circle>=4) state=4 ;
Random rand=new Random();
for(int i=0;i<ld.length;i++){
ld[i].x+=rand.nextInt(EVERY)-EVERY/2;
ld[i].y+=rand.nextInt(EVERY)-EVERY/2;
}
return ld;
}
public void myPaint(Graphics g,Vector lList){
super.myPaint(g,lList);
/*
if(circle<=3){
g.setColor(col);
g.fillOval(x,y+circle*2,size,size);
}
*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -