📄 bombjackscreen.java
字号:
scores[i] = datainputstream.readInt();
scoreNames[i] = datainputstream.readUTF();
}
}
catch(Exception exception)
{
for(int j = 0; j < scores.length; j++)
{
scores[j] = 0;
scoreNames[j] = "(elite)";
}
saveScores();
}
}
private void showMenu()
{
try
{
Display.getDisplay(parent).vibrate(0);
}
catch(Exception exception) { }
stopSound(musicPlayer);
gameMode = 10;
doPaint = false;
repaint();
bombs = null;
enemies = null;
otherEnemy = null;
displayText = null;
System.gc();
logo = ImageLoader.getImage(14);
eemo = ImageLoader.getImage(15);
elite = ImageLoader.getImage(16);
try
{
hiscores = Image.createImage("/v600/hiscore.png");
}
catch(Exception exception1) { }
gameMode = 50;
doPaint = true;
}
public void startGame()
{
System.gc();
gameMode = 10;
doPaint = false;
chooseEndGame = false;
firstPaint = true;
logo = null;
eemo = null;
elite = null;
displayText = null;
hiscores = null;
System.gc();
if(gameScreen == null)
{
gameScreen = Image.createImage(170, 182);
System.gc();
}
if(statusScreen == null)
{
statusScreen = Image.createImage(170, 10);
System.gc();
}
currentLevel = 0;
Player.player.reset();
buildLevel();
startLevel();
doPaint = true;
gameMode = 11;
}
public void startLevel()
{
playSound(sndStart);
oldScrollX = -99;
actionAnimCount = 0;
chooseEndGame = false;
powerball = null;
bonuscoin = null;
extracoin = null;
currentBomb = null;
Player.player.x = (playfield[0].length / 2 - 1) * 5;
Player.player.x -= ((GameObject) (Player.player)).x % 3;
Player.player.y = (playfield.length / 2 - 1) * 7;
Player.player.mode = 0;
Player.player.jumpCounter = 0;
Player.player.animCount = 0;
Player.player.isDead = false;
Player.player.isDying = false;
Player.player.powerMode = false;
Enemy.freeAll();
enemies = null;
scorePos = (int[][])null;
System.gc();
enemies = new Enemy[10];
scorePos = new int[25][];
buildStatusScreen();
for(int i = 0; i < enemymap.length; i++)
{
for(int k = 0; k < enemymap[i].length; k++)
enemymap[i][k] = 0;
}
int j = 0;
Enemy.resetRobotFactories();
for(byte byte0 = 0; byte0 < robotFactories.length; byte0++)
{
Enemy enemy = Enemy.produceRobot(byte0);
if(enemy != null)
{
enemy.ID = (short)(j + 3);
enemies[j++] = enemy;
}
}
short aword0[][] = ImageLoader.getEnemyData(currentLevel);
for(int l = 0; l < aword0.length; l++)
if(aword0[l][0] == 2)
{
enemies[j] = Enemy.getEnemy();
enemies[j].init((byte)11, aword0[l][1] * 5, aword0[l][2] * 7, ImageLoader.getImage(2), j + 3);
j++;
}
}
public void buildLevel()
{
Player.player.orderCollect = 0;
Player.player.bombCollect = 0;
Player.player.bonus = 1;
bombs = null;
enemies = null;
robotFactories = null;
System.gc();
for(int i = 0; i < playfield.length; i++)
{
for(int j = 0; j < playfield[i].length; j++)
{
playfield[i][j] = 0;
enemymap[i][j] = 0;
}
}
byte abyte0[][] = ImageLoader.getPlatformData(currentLevel);
byte abyte1[][] = ImageLoader.getBombData(currentLevel);
short aword0[][] = ImageLoader.getEnemyData(currentLevel);
Platform aplatform[] = new Platform[abyte0.length];
bombs = new Bomb[abyte1.length];
enemies = new Enemy[10];
int k = 0;
for(int l = 0; l < aword0.length; l++)
if(aword0[l][0] == 1)
k++;
robotFactories = new byte[k];
for(int i1 = 0; i1 < abyte0.length; i1++)
{
byte byte0 = abyte0[i1][0];
byte byte2 = abyte0[i1][1];
byte byte4 = abyte0[i1][2];
byte byte5 = abyte0[i1][3];
aplatform[i1] = new Platform(byte0 * 5, byte2 * 7, byte4, byte5, currentLevel);
for(int k2 = 0; k2 < byte4; k2++)
switch(byte5)
{
case 1: // '\001'
if(k2 != 0 && k2 != byte4 - 1)
playfield[byte2][byte0 + k2] = 1;
break;
case 2: // '\002'
playfield[byte2][byte0 + k2] = 1;
break;
default:
playfield[byte2 + k2][byte0] = 1;
playfield[byte2 + k2][byte0 + 1] = 1;
break;
}
}
for(int j1 = 0; j1 < abyte1.length; j1++)
{
byte byte1 = abyte1[j1][0];
byte byte3 = abyte1[j1][1];
bombs[j1] = new Bomb(byte1 * 5, byte3 * 7, j1);
playfield[byte3][byte1] = (byte)(50 + j1);
playfield[byte3][byte1 + 1] = (byte)(50 + j1);
playfield[byte3 + 1][byte1] = (byte)(50 + j1);
playfield[byte3 + 1][byte1 + 1] = (byte)(50 + j1);
}
int k1 = 0;
for(int l1 = 0; l1 < aword0.length; l1++)
if(aword0[l1][0] == 1)
{
robotFactories[l1] = (byte)l1;
Enemy.addRobotFactory(k1++, (byte)aword0[l1][2], (byte)aword0[l1][3], (byte)aword0[l1][1], aword0[l1][4], (byte)aword0[l1][6], aword0[l1][5]);
}
Image image;
for(image = null; image == null;)
try
{
switch(currentLevel % 5)
{
case 1: // '\001'
image = Image.createImage("/v600/bg-02.png");
otherEnemy = ImageLoader.getImage(5);
otherEnemyType = 13;
break;
case 2: // '\002'
image = Image.createImage("/v600/bg-03.png");
otherEnemy = ImageLoader.getImage(7);
otherEnemyType = 12;
break;
case 3: // '\003'
image = Image.createImage("/v600/bg-04.png");
otherEnemy = ImageLoader.getImage(6);
otherEnemyType = 15;
break;
case 4: // '\004'
image = Image.createImage("/v600/bg-05.png");
otherEnemy = ImageLoader.getImage(8);
otherEnemyType = 14;
break;
default:
image = Image.createImage("/v600/bg-01.png");
otherEnemy = ImageLoader.getImage(7);
otherEnemyType = 12;
break;
}
System.gc();
}
catch(Exception exception)
{
exception.printStackTrace();
try
{
Thread.sleep(43L);
Thread.yield();
}
catch(Exception exception1) { }
}
Graphics g = gameScreen.getGraphics();
g.setClip(0, 0, 170, 182);
g.drawImage(image, 0, 0, 20);
for(int i2 = 0; i2 < aplatform.length; i2++)
if(aplatform[i2] != null)
aplatform[i2].draw(g);
for(int j2 = 0; j2 < bombs.length; j2++)
if(bombs[j2] != null)
{
bombs[j2].setClear(image);
bombs[j2].draw(g);
}
aplatform = null;
image = null;
System.gc();
System.out.println("BUILD SCREEN FINISHED:" + currentLevel);
}
public void buildStatusScreen()
{
if(statusGraphics == null)
statusGraphics = statusScreen.getGraphics();
statusGraphics.setColor(0);
statusGraphics.setClip(0, 0, statusScreen.getWidth(), statusScreen.getHeight());
statusGraphics.fillRect(0, 0, statusScreen.getWidth(), statusScreen.getHeight());
if(currentLevel % 5 == 1)
statusGraphics.setColor(Platform.palette2[0]);
else
statusGraphics.setColor(Platform.palette1[0]);
statusGraphics.drawLine(0, 0, statusScreen.getWidth(), 0);
byte byte0 = 2;
for(int i = 0; i < Player.player.lives && i < 5; i++)
{
statusGraphics.setClip(9 * i + 1, byte0, 7, 8);
statusGraphics.drawImage(ImageLoader.getImage(12), (9 * i + 1) - 111, byte0, 20);
}
int j = 73;
statusGraphics.setClip(j, 0, 20, 10);
statusGraphics.drawImage(ImageLoader.getImage(12), j - 40 - 40, byte0, 20);
int k = 10;
int l = currentLevel + 1;
j += 23;
for(int i1 = 0; i1 < 2; i1++)
{
statusGraphics.setClip(j + i1 * 4, byte0, 3, 5);
statusGraphics.drawImage(ImageLoader.getImage(12), (j + i1 * 4) - (l / k) * 4 - 40, byte0, 20);
l %= k;
k /= 10;
}
}
public int finishLevel()
{
gameMode = 10;
doPaint = false;
currentBomb = null;
currentLevel++;
if(currentLevel == 99)
{
return 2;
} else
{
buildLevel();
startLevel();
return 11;
}
}
private final void setCommands()
{
currentString = "";
removeCommand(commandPause);
removeCommand(commandBack);
removeCommand(commandYes);
removeCommand(commandNo);
removeCommand(commandExit);
removeCommand(commandOK);
removeCommand(commandCancel);
if(gameMode == 1 || gameMode == 11 || gameMode == 2 || gameMode == 4 || gameMode == 3)
addCommand(commandPause);
else
if(gameMode == -1)
{
addCommand(commandYes);
addCommand(commandNo);
} else
if(gameMode == 50)
{
addCommand(commandOK);
addCommand(commandExit);
} else
if(gameMode == 12 || gameMode == 13)
addCommand(commandBack);
else
if(gameMode == 14 || gameMode == 2)
{
addCommand(commandOK);
addCommand(commandCancel);
}
}
public void commandAction(Command command, Displayable displayable)
{
if(gameMode == 1 || gameMode == 4 || gameMode == 2 || gameMode == 3 || gameMode == 11)
{
if(command == commandPause)
{
oldGameMode = gameMode;
gameMode = -1;
currentString = "";
}
} else
if(gameMode == -1)
{
if(command == commandYes)
{
showMenu();
gameMode = 50;
} else
if(command == commandNo)
{
gameMode = oldGameMode;
oldScrollX = 9999;
}
} else
if(gameMode == 50)
{
if(command == commandExit)
{
gameMode = 23;
close();
parent.destroyApp(true);
} else
{
performCommand();
}
} else
if(gameMode == 12 || gameMode == 13)
{
if(command == commandBack)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -