📄 player.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
package bombjack;
import gamelib.GameObject;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
// Referenced classes of package bombjack:
// ImageLoader, BombJackScreen
public class Player extends GameObject
{
public byte direction;
private Image playerImage;
private int playerAnim[][][];
public int animCount;
public int score;
public short lives;
public short orderCollect;
public short bombCollect;
public short bonus;
public short allbombs;
public static Player player = new Player();
public boolean powerMode;
public int powerTime;
public int enemyCollect;
public int lastBonus;
public int lastExtra;
private Player()
{
super(0, 0);
direction = 1;
animCount = 0;
score = 0;
lives = 3;
orderCollect = 0;
bombCollect = 0;
bonus = 2;
allbombs = 0;
powerMode = false;
powerTime = 0;
enemyCollect = 0;
lastBonus = 0;
lastExtra = 0;
playerImage = ImageLoader.getImage(9);
playerAnim = new int[5][][];
playerAnim[0] = new int[3][];
playerAnim[0][0] = (new int[] {
7, 7, 8, 8, 9, 9, 10, 10
});
playerAnim[0][1] = (new int[] {
11, 11, 12, 12, 13, 13, 14, 14
});
playerAnim[0][2] = (new int[] {
0
});
playerAnim[1] = new int[3][];
playerAnim[1][0] = (new int[] {
5
});
playerAnim[1][1] = (new int[] {
6
});
playerAnim[1][2] = (new int[] {
4
});
playerAnim[2] = new int[3][];
playerAnim[2][0] = (new int[] {
2
});
playerAnim[2][1] = (new int[] {
3
});
playerAnim[2][2] = (new int[] {
1
});
playerAnim[4] = new int[3][];
playerAnim[4][0] = (new int[] {
2
});
playerAnim[4][1] = (new int[] {
3
});
playerAnim[4][2] = (new int[] {
1
});
dieAnim = (new int[] {
7, 7, 11, 11, 7, 7, 11, 11, 15, 15,
15
});
width = 15;
height = 18;
mode = 0;
direction = 2;
}
public void die()
{
isDying = true;
animCount = 0;
BombJackScreen.stopSound(BombJackScreen.musicPlayer);
if(!BombJackScreen.doVibrate)
BombJackScreen.playSound(BombJackScreen.sndDead);
}
public void score(int i)
{
score += i * bonus;
}
public void reset()
{
score = 0;
lives = 3;
orderCollect = 0;
bombCollect = 0;
allbombs = 0;
bonus = 1;
animCount = 0;
lastBonus = 0;
lastExtra = 0;
isDying = false;
isDead = false;
}
public void draw(Graphics g)
{
draw(g, x, y);
}
public void draw(Graphics g, int i, int j)
{
j += 2;
byte byte0 = -3;
byte byte1 = -4;
if(isDying)
{
g.setClip(i + byte0, j + byte1, width, height);
g.clipRect(3, 0, 170, 182);
g.drawImage(playerImage, (i + byte0) - dieAnim[animCount] * width, j + byte1, 20);
if(++animCount >= dieAnim.length || isDead)
{
isDead = true;
animCount = dieAnim.length - 1;
}
return;
}
if(mode == 2)
byte1 = -7;
g.setClip(i + byte0, j + byte1, width, height);
g.clipRect(3, 0, 170, 182);
g.drawImage(playerImage, (i + byte0) - playerAnim[mode][direction][animCount] * width, j + byte1, 20);
ox = i + byte0;
oy = j + byte1;
owidth = width;
oheight = height;
}
public void animate()
{
animCount = (animCount + 1) % playerAnim[mode][direction].length;
}
public void move(int i, int j)
{
x += i;
y += j;
if(i < 0)
{
if(direction != 0)
animCount = 0;
direction = 0;
} else
if(i > 0)
{
if(direction != 1)
animCount = 0;
direction = 1;
} else
{
if(direction != 2)
animCount = 0;
direction = 2;
}
if(i != 0 || j != 0)
animate();
}
public int[][] getGridPos(int i, int j)
{
int k = (x + i) / 5;
int l = (y + j) / 7;
int i1 = (x + i) % 5;
if(i < 0)
{
if(i1 > 2)
k++;
} else
if(i > 0 && i1 > 2)
k++;
if(x + i < 0)
k = -1;
if(y + j < 0)
l = -1;
int ai[][] = {
{
k, l
}, {
k + 1, l
}, {
k, l + 1
}, {
k + 1, l + 1
}
};
return ai;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -