GamePlay fixes
This commit is contained in:
+16
-17
@@ -2,8 +2,8 @@ package control;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.Timer;
|
||||
|
||||
import model.GameModel;
|
||||
import view.GameView;
|
||||
@@ -26,20 +26,20 @@ public class GameControl implements JoystickListener, ButtonListener, ActionList
|
||||
this.view = view;
|
||||
this.gsm = gsm;
|
||||
view.setIgnoreRepaint(true);
|
||||
// update = new Timer(1000/60,this);
|
||||
// update.start();
|
||||
Timer update = new Timer();
|
||||
update.schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
model.update(currentTime - lastTime);
|
||||
lastTime = currentTime;
|
||||
view.repaint();
|
||||
System.out.println("Test");
|
||||
}
|
||||
}, 0,1000/120);
|
||||
update = new Timer(1000/60,this);
|
||||
update.start();
|
||||
// Timer update = new Timer();
|
||||
// update.schedule(new TimerTask() {
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// long currentTime = System.currentTimeMillis();
|
||||
// model.update(currentTime - lastTime);
|
||||
// lastTime = currentTime;
|
||||
// view.repaint();
|
||||
// System.out.println("Test");
|
||||
// }
|
||||
// }, 0,1000/120);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,5 +66,4 @@ public class GameControl implements JoystickListener, ButtonListener, ActionList
|
||||
lastTime = currentTime;
|
||||
view.repaint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,16 +41,18 @@ public class PlayState extends GameState {
|
||||
super(gsm, sh);
|
||||
infoPanel = new InfoPanel(0, 0);
|
||||
area = new PlayArea(256, 1024, 1024, 125);
|
||||
// for(int index = 0; index < 8; index++){
|
||||
// addEnemy(index, GameModel.colors[index % 6]);
|
||||
// }
|
||||
//
|
||||
player = new Player(1280 - 1024 + 1024 / 2, 1024 / 2);
|
||||
stroke = new BasicStroke(sizeOfEnemy, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
lifePoints = 100;
|
||||
currentScore = 0;
|
||||
comboScore = 0;
|
||||
oldProgress = 0 ;
|
||||
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
Reference in New Issue
Block a user