pingusprite.java
来自「j2me_nokia_flash打企鹅手机版」· Java 代码 · 共 61 行
JAVA
61 行
class PinguSprite
{
protected int velocity_x;
protected int velocity_y;
protected int acceleration_x;
protected int acceleration_y;
protected int actPos_x;
protected int actPos_y;
protected boolean parked;
protected int baseline;
private int xOrg;
private int yOrg;
protected PinguSprite(int i, int j, int k)
{
velocity_x = 0;
velocity_y = 0;
acceleration_x = 0;
acceleration_y = 0;
actPos_x = 0;
actPos_y = 0;
parked = true;
xOrg = i;
yOrg = j;
baseline = k;
spriteInit();
}
protected void spriteInit()
{
parked = true;
velocity_x = 0;
velocity_y = 0;
acceleration_x = 0;
acceleration_y = 0;
actPos_x = xOrg;
actPos_y = yOrg;
}
protected void move(int i)
{
if(!parked)
{
actPos_x += velocity_x / 1000;
actPos_y += velocity_y / 1000;
if(actPos_y > baseline)
actPos_y = baseline;
}
}
protected void accelerate(int i)
{
if(!parked)
{
velocity_x += acceleration_x;
velocity_y += acceleration_y;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?