Skip to content
Permalink
Browse files

Fixed the Spawning and despawning, added the ability to lose and

restart, hopefully this push works, it didnt earlier
  • Loading branch information
jdm13003 committed Apr 27, 2016
1 parent bafc8e4 commit dc23a8158322e6369eb8903f0316fca272a25e0c
Showing with 78 additions and 5 deletions.
  1. +77 −5 src/main/Game.java
  2. +1 −0 src/main/Skins.java
@@ -39,6 +39,8 @@
private BufferedImage level4 = null;
private BufferedImage level5 = null;
private BufferedImage level6 = null;
private BufferedImage gameOver = null;


private int is_shooting = 0;
private int is_shooting2 = 0;
@@ -58,7 +60,8 @@

public static enum STATE {
MENU,
GAME
GAME,
END
};
public static STATE State = STATE.MENU;

@@ -83,6 +86,18 @@ public void init()

spriteSheet = loader.loadimage("/sprite_sheet.png");
background = loader.loadimage("/background.png");
level0 = loader.loadimage("/level0.png");
level1 = loader.loadimage("/Space1.png");
level2 = loader.loadimage("/Space2.png");
level3 = loader.loadimage("/Space3.png");
level4 = loader.loadimage("/Space4.png");
level5 = loader.loadimage("/Space5.png");
level6 = loader.loadimage("/Space6.png");
gameOver = loader.loadimage("/GameOver.png");





}catch(IOException e){
e.printStackTrace();
@@ -189,15 +204,36 @@ private void tick() {
}
if(Tiekills >= enemy_count){
if (enemy_count == 10){
SDcount++;
c.createSD(SDcount);
enemy_count = 2;
SDcount++;
Tiekills = 0;
c.createEnemy(enemy_count);
}else{
enemy_count +=1;
Tiekills = 0;
c.createEnemy(enemy_count);
}}
}
}
if(Score > 10){
level = 1;
}
if(Score > 500){
level = 2;
}
if(Score > 1000){
level = 3;
}
if(Score > 10000){
level = 4;
}
if(Score > 100000){
level = 5;
}
if(Score > 1000000){
level = 6;
}


}
private void render(){
@@ -209,7 +245,28 @@ private void render(){
Graphics g = bufferstrat.getDrawGraphics();
/////////////////
g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
g.drawImage(background, 0,0, null);

if(level == 0){
g.drawImage(level0, 0,0, null);
}
if(level == 1){
g.drawImage(level1, 0,0, null);
}
if(level == 2){
g.drawImage(level2, 0,0, null);
}
if(level == 3){
g.drawImage(level3, 0,0, null);
}
if(level == 4){
g.drawImage(level4, 0,0, null);
}
if(level == 5){
g.drawImage(level5, 0,0, null);
}
if(level > 5){
g.drawImage(level6, 0,0, null);
}
//g.drawImage(player, 100, 100, this);
if(State == STATE.GAME){
p.render(g);
@@ -218,7 +275,21 @@ private void render(){
p2.render(g);
}
}else if(State == STATE.MENU){
g.drawImage(background, 0,0, null);
menu.render(g);
delay = 0;
enemy_count = 1;
Tiekills = 0;
SDcount = 0;
SDkills = 0;
Score = 0;
level = 0;
}else if(State == STATE.END){
g.drawImage(gameOver,0,0, null);
if(delay == 10000){
State = STATE.MENU;
}
delay++;
}
/////////////////
g.dispose();
@@ -262,7 +333,8 @@ public void keyPressed(KeyEvent e){
c.addEntity(new Laser(p2.getX(),p2.getY(), tp, this));}
is_shooting2++;
}
}}
}
}

}

@@ -32,6 +32,7 @@ public void getTextures(){
enemy1 = ss.grabimage(1, 3, 64, 64);
player2 = ss.grabimage(2, 2, 64, 64);
enemyLaser = ss.grabimage(3, 2, 64, 64);
starDestroyer = ss.grabimage(3, 3, 128, 128);
}else{
player = ss.grabimage(playerx, playery, 64, 64);
laser = ss.grabimage(2, 3, 64, 64);

0 comments on commit dc23a81

Please sign in to comment.
You can’t perform that action at this time.