?? spritemarker.java
字號:
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
// Referenced classes of package ys.pingu:
// PinguSprite, PinguMIDlet, PinguCanvas, SpritePingu,
// SpriteYeti
class SpriteMarker extends PinguSprite
{
public boolean valid;
public static final int TYPEMARKER = 1;
public static final int TYPESCORE = 2;
public static final int POS0 = 16;
public static final int POS1 = 32;
public static final int POS2 = 64;
private static final int ANCHOR_IMG = 20;
private static final int ANCHOR_TXT = 17;
private static Image fr;
private int type;
private int lengthValue;
public SpriteMarker(int i, int j, int k, int l)
{
super(j, k, l);
type = i;
if(fr == null)
fr = PinguMIDlet.loadImage("/marker.png");
if(fr == null)
valid = false;
else
valid = true;
init();
}
public void init()
{
spriteInit();
}
public void draw()
{
accelerate(1);
move(1);
if((type & 0x1) == 1 && ((type & 0x20) == 32 || (type & 0x40) == 64) && !parked && (actPos_x * 333) / 1000 > PinguCanvas.IMAGE_WIDTH)
{
lengthValue += 1000;
actPos_x -= 1000;
}
if((type & 0x1) == 1)
{
if(PinguCanvas.GAMESTATE == 5)
{
velocity_x = 0;
velocity_y = 0;
parked = true;
}
if((type & 0x10) == 16)
{
PinguCanvas.GC.drawImage(fr, (actPos_x * 333) / 1000, actPos_y + 24, 20);
PinguCanvas.GC.drawString(" " + PinguCanvas.HIGHSCORE / 10 + "." + PinguCanvas.HIGHSCORE % 10 + " ", (actPos_x * 333) / 1000 + 28, actPos_y + 24 + 2, 17);
}
if((type & 0x20) == 32 || (type & 0x40) == 64)
{
PinguCanvas.GC.drawImage(fr, (actPos_x * 333) / 1000, actPos_y + 24, 20);
PinguCanvas.GC.drawString(" " + lengthValue / 10 + " ", (actPos_x * 333) / 1000 + 28, actPos_y + 24 + 2, 17);
}
} else
if((type & 0x2) == 2 && PinguCanvas.GAMESTATE == 5)
{
if(parked)
{
actPos_x = SpritePingu.LANDING_POSX - 24;
actPos_y = 0;
velocity_x = 0;
velocity_y = 1000;
acceleration_y = 750;
parked = false;
}
PinguCanvas.GC.drawImage(fr, actPos_x, actPos_y + 24, 20);
PinguCanvas.GC.drawString(" " + PinguCanvas.SCORE / 10 + "." + PinguCanvas.SCORE % 10 + " ", actPos_x + 28, actPos_y + 24 + 2, 17);
}
}
public void setVelocity(int i)
{
velocity_x = -1 * i;
if((type & 0x21) == 33)
{
actPos_x = (SpriteYeti.YETIPOS - 500) + 55;
lengthValue = 500;
} else
if((type & 0x41) == 65)
{
actPos_x = (SpriteYeti.YETIPOS - 1000) + 55;
lengthValue = 1000;
}
parked = false;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -