explode.java

来自「简单的贪吃蛇源码」· Java 代码 · 共 35 行

JAVA
35
字号
import java.awt.*;


public class explode {
	int x, y;
	private boolean live = true;	
	
	
	int[] diameter = {4, 7, 12, 18, 26, 32, 49, 30, 14, 6};
	int step = 0;
	
	public explode(int x, int y) {
		this.x = x;
		this.y = y;		
	}
	
	public void draw(Graphics g) {
		if(!live) {			
			return;
		}
		
		if(step == diameter.length) {
			live = false;
			step = 0;
			return;
		}
		
		Color c = g.getColor();
		g.setColor(Color.ORANGE);
		g.fillOval(x, y, diameter[step], diameter[step]);
		g.setColor(c);		
		step ++;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?