Merge branch 'master' of github.com:teamteamteam/SpaceScooter
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
res/images/explosion2_16.png
Normal file
After Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 946 B After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 5.5 KiB |
62
src/de/teamteamteam/spacescooter/entity/EnemyFour.java
Normal file
@ -0,0 +1,62 @@
|
||||
package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class EnemyFour extends Enemy{
|
||||
|
||||
private ArrayList<Point> points;
|
||||
private int index =0;
|
||||
private Point nextPoint;
|
||||
private double x;
|
||||
private double y;
|
||||
private double vektorX;
|
||||
private double vektorY;
|
||||
|
||||
public EnemyFour(int x, int y, ArrayList<Point> points) {
|
||||
super(x, y);
|
||||
this.setImage("images/nyancat.png");
|
||||
this.setShootSpeed(4);
|
||||
this.setShootDelay(42);
|
||||
this.setShootSpawn(-10, 10);
|
||||
this.setHealthPoints(5);
|
||||
this.points = points;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
getNextPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
this.x -= vektorX;
|
||||
this.y -= vektorY;
|
||||
this.setPosition((int)x, (int)y);
|
||||
|
||||
if(this.getX() == (int)nextPoint.getX() && this.getY() == (int)nextPoint.getY()){
|
||||
getNextPoint();
|
||||
}
|
||||
}
|
||||
|
||||
private void neuerVektor(){
|
||||
vektorX = (this.getX() - nextPoint.getX());
|
||||
vektorY = (this.getY() - nextPoint.getY());
|
||||
double laenge = Math.sqrt(this.vektorX * this.vektorX + this.vektorY * this.vektorY);
|
||||
vektorX = vektorX/laenge;
|
||||
vektorY = vektorY/laenge;
|
||||
}
|
||||
|
||||
private void getNextPoint(){
|
||||
try{
|
||||
nextPoint = points.get(index);
|
||||
index++;
|
||||
neuerVektor();
|
||||
System.out.println("neuer point");
|
||||
}catch(IndexOutOfBoundsException e){
|
||||
System.out.println("ich bin dann mal weg!!");
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -60,6 +60,9 @@ public class ExplosionBig extends Explosion {
|
||||
case 10:
|
||||
this.setImage("images/explosion2_15.png");
|
||||
break;
|
||||
case 1:
|
||||
this.setImage("images/explosion2_16.png");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,14 +81,13 @@ public abstract class LivingEntity extends Entity implements Collidable {
|
||||
if (this.isAlive() == false) {
|
||||
if(GameConfig.DEBUG) System.out.println(this + " ist gestorben. RIP");
|
||||
this.explode();
|
||||
//Screen.currentScreen.addEntity(new Explosion(this.x, this.y));
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
Random rnd = new Random();
|
||||
if (rnd.nextInt(10) < 7) {
|
||||
if (rnd.nextInt(99) < 70) {
|
||||
Screen.currentScreen.addEntity(new Explosion(this.x, this.y));
|
||||
} else {
|
||||
Screen.currentScreen.addEntity(new ExplosionBig(this.x, this.y));
|
||||
|
@ -1,12 +1,15 @@
|
||||
package de.teamteamteam.spacescooter.screen;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import de.teamteamteam.spacescooter.background.StarBackground;
|
||||
import de.teamteamteam.spacescooter.control.Keyboard;
|
||||
import de.teamteamteam.spacescooter.entity.EnemyFour;
|
||||
import de.teamteamteam.spacescooter.entity.EnemyThree;
|
||||
import de.teamteamteam.spacescooter.entity.EnemyTwo;
|
||||
import de.teamteamteam.spacescooter.entity.Entity;
|
||||
@ -14,10 +17,16 @@ import de.teamteamteam.spacescooter.entity.Player;
|
||||
|
||||
public class GameScreen extends Screen {
|
||||
|
||||
private ArrayList<Point> points = new ArrayList<Point>();
|
||||
|
||||
public GameScreen(Screen parent) {
|
||||
super(parent);
|
||||
points.add(new Point(300,300));
|
||||
points.add(new Point(600,100));
|
||||
points.add(new Point(0,500));
|
||||
this.entities.add(new StarBackground(0, 0));
|
||||
this.entities.add(new Player(200, 300));
|
||||
this.entities.add(new EnemyFour(800, 400, points));
|
||||
this.entities.add(new EnemyThree(650, 300));
|
||||
this.entities.add(new EnemyThree(450, 100));
|
||||
this.entities.add(new EnemyTwo(750, 550));
|
||||
|