diff --git a/src/de/teamteamteam/spacescooter/entity/ItemChance.java b/src/de/teamteamteam/spacescooter/background/item/ItemChance.java similarity index 91% rename from src/de/teamteamteam/spacescooter/entity/ItemChance.java rename to src/de/teamteamteam/spacescooter/background/item/ItemChance.java index 72a420a..1b8f720 100644 --- a/src/de/teamteamteam/spacescooter/entity/ItemChance.java +++ b/src/de/teamteamteam/spacescooter/background/item/ItemChance.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.background.item; import java.util.Random; diff --git a/src/de/teamteamteam/spacescooter/entity/Items.java b/src/de/teamteamteam/spacescooter/background/item/Items.java similarity index 82% rename from src/de/teamteamteam/spacescooter/entity/Items.java rename to src/de/teamteamteam/spacescooter/background/item/Items.java index 4f19c51..ea38611 100644 --- a/src/de/teamteamteam/spacescooter/entity/Items.java +++ b/src/de/teamteamteam/spacescooter/background/item/Items.java @@ -1,6 +1,10 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.background.item; import java.util.LinkedList; + +import de.teamteamteam.spacescooter.entity.Entity; +import de.teamteamteam.spacescooter.entity.LivingEntity; +import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.screen.Screen; public abstract class Items extends LivingEntity{ diff --git a/src/de/teamteamteam/spacescooter/entity/TestItem1.java b/src/de/teamteamteam/spacescooter/background/item/TestItem1.java similarity index 69% rename from src/de/teamteamteam/spacescooter/entity/TestItem1.java rename to src/de/teamteamteam/spacescooter/background/item/TestItem1.java index 251f970..809fe9c 100644 --- a/src/de/teamteamteam/spacescooter/entity/TestItem1.java +++ b/src/de/teamteamteam/spacescooter/background/item/TestItem1.java @@ -1,4 +1,6 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.background.item; + +import de.teamteamteam.spacescooter.entity.Player; public class TestItem1 extends Items{ diff --git a/src/de/teamteamteam/spacescooter/entity/TestItem2.java b/src/de/teamteamteam/spacescooter/background/item/TestItem2.java similarity index 72% rename from src/de/teamteamteam/spacescooter/entity/TestItem2.java rename to src/de/teamteamteam/spacescooter/background/item/TestItem2.java index 3be7f51..2e8c199 100644 --- a/src/de/teamteamteam/spacescooter/entity/TestItem2.java +++ b/src/de/teamteamteam/spacescooter/background/item/TestItem2.java @@ -1,4 +1,6 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.background.item; + +import de.teamteamteam.spacescooter.entity.Player; public class TestItem2 extends Items{ diff --git a/src/de/teamteamteam/spacescooter/entity/TestItem3.java b/src/de/teamteamteam/spacescooter/background/item/TestItem3.java similarity index 72% rename from src/de/teamteamteam/spacescooter/entity/TestItem3.java rename to src/de/teamteamteam/spacescooter/background/item/TestItem3.java index 658d70d..74f68ec 100644 --- a/src/de/teamteamteam/spacescooter/entity/TestItem3.java +++ b/src/de/teamteamteam/spacescooter/background/item/TestItem3.java @@ -1,4 +1,6 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.background.item; + +import de.teamteamteam.spacescooter.entity.Player; public class TestItem3 extends Items{ diff --git a/src/de/teamteamteam/spacescooter/entity/TestItem4.java b/src/de/teamteamteam/spacescooter/background/item/TestItem4.java similarity index 72% rename from src/de/teamteamteam/spacescooter/entity/TestItem4.java rename to src/de/teamteamteam/spacescooter/background/item/TestItem4.java index 69f8e21..cacdda7 100644 --- a/src/de/teamteamteam/spacescooter/entity/TestItem4.java +++ b/src/de/teamteamteam/spacescooter/background/item/TestItem4.java @@ -1,4 +1,6 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.background.item; + +import de.teamteamteam.spacescooter.entity.Player; public class TestItem4 extends Items{ diff --git a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java index eaaaa20..c206e4b 100644 --- a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java @@ -3,6 +3,10 @@ package de.teamteamteam.spacescooter.entity; import java.awt.Rectangle; import java.util.LinkedList; +import de.teamteamteam.spacescooter.background.item.Items; +import de.teamteamteam.spacescooter.entity.enemy.Enemy; +import de.teamteamteam.spacescooter.entity.explosion.Explosion; +import de.teamteamteam.spacescooter.entity.shot.Shot; import de.teamteamteam.spacescooter.screen.Screen; import de.teamteamteam.spacescooter.utility.GameConfig; diff --git a/src/de/teamteamteam/spacescooter/entity/Player.java b/src/de/teamteamteam/spacescooter/entity/Player.java index c2f9f52..361714c 100644 --- a/src/de/teamteamteam/spacescooter/entity/Player.java +++ b/src/de/teamteamteam/spacescooter/entity/Player.java @@ -4,6 +4,7 @@ import java.awt.event.KeyEvent; import de.teamteamteam.spacescooter.control.Keyboard; import de.teamteamteam.spacescooter.control.KeyboardListener; +import de.teamteamteam.spacescooter.entity.shot.Shot; import de.teamteamteam.spacescooter.utility.GameConfig; public class Player extends ShootingEntity implements KeyboardListener { diff --git a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java index 7740680..4b31e6d 100644 --- a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java @@ -1,5 +1,6 @@ package de.teamteamteam.spacescooter.entity; +import de.teamteamteam.spacescooter.entity.shot.SingleBlueShot; import de.teamteamteam.spacescooter.screen.Screen; public abstract class ShootingEntity extends LivingEntity { diff --git a/src/de/teamteamteam/spacescooter/entity/Enemy.java b/src/de/teamteamteam/spacescooter/entity/enemy/Enemy.java similarity index 70% rename from src/de/teamteamteam/spacescooter/entity/Enemy.java rename to src/de/teamteamteam/spacescooter/entity/enemy/Enemy.java index e8e7174..2289bc3 100644 --- a/src/de/teamteamteam/spacescooter/entity/Enemy.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/Enemy.java @@ -1,6 +1,9 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.enemy; import java.util.Random; +import de.teamteamteam.spacescooter.entity.ShootingEntity; +import de.teamteamteam.spacescooter.entity.shot.Shot; + public abstract class Enemy extends ShootingEntity { public Enemy(int x, int y) { diff --git a/src/de/teamteamteam/spacescooter/entity/EnemyFour.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java similarity index 92% rename from src/de/teamteamteam/spacescooter/entity/EnemyFour.java rename to src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java index 82d900f..d890ab9 100644 --- a/src/de/teamteamteam/spacescooter/entity/EnemyFour.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java @@ -1,61 +1,61 @@ -package de.teamteamteam.spacescooter.entity; - -import java.awt.Point; -import java.util.ArrayList; - -public class EnemyFour extends Enemy{ - - private ArrayList 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 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; - this.setCollisionDamage(this.getHealthPoints()); - 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(); - }catch(IndexOutOfBoundsException e){ - this.remove(); - } - } - -} +package de.teamteamteam.spacescooter.entity.enemy; + +import java.awt.Point; +import java.util.ArrayList; + +public class EnemyFour extends Enemy{ + + private ArrayList 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 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; + this.setCollisionDamage(this.getHealthPoints()); + 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(); + }catch(IndexOutOfBoundsException e){ + this.remove(); + } + } + +} diff --git a/src/de/teamteamteam/spacescooter/entity/EnemyOne.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyOne.java similarity index 87% rename from src/de/teamteamteam/spacescooter/entity/EnemyOne.java rename to src/de/teamteamteam/spacescooter/entity/enemy/EnemyOne.java index 1e78103..3fed60e 100644 --- a/src/de/teamteamteam/spacescooter/entity/EnemyOne.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyOne.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.enemy; public class EnemyOne extends Enemy { diff --git a/src/de/teamteamteam/spacescooter/entity/EnemyThree.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java similarity index 87% rename from src/de/teamteamteam/spacescooter/entity/EnemyThree.java rename to src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java index 779be1e..a10d394 100644 --- a/src/de/teamteamteam/spacescooter/entity/EnemyThree.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java @@ -1,9 +1,12 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.enemy; import java.util.Iterator; import java.util.LinkedList; import java.util.Random; +import de.teamteamteam.spacescooter.background.item.Items; +import de.teamteamteam.spacescooter.entity.Entity; +import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.screen.Screen; import de.teamteamteam.spacescooter.utility.GameConfig; diff --git a/src/de/teamteamteam/spacescooter/entity/EnemyTwo.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java similarity index 94% rename from src/de/teamteamteam/spacescooter/entity/EnemyTwo.java rename to src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java index 10d16ad..8ea4b6b 100644 --- a/src/de/teamteamteam/spacescooter/entity/EnemyTwo.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.enemy; import java.util.Random; diff --git a/src/de/teamteamteam/spacescooter/entity/Explosion.java b/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java similarity index 94% rename from src/de/teamteamteam/spacescooter/entity/Explosion.java rename to src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java index 7945900..b467334 100644 --- a/src/de/teamteamteam/spacescooter/entity/Explosion.java +++ b/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java @@ -1,7 +1,8 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.explosion; import java.util.Random; +import de.teamteamteam.spacescooter.entity.Entity; import de.teamteamteam.spacescooter.screen.Screen; diff --git a/src/de/teamteamteam/spacescooter/entity/ExplosionOne.java b/src/de/teamteamteam/spacescooter/entity/explosion/ExplosionOne.java similarity index 88% rename from src/de/teamteamteam/spacescooter/entity/ExplosionOne.java rename to src/de/teamteamteam/spacescooter/entity/explosion/ExplosionOne.java index 2d1b5ee..90de8e2 100644 --- a/src/de/teamteamteam/spacescooter/entity/ExplosionOne.java +++ b/src/de/teamteamteam/spacescooter/entity/explosion/ExplosionOne.java @@ -1,4 +1,6 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.explosion; + +import de.teamteamteam.spacescooter.entity.Entity; public class ExplosionOne extends Entity { diff --git a/src/de/teamteamteam/spacescooter/entity/ExplosionTwo.java b/src/de/teamteamteam/spacescooter/entity/explosion/ExplosionTwo.java similarity index 93% rename from src/de/teamteamteam/spacescooter/entity/ExplosionTwo.java rename to src/de/teamteamteam/spacescooter/entity/explosion/ExplosionTwo.java index c6e9402..403070a 100644 --- a/src/de/teamteamteam/spacescooter/entity/ExplosionTwo.java +++ b/src/de/teamteamteam/spacescooter/entity/explosion/ExplosionTwo.java @@ -1,4 +1,6 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.explosion; + +import de.teamteamteam.spacescooter.entity.Entity; public class ExplosionTwo extends Entity { diff --git a/src/de/teamteamteam/spacescooter/entity/Shot.java b/src/de/teamteamteam/spacescooter/entity/shot/Shot.java similarity index 91% rename from src/de/teamteamteam/spacescooter/entity/Shot.java rename to src/de/teamteamteam/spacescooter/entity/shot/Shot.java index fe4eec0..f6adc19 100644 --- a/src/de/teamteamteam/spacescooter/entity/Shot.java +++ b/src/de/teamteamteam/spacescooter/entity/shot/Shot.java @@ -1,5 +1,6 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.shot; +import de.teamteamteam.spacescooter.entity.LivingEntity; import de.teamteamteam.spacescooter.utility.GameConfig; public abstract class Shot extends LivingEntity { diff --git a/src/de/teamteamteam/spacescooter/entity/SingleBlueShot.java b/src/de/teamteamteam/spacescooter/entity/shot/SingleBlueShot.java similarity index 82% rename from src/de/teamteamteam/spacescooter/entity/SingleBlueShot.java rename to src/de/teamteamteam/spacescooter/entity/shot/SingleBlueShot.java index 784b931..6407ff0 100644 --- a/src/de/teamteamteam/spacescooter/entity/SingleBlueShot.java +++ b/src/de/teamteamteam/spacescooter/entity/shot/SingleBlueShot.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.shot; public class SingleBlueShot extends Shot { diff --git a/src/de/teamteamteam/spacescooter/entity/SingleRedShot.java b/src/de/teamteamteam/spacescooter/entity/shot/SingleRedShot.java similarity index 82% rename from src/de/teamteamteam/spacescooter/entity/SingleRedShot.java rename to src/de/teamteamteam/spacescooter/entity/shot/SingleRedShot.java index 9da1829..80f47ea 100644 --- a/src/de/teamteamteam/spacescooter/entity/SingleRedShot.java +++ b/src/de/teamteamteam/spacescooter/entity/shot/SingleRedShot.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.shot; public class SingleRedShot extends Shot { diff --git a/src/de/teamteamteam/spacescooter/entity/SingleShot.java b/src/de/teamteamteam/spacescooter/entity/shot/SingleShot.java similarity index 82% rename from src/de/teamteamteam/spacescooter/entity/SingleShot.java rename to src/de/teamteamteam/spacescooter/entity/shot/SingleShot.java index d803f32..87a4e6f 100644 --- a/src/de/teamteamteam/spacescooter/entity/SingleShot.java +++ b/src/de/teamteamteam/spacescooter/entity/shot/SingleShot.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.entity.shot; public class SingleShot extends Shot { diff --git a/src/de/teamteamteam/spacescooter/screen/GameScreen.java b/src/de/teamteamteam/spacescooter/screen/GameScreen.java index 49f7b14..da8f945 100644 --- a/src/de/teamteamteam/spacescooter/screen/GameScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/GameScreen.java @@ -8,13 +8,13 @@ import java.util.Iterator; import java.util.LinkedList; import de.teamteamteam.spacescooter.background.StarBackground; +import de.teamteamteam.spacescooter.background.item.ItemChance; import de.teamteamteam.spacescooter.control.Keyboard; -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.ItemChance; import de.teamteamteam.spacescooter.entity.Player; +import de.teamteamteam.spacescooter.entity.enemy.EnemyFour; +import de.teamteamteam.spacescooter.entity.enemy.EnemyThree; public class GameScreen extends Screen {