📄 gamemanager.java
字号:
musicCtrl = false;
for (int i = 0 ; i< 6 ; i ++){
keyState[i] = false;
}
}
public void showNotify(){
if(!firstRun)musicCtrl = true;
firstRun = false;
}
private void gameRestart(){
winX = 14;//初始化顯示視窗相對於地圖的 x 座標
winY = 24;//初始化顯示視窗相對於地圖的 y 座標
manX = W/2;// 再+橫坐標校正值
manY = H/2;// 再+縱坐標校正值
manPositionX = winX + (manX - mapX)/16;//人物座標(地圖)
manPositionY = winY + (manY - mapY)/16;
tmpManPositionX = manPositionX;
tmpManPositionY = manPositionY;
manSpeed = 12;
currentMapID =7;
currentMagic =2;
manHealth = 100;
manMagic = 100;
manDart = 50;
courseNum= 0;
direction = 1;
flag1 = false;
flag2 = false;
switch(direction){
case 0:
magicStepX = 0;
magicStepY = -1;
break;
case 1:
magicStepX = 0;
magicStepY = 1;
break;
case 2:
magicStepX = -1;
magicStepY = 0;
break;
case 3:
magicStepX = 1;
magicStepY = 0;
break;
}
}
// private void soundControl(){}
//=========================按鍵回應===================================
public void keyPressed(int keyCode){
switch(keyCode){
//left soft
case -6:
keyState[4] = true;
break;
//right soft
case -7:
keyState[5] = true;
break;
case -21:
keyState[4] = true;
break;
//right soft
case -22:
keyState[5] = true;
break;
case 21:
keyState[4] = true;
break;
//right soft
case 22:
keyState[5] = true;
break;
//num0
case 48:
// manRun = !manRun;
break;
//num1
case 49:
break;
//num3
case 51:
break;
//*
case 42:
//threadSleepTime-=10;
break;
//#
case 35:
//threadSleepTime+=10;
break;
default:
switch(getGameAction(keyCode)){
//num2 up
case 1:
keyState[0] = true;
if( gameState == stateAbout || gameState == stateHelp){
if(rowNum>0)
rowNum--;
}
break;
//num8 down
case 6:
keyState[1] = true;
if( gameState == stateAbout || gameState == stateHelp){
if(strIndices != null && rowNum < strIndices.length - 1 - rowsPerPage)
rowNum++;
}
break;
//num4 left
case 2:
keyState[2] = true;
break;
//num6 right
case 5:
keyState[3] = true;
break;
//num5 fire
case 8:
keyState[6] = true;
break;
//num7
case 9:
break;
//num9
case 10:
break;
}
break;
}
if( subMenuSlt>=3&& keyState[6]){
keyState[6]=false;
ground = null;
cz4=null;
cz5=null;
cz6=null;
cz7=null;
long1 = null;
long2 = null;
long3 = null;
manState = null;
magicMenu = null;
magicMenuColorful = null;
magicEffect = null;
magicHealth = null;
messageReady = null;
System.gc();
cover = load("cover");
gameState = stateStart;
showSubMenu = false;
subMenuSlt = 0;
}
repaint();
serviceRepaints();
}
public void keyReleased(int keyCode){
switch(keyCode){
//left soft
case -6:
keyState[4] = false;
break;
//right soft
case -7:
keyState[5] = false;
break;
case -21:
keyState[4] = false;
break;
//right soft
case -22:
keyState[5] = false;
break;
case 21:
keyState[4] = false;
break;
//right soft
case 22:
keyState[5] = false;
break;
//num0
case 48:
break;
//num1
case 49:
break;
//num3
case 51:
break;
//*
case 42:
break;
//#
case 35:
break;
default:
switch(getGameAction(keyCode)){
//num2 up
case 1:
keyState[0] = false;
break;
//num8 down
case 6:
keyState[1] = false;
break;
//num4 left
case 2:
keyState[2] = false;
break;
//num6 right
case 5:
keyState[3] = false;
break;
//num5 fire
case 8:
keyState[6] = false;
break;
//num7
case 9:
break;
//num9
case 10:
break;
}
break;
}
}
void intro(Graphics g){
g.setColor(0);
g.fillRect(0, 0, W, H);
/*
if(introTimer < introFps * 3){
g.drawImage(Mnet, 0, 0, Graphics.TOP | Graphics.LEFT);
}
else*/
if(introTimer <= introFps * 3)
{
g.setColor(0xffffff);
g.fillRect(0, 0, W, H);
g.drawImage(sp,W/2,H/2,3);
}else if(introTimer <= introFps * 6)
{
g.setColor(0xffffff);
g.setFont(Font.getFont(0,1,16));
/*
g.drawString("澳 唐 科 技", W / 2 - 1, H / 2 - 70 - 1, 0x10 | 0x1);
g.drawImage(oo, W / 2, H / 2 - 40, 0x10 | 0x1);
g.setFont(Font.getFont(32,1,8));
g.drawString("\"One Game, One Dream.\"", W / 2, H / 2+33, 0x10 | 0x1);
g.drawString("\2512005", W / 2, H / 2 + 70, 0x10 | 0x1);
*/
g.setFont(Font.getFont(0,1,16));
g.drawString("澳 唐", W / 2 + 20, H / 2 - 35, 0x10 | 0x1);
g.drawImage(oo, W / 2, H / 2 - 40, 0x10 | 0x1);
g.drawString("\2512005", W / 2, H / 2 + 20, 0x10 | 0x1);
}
else{
oo = null;
sp = null;
//Mnet = null;
}
}
//=================================進度條==========================================ok
//=================================splash=======================================
int menuY = 194;
int menuX = 65;
int slt = 0;
int menuActiveSpeed = 12;
boolean sltMusic = false;
boolean menuActive = false;
private void splash(Graphics g){//,boolean[] keyState
g.translate(0,-4);
if( !sltMusic){
g.setColor(0,0,0);
g.fillRect(0,0,W,H);
g.setColor(0Xff9000);
g.drawString("聲音?",W/2,H/2,Graphics.TOP|Graphics.HCENTER);
g.drawString("否",0,H-20,0);
g.drawString("是",W-15,H-20,0);
if(keyState[4]){
musicCtrl = false;
sltMusic = true;
}else if (keyState[5]){
musicCtrl = true;
sltMusic = true;
}
//music();
return;
}
//if (musicCtrl == false){music();}
splashAdd++;
g.setColor(255,255,255);
g.fillRect(0,0,W,H);
g.drawImage(cover,0,0,0);
if(splashAdd%55 !=0)g.drawImage(eyes,72,59,0);
if(splashAdd%125 !=0)g.drawImage(star,85+splashAdd%33,93-(splashAdd%33)*2,0);
g.setClip(65,194,48,12);
g.drawImage(menuPic,menuX,menuY - slt*12,0);
if (keyState[2]){keyState[2] = false;slt--; menuActive = true;if (slt<0){ slt =0;}}
if (keyState[3]){keyState[3] = false;slt++; menuActive = true;if (slt>5){ slt =5;}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -