?? bullettrace.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 BulletTrace extends TimerTask {
private ShowMap sm;
public static int xSc = 3, ySc = -6;
public int[] pos,target;
public int size = 0,xScale,yScale;
public boolean alive = true;
public BulletTrace(ShowMap showMap) {
sm = showMap;
xScale = xSc;
yScale = ySc;
pos = sm.getPersonPosition();
target = new int[2];
target[0] = -50;
target[1] = -50;
if(sm.perX > 40){
xSc = - 4;
}
if(sm.perY < 20 ){
ySc = 3;
}
//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];
}
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 <= 5){
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 == 5){
target[0] = pos[0] + (sm.bulletList[sm.bulletList.length -1][2]) / 2;
target[1] = pos[1] + (sm.bulletList[sm.bulletList.length -1][2]) / 2;
}
}
}
public void move(int offset){
pos[0] += offset;
target[0] += offset;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -