日期:2014-05-20 浏览次数:20635 次
public void commandAction(Command c, Displayable d) {
if(c==cmdbk){
System.out.println("huiqu22");
game_state=GAME_STATE_GAMING;
System.out.println(cmdbk);
System.out.println("qwqwqwwq");
}else if(c==cmdok){
System.out.println("qwqdffdfd");
game_state=GAME_STATE_MENU;
System.out.println("huiqu");
}else if(c==backCommand){
game_state=GAME_STATE_GAMING;
}
}
public void run() {
while(!bQuit){
//if(flag==true){
offg.setColor(255,255,255);
offg.fillRect(0,0,getWidth(),getHeight());
repaint();
input();
try {
Thread.currentThread();
Thread.sleep(80);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public void input(){
int k=this.getKeyStates();
switch (game_state) {
case GAME_STATE_INIT:
paintINIT();
break;
case GAME_STATE_LOGO:
paintLOGO();
break;
case GAME_STATE_MENU:
paintMeun();
break;
case GAME_STATE_GAMING:
switch (game) {
case GAMING:
lm.paint(offg,0, 0);
//检测边界碰撞
checkBound();
//检测精灵之间的碰撞
iscollision();
//检测Sprite方向
checkDir(k);
break;
}
case DEP_HR:
//game_state=GAME_STATE_LOGO;
break;
case GAME_STATE_ROLE:
rolefrm.append(cg);
rolefrm.addCommand(cmdbk);
rolefrm.addCommand(cmdok);
//frm.setCommandListener(this);
this.m4.dis.setCurrent(rolefrm);
break;
case GAME_STATE_HELP:
paintHelp(offg);
这里有点问题,求指教 break;
case GAME_STATE_EXIT:
exit();
break;
default:
break;
}
}