Merge branch 'master' of ssh://github.com/teamteamteam/SpaceScooter
Conflicts: src/de/teamteamteam/spacescooter/screen/GameScreen.java
This commit is contained in:
commit
a52e000905
BIN
res/images/explosion_proto.png
Normal file
BIN
res/images/explosion_proto.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 B |
@ -1,5 +1,6 @@
|
||||
package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
import de.teamteamteam.spacescooter.screen.Screen;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class Enemy extends ShootingEntity {
|
||||
@ -21,5 +22,13 @@ public abstract class Enemy extends ShootingEntity {
|
||||
this.shoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shoot() {
|
||||
if(this.currentShootDelay == 0) {
|
||||
Screen.currentScreen.addEntity(new SingleRedShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue));
|
||||
this.currentShootDelay = this.shootDelay;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,44 +1,53 @@
|
||||
package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Explosion extends Entity {
|
||||
import de.teamteamteam.spacescooter.screen.Screen;
|
||||
|
||||
private int count = 71;
|
||||
|
||||
public class Explosion extends LivingEntity {
|
||||
|
||||
private boolean isActive = true;
|
||||
|
||||
public Explosion(int x, int y) {
|
||||
super(x, y);
|
||||
this.setImage("images/explosion1.png");
|
||||
this.setImage("images/explosion_proto.png");
|
||||
this.setPosition(x - (this.getWidth()/2), y - (this.getHeight()/2));
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(99) <= 70) {
|
||||
Screen.currentScreen.addEntity(new ExplosionOne(x, y));
|
||||
} else {
|
||||
Screen.currentScreen.addEntity(new ExplosionTwo(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
public Explosion(final int x, final int y, final int count, final int height, final int width) {
|
||||
super(x, y);
|
||||
this.setImage("images/explosion_proto.png");
|
||||
this.setPosition(x, y);
|
||||
Thread explosionThread = new Thread(new Runnable() { //not yet compatible
|
||||
public void run() {
|
||||
Random rnd = new Random();
|
||||
for (int i = 0; i <= count; i++) {
|
||||
new Explosion(x + (int) (width*rnd.nextDouble()), y + (int) (height*rnd.nextDouble()));
|
||||
try {
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (i == count - 1) {
|
||||
isActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
explosionThread.start();
|
||||
if(!this.isActive) {
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
if (count >= 0) {
|
||||
count--;
|
||||
} else {
|
||||
this.remove();
|
||||
}
|
||||
switch (count) {
|
||||
case 70:
|
||||
this.setImage("images/explosion1.png");
|
||||
break;
|
||||
case 60:
|
||||
this.setImage("images/explosion2.png");
|
||||
break;
|
||||
case 50:
|
||||
this.setImage("images/explosion3.png");
|
||||
break;
|
||||
case 40:
|
||||
this.setImage("images/explosion4.png");
|
||||
break;
|
||||
case 30:
|
||||
this.setImage("images/explosion5.png");
|
||||
break;
|
||||
case 20:
|
||||
this.setImage("images/explosion6.png");
|
||||
break;
|
||||
case 10:
|
||||
this.setImage("images/explosion7.png");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
43
src/de/teamteamteam/spacescooter/entity/ExplosionOne.java
Normal file
43
src/de/teamteamteam/spacescooter/entity/ExplosionOne.java
Normal file
@ -0,0 +1,43 @@
|
||||
package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
public class ExplosionOne extends LivingEntity {
|
||||
|
||||
private int count = 71;
|
||||
|
||||
public ExplosionOne(int x, int y) {
|
||||
super(x, y);
|
||||
this.setImage("images/explosion_proto.png");
|
||||
this.setPosition(x - (this.getWidth()/2), y - (this.getHeight()/2));
|
||||
}
|
||||
|
||||
public void update() {
|
||||
if (count >= 0) {
|
||||
count--;
|
||||
} else {
|
||||
this.remove();
|
||||
}
|
||||
switch (count) {
|
||||
case 70:
|
||||
this.setImage("images/explosion1.png");
|
||||
break;
|
||||
case 60:
|
||||
this.setImage("images/explosion2.png");
|
||||
break;
|
||||
case 50:
|
||||
this.setImage("images/explosion3.png");
|
||||
break;
|
||||
case 40:
|
||||
this.setImage("images/explosion4.png");
|
||||
break;
|
||||
case 30:
|
||||
this.setImage("images/explosion5.png");
|
||||
break;
|
||||
case 20:
|
||||
this.setImage("images/explosion6.png");
|
||||
break;
|
||||
case 10:
|
||||
this.setImage("images/explosion7.png");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
public class ExplosionBig extends Explosion {
|
||||
public class ExplosionTwo extends LivingEntity {
|
||||
|
||||
private int count = 141;
|
||||
|
||||
public ExplosionBig(int x, int y) {
|
||||
public ExplosionTwo(int x, int y) {
|
||||
super(x, y);
|
||||
this.setImage("images/explosion_proto.png");
|
||||
this.setPosition(x - (this.getWidth()/2), y - (this.getHeight()/2));
|
||||
}
|
||||
|
||||
public void update() {
|
@ -2,7 +2,6 @@ package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Random;
|
||||
|
||||
import de.teamteamteam.spacescooter.screen.Screen;
|
||||
import de.teamteamteam.spacescooter.utility.GameConfig;
|
||||
@ -91,12 +90,7 @@ public abstract class LivingEntity extends Entity implements Collidable {
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
Random rnd = new Random();
|
||||
if (rnd.nextInt(99) < 70) {
|
||||
Screen.currentScreen.addEntity(new Explosion(this.x, this.y));
|
||||
} else {
|
||||
Screen.currentScreen.addEntity(new ExplosionBig(this.x, this.y));
|
||||
}
|
||||
Screen.currentScreen.addEntity(new Explosion(this.x, this.y));
|
||||
}
|
||||
|
||||
public void setHealthPoints(int hp) {
|
||||
|
@ -3,6 +3,7 @@ package de.teamteamteam.spacescooter.entity;
|
||||
import java.awt.event.KeyEvent;
|
||||
import de.teamteamteam.spacescooter.control.Keyboard;
|
||||
import de.teamteamteam.spacescooter.utility.GameConfig;
|
||||
import de.teamteamteam.spacescooter.screen.Screen;
|
||||
|
||||
public class Player extends ShootingEntity {
|
||||
|
||||
@ -45,6 +46,14 @@ public class Player extends ShootingEntity {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shoot() {
|
||||
if(this.currentShootDelay == 0) {
|
||||
Screen.currentScreen.addEntity(new SingleBlueShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue));
|
||||
this.currentShootDelay = this.shootDelay;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCanMove(boolean canMove){
|
||||
this.canMove = canMove;
|
||||
}
|
||||
|
@ -4,13 +4,13 @@ import de.teamteamteam.spacescooter.screen.Screen;
|
||||
|
||||
public abstract class ShootingEntity extends LivingEntity {
|
||||
|
||||
private int shootDelay;
|
||||
private int currentShootDelay;
|
||||
private int shootSpawnX;
|
||||
private int shootSpawnY;
|
||||
private int shootDirection;
|
||||
private int damageValue = 5;
|
||||
private int shootSpeed;
|
||||
protected int shootDelay;
|
||||
protected int currentShootDelay;
|
||||
protected int shootSpawnX;
|
||||
protected int shootSpawnY;
|
||||
protected int shootDirection;
|
||||
protected int damageValue = 5;
|
||||
protected int shootSpeed;
|
||||
|
||||
public ShootingEntity(int x, int y) {
|
||||
super(x, y);
|
||||
|
@ -0,0 +1,9 @@
|
||||
package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
public class SingleBlueShot extends Shot {
|
||||
|
||||
public SingleBlueShot(int x, int y, int shootDirection, int shootSpeed, int damageValue) {
|
||||
super(x, y, shootDirection, shootSpeed, damageValue);
|
||||
this.setImage("images/shot02.png");
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
public class SingleRedShot extends Shot {
|
||||
|
||||
public SingleRedShot(int x, int y, int shootDirection, int shootSpeed, int damageValue) {
|
||||
super(x, y, shootDirection, shootSpeed, damageValue);
|
||||
this.setImage("images/shot04.png");
|
||||
}
|
||||
}
|
@ -4,6 +4,6 @@ public class SingleShot extends Shot {
|
||||
|
||||
public SingleShot(int x, int y, int shootDirection, int shootSpeed, int damageValue) {
|
||||
super(x, y, shootDirection, shootSpeed, damageValue);
|
||||
this.setImage("images/shot.png");
|
||||
this.setImage("images/shot02.png");
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import de.teamteamteam.spacescooter.entity.EnemyFour;
|
||||
import de.teamteamteam.spacescooter.entity.EnemyThree;
|
||||
import de.teamteamteam.spacescooter.entity.Entity;
|
||||
import de.teamteamteam.spacescooter.entity.HealthBar;
|
||||
import de.teamteamteam.spacescooter.entity.Explosion;
|
||||
import de.teamteamteam.spacescooter.entity.ItemChance;
|
||||
import de.teamteamteam.spacescooter.entity.Player;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user