📄 powerup.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -