Updated USE_CREDIT
This commit is contained in:
parent
60d30f2ed2
commit
d49a78e71a
2 changed files with 18 additions and 14 deletions
|
@ -34,11 +34,11 @@ public class GameEngine {
|
|||
private Scene scene;
|
||||
private int p1CreditTime, p2CreditTime, creditTickTime = 1;
|
||||
public static final int PLAYER_WIDTH = 120, PLAYER_HEIGHT = 120;
|
||||
public static final int UP=0,RIGHT=1,DOWN=2, LEFT=3, FIRE=4, SPECIAL=5;
|
||||
public static final int UP=0,RIGHT=1,DOWN=2, LEFT=3, FIRE=4, USE_CREDIT=5;
|
||||
public int p1HighScore, p2HighScore;
|
||||
|
||||
private int[] p1Controlles = {KeyEvent.VK_UP, KeyEvent.VK_RIGHT, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT, KeyEvent.VK_K};
|
||||
private int[] p2Controlles = {KeyEvent.VK_W, KeyEvent.VK_D, KeyEvent.VK_S, KeyEvent.VK_A, KeyEvent.VK_Q};
|
||||
private int[] p1Controlles = {KeyEvent.VK_UP, KeyEvent.VK_RIGHT, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT, KeyEvent.VK_K, KeyEvent.VK_J};
|
||||
private int[] p2Controlles = {KeyEvent.VK_W, KeyEvent.VK_D, KeyEvent.VK_S, KeyEvent.VK_A, KeyEvent.VK_Q, KeyEvent.VK_Z};
|
||||
|
||||
private int p1Lives, p2Lives, p1Health, p2Health, credits, p1Score, p2Score;
|
||||
|
||||
|
|
|
@ -221,7 +221,9 @@ public abstract class Level extends Scene {
|
|||
p1Missiles.add(new Missile(players.get(0).getCenterX() - 15, (int) players.get(0).getLocY(), getStageWidth(), getStageHeight(), players.get(0).getAcceleration() + 3, "P1Laser.png", 4));
|
||||
players.get(0).updateFireTime();
|
||||
}
|
||||
if(engine.getP1Health() <= 0 && engine.getCredits() > 0) {
|
||||
}
|
||||
if(keys.get(engine.getP1Controlles()[GameEngine.USE_CREDIT]) && engine.getP1Health() <= 0 ){
|
||||
if(engine.getCredits() > 0) {
|
||||
engine.revivePlayer(0);
|
||||
players.get(0).resetPlayer();
|
||||
|
||||
|
@ -255,9 +257,11 @@ public abstract class Level extends Scene {
|
|||
p2Missiles.add(new Missile(players.get(1).getCenterX() - 15, (int)players.get(1).getLocY(),getStageWidth(),getStageHeight(),players.get(1).getAcceleration() + 3, "P1Laser.png", 4));
|
||||
players.get(1).updateFireTime();
|
||||
}
|
||||
if(engine.getP2Health() <= 0 && engine.getCredits() > 0) {
|
||||
}
|
||||
if(keys.get(engine.getP2Controlles()[GameEngine.USE_CREDIT]) && engine.getP2Health() <= 0 ){
|
||||
if(engine.getCredits() > 0) {
|
||||
engine.revivePlayer(1);
|
||||
players.get(0).resetPlayer();
|
||||
players.get(1).resetPlayer();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue