powerup.java

来自「java 自己写的小程序!!!欢迎使用!!!!」· Java 代码 · 共 59 行

JAVA
59
字号
import java.awt.*;

public class powerup{
	private int xPos;
	private int yPos;
	private int function;
	private Rectangle Powerup;
	private int display = 0;
	private int displaytime;

	public powerup(){
		xPos = 24 + (int)(Math.random()*475);
		yPos = 24 + (int)(Math.random()*475);
		int a = (int)(Math.random()*20);
		if(0 <= a && a< 3)
			function = 1;
		if(3 <= a && a < 6)
			function = 2;
		if(6 <= a && a < 9)
			function = 3;
		if(9 <= a && a< 12)
			function = 4;
		if(12 <= a && a < 15)
			function = 5;
		if(15 <= a && a < 18)
			function = 6;
		if(16 <= a && a < 20)
			function = 7;
		displaytime = 100 + (int)(Math.random()*430);
		Powerup = new Rectangle(xPos - 12, yPos -12, 25, 25);
	}

	public int getxPos(){
		return xPos;
	}
	public int getyPos(){
		return yPos;
	}

	public Rectangle PowerUp(){
		return Powerup;
	}

	public int getFunction(){
		return function;
	}

	public void flashing(){
		display++;
	}

	public boolean stopDisplay(){
		boolean stopdisplay = false;
		if(displaytime <= display)
			stopdisplay = true;
		return stopdisplay;
	}

}

⌨️ 快捷键说明

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