📄 ghostcanvas.java
字号:
p_status=p_sta;
}
break;
case 4://过关画面操作
switch(p_status){
case 0://
gateImgInit(TollGate.curTollGate+1);
p_status=1;
break;
case 1://
if(keyPre){
UnGateImg();
g_status=1;
}
break;
}
break;
case 5://GameOver
switch(p_status){
case 0:
endGate();
unGame();
if (gameOverImg==null){
try{
gameOverImg=Image.createImage("/res/gameover.png");
}catch(Exception e){}
}
p_status=1;
break;
case 1:
if(keyPre){
congImg=null;
p_status=2;
}
break;
case 2:
if (t_point>Man.MaxPoint){
svp.inputing=true;
GhostMIDlet.mainMIDlet.disp.setCurrent(svp.frm);
}
p_status=3;
break;
case 3:
if (!svp.inputing && keyPre){
gameOverImg=null;
status=1;
g_status=0;
p_status=0;
}
break;
}
break;
case 6://通关
switch(p_status){
case 0://装载通关画面
endGate();
unGame();
if (congImg==null){
try{
congImg=Image.createImage("/res/cong.png");
}catch(Exception e){}
}
p_status=1;
break;
case 1:
if (keyPre){
p_status=2;
}
break;
case 2:
if (t_point>Man.MaxPoint){
svp.inputing=true;
GhostMIDlet.mainMIDlet.disp.setCurrent(svp.frm);
}
p_status=3;
break;
case 3:
if (!svp.inputing){
status=1;
g_status=0;
p_status=0;
}
break;
}
break;
}
break;
case 3://重新开始
svp.readTollGate();
TollGate.curTollGate=svp.gate;
Man.point=0;
gameInit(TollGate.curTollGate);
status=2;
g_status=4;
p_status=0;
break;
case 4://分数排行
switch(g_status){
case 0://装载排行榜
if (svp.isExistRs("point")){
svp.getPointList();
}
g_status=1;
break;
case 1://显示排行榜
if (keyPre){
status=1;
g_status=0;
}
break;
}
break;
case 5://游戏帮助
switch(g_status){
case 0://装载帮助文字
helpMe=new String[]{
"1.在游戏规定的关卡中捉到所有鬼",
" 就可以获得胜利。",
"2.连续找到鬼的两个部分才可以真",
" 正捉到一个鬼。",
"3.游戏中有些道具可以帮助你获得",
" 胜利;",
" a.溜冰鞋,加速道具。",
" b.面罩,免疫道具。",
" c.蜡烛,延长游戏的限制时间。 ",
"4.游戏中也有道具可能会让你失败;",
" a.藤蔓,限制行动道具。",
" b.鼠夹,减速道具。",
" c.鬼火,减少视觉范围。",
"5.游戏中有些怪物会伤害你。 ",
" a.食尸鬼 ",
" b.幽灵,可以穿越障碍。",
" c.夜叉,可以复制。",
" d.牛头,可以追击。",
" e.马面,可以进行瞬移。",
};
g_status=1;
p_status=0;
break;
case 1://显示帮助文字
if ((keystate & UP_PRESSED)!=0){
if (p_status<0) p_status=p_status+17;
} else if ((keystate & DOWN_PRESSED)!=0){
if (p_status+helpMe.length*17>screenHeight) p_status=p_status-17;
} else if (v_keyCode==-7 && keyPre){
helpMe=null;
status=1;
g_status=0;
}
break;
}
break;
}
if (keyPre){
keyPre=false;
}
}
/***************************************************************************
*
*绘面方法,根据游戏当前的状态画出相应的动画
*
**************************************************************************/
private void render(Graphics g) {
switch(status) {
case 0://百宝动画
break;
case 1: //主菜单
switch(g_status){
case 1://菜单选择界面
g.setColor(255,255,255);
g.fillRect(0,0,176,208);
g.drawImage(menuImg,0,0,20);
g.drawImage(menuSelImg[p_status],50,155,20);
break;
}
break;
case 2://游戏中
switch(g_status){
case 1://关卡装载
if (i_status>=0){
g.setColor(255,0,0);
g.drawRect(13,170,150,3);
g.fillRect(13,170,15*i_status,3);
g.setColor(88,212,59);
g.setFont(Font.getFont(Font.FACE_MONOSPACE,Font.STYLE_PLAIN,Font.SIZE_SMALL));
g.drawString("Loading...",176/2,186,Graphics.TOP|Graphics.HCENTER);
}
break;
case 3://游戏中
if(!g_pause){
g.setColor(202,86,64);
g.fillRect(0,0,176,208);
drawPanel(g);
TollGate.drawMap(g);
prop.drawProp(g);
for (i=0;i<mons.size();i++) {
Monster ms=(Monster)mons.elementAt(i);
ms.monster.paint(g);
if (ms.curY<6 && ms.curX%2==1){
int t=TollGate.gateMap[ms.curX][ms.curY+1];
if (t==2 || t==3 || t==4){
g.drawImage(TollGate.mapImg[TollGate.gateMap[ms.curX][ms.curY+1]],TollGate.bgX+ms.curX*TollGate.gridH,TollGate.bgY+(ms.curY+1)*TollGate.gridH-10,20);
}
}
}
man.man.paint(g);
if (man.showSos){
if (man.showVImg!=null){
g.drawImage(man.showVImg, TollGate.bgX+man.curx,TollGate.bgY+man.cury-40,Graphics.TOP|Graphics.HCENTER);
}
}
if (man.showGetProp){
if (man.showGetImg!=null){
g.drawImage(man.showGetImg, TollGate.bgX+man.curx,TollGate.bgY+man.cury-40,Graphics.TOP|Graphics.HCENTER);
}
}
if (man.curY<6){
int t=TollGate.gateMap[man.curX][man.curY+1];
if (t==2 || t==3 || t==4){
g.drawImage(TollGate.mapImg[TollGate.gateMap[man.curX][man.curY+1]],TollGate.bgX+man.curX*TollGate.gridH,TollGate.bgY+(man.curY+1)*TollGate.gridH-10,20);
}
}
if (Man.isSight){
drawPanel(g);
g.setColor(0,0,0);
g.fillRect(0,30,176,3);
for (i=0;i<TollGate.w;i++){
for(j=0;j<TollGate.h;j++){
if (Math.abs(man.curX-i)<2 && Math.abs(man.curY-j)<2){
} else{
g.fillRect(i*25+TollGate.bgX,j*25+TollGate.bgY,25,25);
}
}
}
}
}
break;
case -3://显示胜利
switch(p_status){
case 1:
if (winImg!=null){
g.drawImage(winImg, 176/2, 208/2,Graphics.TOP|Graphics.HCENTER);
}
//repaint(0,0,176,208);
//serviceRepaints();
break;
}
break;
case 4://进入本关画面
switch(p_status){
case 1://显示过关画面
g.setColor(176,221,255);
g.fillRect(0,0,176,208);
if (gateImg!=null){
g.drawImage(gateImg,0,0,20);
}
int t=TollGate.curTollGate+1;
boolean n2=false;
if (t>9 && gateNumImg[t/10]!=null){
g.drawImage(gateNumImg[t/10],176/2-11,143,20);
n2=true;
}
if (gateNumImg[t%10]!=null){
if (n2){
g.drawImage(gateNumImg[t%10],176/2-1,143,20);
}else{
g.drawImage(gateNumImg[t%10],176/2-7,143,20);
}
}
break;
}
break;
case 5://GameOver
switch(p_status){
case 1://显示画面
g.setColor(255, 255,255);
g.fillRect(0,0,176,208);
if (gameOverImg!=null){
g.drawImage(gameOverImg,0,0,20);
}
break;
}
break;
case 6://通关
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -