Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
This should work now
  • Loading branch information
jdm13003 committed Apr 27, 2016
1 parent 035a73a commit 62f0528
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/main/Controller.java
Expand Up @@ -34,6 +34,10 @@ public class Controller {

}
}




public void createSD(int SDcount){
for(int n = 0; n < SDcount; n++){
addEntity(new StarDestroyer(810, r.nextInt(400), skin, this, game));
Expand Down
7 changes: 6 additions & 1 deletion src/main/EnemyFighter.java
Expand Up @@ -26,6 +26,10 @@ public class EnemyFighter extends GameObject implements EntityTypeB{
return x;
}
public void shoot(){
if (x <= -32 ){
controller.removeEntity(this);
game.setTieKills(game.getTieKills()+1);
}
if(is_shooting == 0){
controller.addEntity(new EnemyLaser(x, y, skin, game));
is_shooting++;
Expand All @@ -47,7 +51,8 @@ public class EnemyFighter extends GameObject implements EntityTypeB{
if(GamePhysics.Collision(this, tempa)){
controller.removeEntity(this);
controller.removeEntity(tempa);
game.setKills(game.getKills()+1);
game.setTieKills(game.getTieKills()+1);
game.setScore(game.getScore()+10);
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/Player.java
Expand Up @@ -43,7 +43,9 @@ public class Player extends GameObject implements EntityTypeA{
EntityTypeD tempa = game.ed.get(n);
if(GamePhysics.Collision(this, tempa)){
if(health == 1){
controller.removeEntity(this);}
game.State = game.State.END;
health = 3;
}
else{
health--;
controller.removeEntity(tempa);
Expand Down Expand Up @@ -78,5 +80,8 @@ public class Player extends GameObject implements EntityTypeA{
public Rectangle getBounds(){
return new Rectangle((int)x, (int) y, 64, 64);
}
public int getHealth(){
return health;
}

}
5 changes: 4 additions & 1 deletion src/main/Player2.java
Expand Up @@ -43,7 +43,10 @@ public class Player2 extends GameObject implements EntityTypeA{
EntityTypeD tempa = game.ed.get(n);
if(GamePhysics.Collision(this, tempa)){
if(health == 1){
controller.removeEntity(this);}
controller.removeEntity(this);
game.State = game.State.END;
health = 4;
}
else{
health--;
controller.removeEntity(tempa);
Expand Down
6 changes: 6 additions & 0 deletions src/main/StarDestroyer.java
Expand Up @@ -28,6 +28,10 @@ public class StarDestroyer extends GameObject implements EntityTypeC{
}

public void tick(){
if (x <= -100 ){
controller.removeEntity(this);
game.setTieKills(game.getTieKills()+1);
}
x -= speed;
shoot();
for(int n = 0; n < game.ea.size(); n++){
Expand All @@ -36,6 +40,8 @@ public class StarDestroyer extends GameObject implements EntityTypeC{
if(GamePhysics.Collision(this, tempa)){
if(health ==1)
{controller.removeEntity(this);
game.setSDKills(game.getSDKills()+1);
game.setScore(game.getScore()+100);
}
else{health--;}
controller.removeEntity(tempa);
Expand Down

0 comments on commit 62f0528

Please sign in to comment.