📄 pingusprite.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -