import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
* @Author fan
* @Description //TODO 游戏开始之前加载
* @Date 16:07 2020/3/24 0024
* @Param
* @return
**/
public class Before {
Image bg = null;
Image wfeiji = null;
Image kdiji1 = null;
Image kdiji2 = null;
Image kdiji3 = null;
public Before() {
try {
bg = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/bg.jpg"));
wfeiji = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/feiji_1.png"));
kdiji1 = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/kdiji_01.png"));
kdiji2 = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/kdiji_02.png"));
kdiji3 = ImageIO.read(Before.class.getClassLoader().getResourceAsStream("images/kdiji_03.png"));
} catch (IOException e) {
e.printStackTrace();
}
}
int time = 0;
public void draw(Graphics g) {
if (PlaneStatus.roleNum == 1) {
// 画妹妹
g.drawImage(bg, 0, 0, null);
g.drawImage(wfeiji, 260, 600, null);
g.drawImage(kdiji1, 200, 50, null);
g.drawImage(kdiji1, 400, 50, null);
g.drawImage(kdiji1, 150, 480, null);
g.drawImage(kdiji1, 400, 480, null);
g.drawImage(kdiji2, 100, 200, null);
g.drawImage(kdiji2, 300, 100, null);
g.drawImage(kdiji2, 480, 200, null);
g.drawImage(kdiji3, 300, 300, null);
g.drawImage(kdiji3, 70, 400, null);
g.drawImage(kdiji3, 510, 400, null);
//画回车符
time++;
g.setColor(Color.YELLOW);
g.setFont(new Font("幼圆", Font.BOLD, 30));
}
if (time <= 10) {
g.drawString("[Enter]>>", 50, 750);
} else if (time <= 20) {
g.drawString("[Enter] >>", 50, 750);
} else if (time <= 30) {
g.drawString("[Enter] >>", 50, 750);
if (time == 30) {
time = 0;
}
}
}
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_ENTER) {
}
if (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT) {
PlaneStatus.roleNum = 3 - PlaneStatus.roleNum;
//1~2 互换
}
}
public void keyReleased(KeyEvent e) {
}
}