This commit is contained in:
Pan 2019-04-08 19:11:53 +12:00
parent cc4a595dec
commit ceb9a95dcf
5 changed files with 52 additions and 14 deletions

View File

@ -207,6 +207,11 @@ public class AssetManager {
mainThread.pc.init(); mainThread.pc.init();
mainThread.ec.init(); mainThread.ec.init();
lightTank.tileCheckList_player = solidObject.generateTileCheckList(5f);
lightTank.tileCheckList_enemy = solidObject.generateTileCheckList(5f);
techCenter.resetResarchStatus();
communicationCenter.resetResearchStatus();
addConstructionVehicle(new constructionVehicle(new vector(3.125f,-0.3f, 2.125f), 90, 0)); addConstructionVehicle(new constructionVehicle(new vector(3.125f,-0.3f, 2.125f), 90, 0));
addConstructionVehicle(new constructionVehicle(new vector(29.625f,-0.3f, 28.875f), 90, 1)); addConstructionVehicle(new constructionVehicle(new vector(29.625f,-0.3f, 28.875f), 90, 1));

View File

@ -105,7 +105,7 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
} }
frameIndex = 0; frameIndex = 0;
frameInterval = 33; frameInterval = 35;
lastDraw = 0; lastDraw = 0;
@ -121,8 +121,8 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
t.addActionListener(this); t.addActionListener(this);
//create a daemon thread which will sleep for the duration of the game //create a daemon thread which will sleep for the duration of the game
Thread dt = new Thread(new DaemonThread() ); //Thread dt = new Thread(new DaemonThread() );
dt.setDaemon(true); // dt.setDaemon(true);
//create another thread to create post processing effects //create another thread to create post processing effects
@ -132,7 +132,7 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
//start threads //start threads
t.start(); t.start();
dt.start(); //dt.start();
theTread.start(); theTread.start();
@ -179,7 +179,7 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
if(gameStarted) if(gameStarted)
gameFrame++; gameFrame++;
timeString = secondsToString(gameFrame/30); timeString = secondsToString(gameFrame/35);
//handle user's interaction with game GUI //handle user's interaction with game GUI
if(gameFrame == 1 && gameStarted){ if(gameFrame == 1 && gameStarted){
@ -496,15 +496,15 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
} }
public void regulateFramerate(){ public void regulateFramerate(){
if(frameIndex%30==0){ if(frameIndex%35==0){
double thisTime = System.currentTimeMillis(); double thisTime = System.currentTimeMillis();
framePerSecond = (int)(1000/((thisTime - lastTime)/30)); framePerSecond = (int)(1000/((thisTime - lastTime)/35));
lastTime = thisTime; lastTime = thisTime;
} }
sleepTime = 0; sleepTime = 0;
/*while(System.currentTimeMillis()-lastDraw<frameInterval){ while(System.currentTimeMillis()-lastDraw<frameInterval){
try { try {
Thread.sleep(1); Thread.sleep(1);
@ -513,7 +513,7 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }
}*/ }
lastDraw=System.currentTimeMillis(); lastDraw=System.currentTimeMillis();
} }

View File

@ -64,6 +64,20 @@ public class communicationCenter extends solidObject{
public static int intendedDeployLocation = -1; public static int intendedDeployLocation = -1;
public static void resetResearchStatus() {
harvesterSpeedResearched_player = false;
harvesterSpeedResearched_enemy = false;
rapidfireResearched_player = false;
rapidfireResearched_enemy = false;
harvesterSpeedResearchProgress_player = 255;
harvesterSpeedResearchProgress_enemy = 255;
rapidfireResearchProgress_player = 255;
rapidfireResearchProgress_enemy = 255;
creditSpentOnResearching_player = 0;
creditSpentOnResearching_enemy = 0;
intendedDeployLocation = -1;
}
public communicationCenter(float x, float y, float z, int teamNo){ public communicationCenter(float x, float y, float z, int teamNo){
//uncontrollable unit, but act as a big sized static collidable agent //uncontrollable unit, but act as a big sized static collidable agent
type = 106; type = 106;

View File

@ -126,11 +126,6 @@ public class lightTank extends solidObject{
movement_offscreen = new vector(0,0,0); movement_offscreen = new vector(0,0,0);
if(tileCheckList_player == null){
tileCheckList_player = generateTileCheckList(5f);
tileCheckList_enemy = generateTileCheckList(5f);
}
} }
public void makePolygons(){ public void makePolygons(){

View File

@ -69,6 +69,30 @@ public class techCenter extends solidObject{
public static int creditSpentOnResearching_player, creditSpentOnResearching_enemy; public static int creditSpentOnResearching_player, creditSpentOnResearching_enemy;
public static int intendedDeployLocation = -1; public static int intendedDeployLocation = -1;
public static void resetResarchStatus() {
lightTankResearched_player = false;
lightTankResearched_enemy = false;
rocketTankResearched_player = false;
rocketTankResearched_enemy = false;
stealthTankResearched_player = false;
stealthTankResearched_enemy = false;
heavyTankResearched_player = false;
heavyTankResearched_enemy = false;
lightTankResearchProgress_player = 255;
lightTankResearchProgress_enemy = 255;
rocketTankResearchProgress_player = 255;
rocketTankResearchProgress_enemy = 255;
stealthTankResearchProgress_player = 255;
stealthTankResearchProgress_enemy = 255;
heavyTankResearchProgress_player = 255;
heavyTankResearchProgress_enemy = 255;
creditSpentOnResearching_player = 0;
creditSpentOnResearching_enemy = 0;
intendedDeployLocation = -1;
}
public techCenter(float x, float y, float z, int teamNo){ public techCenter(float x, float y, float z, int teamNo){
//uncontrollable unit, but act as a big sized static collidable agent //uncontrollable unit, but act as a big sized static collidable agent