📄 ogrebullet.java
字号:
package shoot;
import java.util.TimerTask;
/**
* <p>Title: Shoot game from Rex</p>
* <p>Description: This is a shoot game.</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: SkyPlay</p>
* @author Kevin
* @version 1.0
*/
public class OgreBullet extends TimerTask {
private ShowMap sm;
public int[] pos, target;
public static int xSc = 2,ySc = 6;
public int size = 5, xScale, yScale;
public boolean alive = true;
public OgreBullet(ShowMap showMap) {
sm = showMap;
xScale = xSc;
yScale = ySc;
pos = sm.getOgrePosition();
target = new int[2];
target[0] = -50;
target[1] = -50;
if(sm.perY < 20 ){
ySc = 0;
}
//target[0] = pos[0] + (sm.bulletList[0][2] -
// sm.bulletList[sm.bulletList.length - 1][2]) / 2 +
// sm.bulletList.length * xScale;
//target[1] = pos[1] + (sm.bulletList[0][2] -
// sm.bulletList[sm.bulletList.length - 1][2]) / 2 +
// sm.bulletList.length * yScale - sm.bulletList[0][2];
//System.out.println("targetX:"+target[0]+" targetY:"+target[1]);
pos[1] = pos[1] - sm.bulletList[0][2] / 2;
}
public void run() {
/**@todo Implement this java.lang.Runnable abstract method*/
size--;
//if(size == 5) System.out.println("X:"+pos[0]+" Y:"+pos[1]);
if(size >= 0){
pos[0] = pos[0] + (sm.bulletList[size + 1][2] - sm.bulletList[size][2]) / 2 + xScale;
pos[1] = pos[1] + (sm.bulletList[size + 1][2] - sm.bulletList[size][2]) / 2 + yScale;
sm.repaint();
sm.serviceRepaints();
if(size == 0) {
target[0] = pos[0] + (sm.bulletList[0][2]) / 2;
target[1] = pos[1] + (sm.bulletList[0][2]) / 2;
int[] po = sm.getPersonPosition();
//System.out.println("X:"+po[0]+" Y:"+po[1]+" tX:"+target[0]+" tY:"+target[1]);
}
}
}
public void move(int offset) {
pos[0] += offset;
target[0] += offset;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -