+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Tank game - Client/Tank game - Client.iml b/Tank game - Client/Tank game - Client.iml
new file mode 100644
index 00000000..443d7b43
--- /dev/null
+++ b/Tank game - Client/Tank game - Client.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/Collision.class b/Tank game - Client/out/production/Gruppe-306-PCSS/Collision.class
new file mode 100644
index 00000000..2bdf3c6a
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/Collision.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/Map.class b/Tank game - Client/out/production/Gruppe-306-PCSS/Map.class
new file mode 100644
index 00000000..ddb7f1f3
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/Map.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/Projectile.class b/Tank game - Client/out/production/Gruppe-306-PCSS/Projectile.class
new file mode 100644
index 00000000..b95adb35
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/Projectile.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/Tank.class b/Tank game - Client/out/production/Gruppe-306-PCSS/Tank.class
new file mode 100644
index 00000000..c472fb6d
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/Tank.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/Test2$1.class b/Tank game - Client/out/production/Gruppe-306-PCSS/Test2$1.class
new file mode 100644
index 00000000..99721cf5
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/Test2$1.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/Test2$2.class b/Tank game - Client/out/production/Gruppe-306-PCSS/Test2$2.class
new file mode 100644
index 00000000..682c2949
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/Test2$2.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/Test2.class b/Tank game - Client/out/production/Gruppe-306-PCSS/Test2.class
new file mode 100644
index 00000000..96bb9d24
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/Test2.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/test5$1.class b/Tank game - Client/out/production/Gruppe-306-PCSS/test5$1.class
new file mode 100644
index 00000000..c3855976
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/test5$1.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/test5$2.class b/Tank game - Client/out/production/Gruppe-306-PCSS/test5$2.class
new file mode 100644
index 00000000..30f784c5
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/test5$2.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/test5$Sprite.class b/Tank game - Client/out/production/Gruppe-306-PCSS/test5$Sprite.class
new file mode 100644
index 00000000..b4d9701f
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/test5$Sprite.class differ
diff --git a/Tank game - Client/out/production/Gruppe-306-PCSS/test5.class b/Tank game - Client/out/production/Gruppe-306-PCSS/test5.class
new file mode 100644
index 00000000..239b2479
Binary files /dev/null and b/Tank game - Client/out/production/Gruppe-306-PCSS/test5.class differ
diff --git a/Tank game - Client/out/production/Tank game - Client/Collision.class b/Tank game - Client/out/production/Tank game - Client/Collision.class
new file mode 100644
index 00000000..2bdf3c6a
Binary files /dev/null and b/Tank game - Client/out/production/Tank game - Client/Collision.class differ
diff --git a/Tank game - Client/out/production/Tank game - Client/Game$1.class b/Tank game - Client/out/production/Tank game - Client/Game$1.class
new file mode 100644
index 00000000..1c0dee1d
Binary files /dev/null and b/Tank game - Client/out/production/Tank game - Client/Game$1.class differ
diff --git a/Tank game - Client/out/production/Tank game - Client/Game$2.class b/Tank game - Client/out/production/Tank game - Client/Game$2.class
new file mode 100644
index 00000000..8cc0c26b
Binary files /dev/null and b/Tank game - Client/out/production/Tank game - Client/Game$2.class differ
diff --git a/Tank game - Client/out/production/Tank game - Client/Game.class b/Tank game - Client/out/production/Tank game - Client/Game.class
new file mode 100644
index 00000000..66d9ff44
Binary files /dev/null and b/Tank game - Client/out/production/Tank game - Client/Game.class differ
diff --git a/Tank game - Client/out/production/Tank game - Client/META-INF/Tank game - Client.kotlin_module b/Tank game - Client/out/production/Tank game - Client/META-INF/Tank game - Client.kotlin_module
new file mode 100644
index 00000000..a49347af
Binary files /dev/null and b/Tank game - Client/out/production/Tank game - Client/META-INF/Tank game - Client.kotlin_module differ
diff --git a/Tank game - Client/out/production/Tank game - Client/Map.class b/Tank game - Client/out/production/Tank game - Client/Map.class
new file mode 100644
index 00000000..5307ff9f
Binary files /dev/null and b/Tank game - Client/out/production/Tank game - Client/Map.class differ
diff --git a/Tank game - Client/out/production/Tank game - Client/Projectile.class b/Tank game - Client/out/production/Tank game - Client/Projectile.class
new file mode 100644
index 00000000..e78a5517
Binary files /dev/null and b/Tank game - Client/out/production/Tank game - Client/Projectile.class differ
diff --git a/Tank game - Client/out/production/Tank game - Client/TODO list b/Tank game - Client/out/production/Tank game - Client/TODO list
new file mode 100644
index 00000000..ee35aec3
--- /dev/null
+++ b/Tank game - Client/out/production/Tank game - Client/TODO list
@@ -0,0 +1,23 @@
+Fjern bullets
+DONE> efter timer
+DONE> efter ramt tank
+
+Lav colission
+> tank --> væg
+> tank --> tank
+> bullet --> tank
+
+Map
+
+Lobby
+
+Scoreboard
+
+End game screen
+
+List af ting vi skal sende til serveren
+
+Liste vi skal bruge fra serveren
+> array med tanks
+> tank ID
+
diff --git a/Tank game - Client/out/production/Tank game - Client/Tank.class b/Tank game - Client/out/production/Tank game - Client/Tank.class
new file mode 100644
index 00000000..3b66c52f
Binary files /dev/null and b/Tank game - Client/out/production/Tank game - Client/Tank.class differ
diff --git a/Tank game - Client/out/production/Tank game - Client/update b/Tank game - Client/out/production/Tank game - Client/update
new file mode 100644
index 00000000..578abd17
--- /dev/null
+++ b/Tank game - Client/out/production/Tank game - Client/update
@@ -0,0 +1,29 @@
+ private void update() {
+ sprites().forEach(s -> { //handles what happens to the sprites/bullets
+ switch (s.type) {
+ /*case "enemybullet":
+ if (s.getBoundsInParent().intersects(player.getBoundsInParent())) {
+ player.dead = true;
+ s.dead = true;
+ }
+ break;
+ */
+
+ case "playerbullet":
+ final int angle = player.getAngle();
+ s.moveBullet(angle);
+ sprites().stream().filter(e -> e.type.equals("enemy")).forEach(enemy -> {
+ if (s.getBoundsInParent().intersects(enemy.getBoundsInParent())) {
+ enemy.dead = true;
+ s.dead = true;
+ }
+ });
+ break;
+ }
+ });
+
+ root.getChildren().removeIf(n -> {
+ Sprite s = (Sprite) n;
+ return s.dead;
+ });
+ }
\ No newline at end of file
diff --git a/Tank game - Client/src/Collision.java b/Tank game - Client/src/Collision.java
new file mode 100644
index 00000000..b5606e75
--- /dev/null
+++ b/Tank game - Client/src/Collision.java
@@ -0,0 +1,5 @@
+public class Collision {
+
+
+
+}
diff --git a/Tank game - Client/src/Game.java b/Tank game - Client/src/Game.java
new file mode 100644
index 00000000..8c2fbba7
--- /dev/null
+++ b/Tank game - Client/src/Game.java
@@ -0,0 +1,146 @@
+import javafx.animation.AnimationTimer;
+import javafx.application.Application;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.scene.layout.Pane;
+import javafx.scene.paint.Color;
+import javafx.stage.Stage;
+
+
+public class Game extends Application {
+
+ Projectile[] projectiles;
+
+ //movement booleans
+ boolean left = false;
+ boolean right = false;
+ boolean forward = false;
+ boolean backward = false;
+
+
+ private Pane root = new Pane(); //initializes a Pane called root
+
+ //size of the window
+ int width = 1200;
+ int height = 700;
+
+
+ private Tank player = new Tank(300, 300, 70, 40, "1", Color.BLUE);
+ private Tank player2 = new Tank(100,100,70,40, "2", Color.BISQUE);
+ Tank[] tanks = {player, player2};//puts the tanks into an array
+
+ private Map map = new Map(width/2, height/2);
+
+
+ private Parent createContent() { //creates the "draw" function - creates a Parent and returns it
+ root.setPrefSize(width, height); //sets width and height of window
+ root.getChildren().add(player); //adds tank as a child
+ root.getChildren().add(player2);
+ root.getChildren().add(map);
+
+
+ AnimationTimer timer = new AnimationTimer() { //everything in this is called each frame
+ @Override
+ public void handle(long now) {
+ update();
+ }
+ };
+ timer.start(); //starts the animationtimer
+ return root; //returns the root
+ }
+
+ public void update() {//function where everything that happens every frame is called
+
+
+ //moves ALL bullets on the map
+ for (int i = 0; i < projectiles.length; i++) {
+ if (projectiles[i] != null) { //only does this function if there are bullets in the array
+ projectiles[i].moveBullet(map);//moves bullets
+
+ //removes a tank if hit
+ if(projectiles[i].collision(tanks) != null){//only does this if there is a hit tank
+ root.getChildren().remove(projectiles[i].collision(tanks));//removes the tank visually
+ root.getChildren().remove(projectiles[i]);//removes the bullet visually
+ projectiles[i] = null;//removes the bullets from the array
+ }
+ }
+ }
+
+ //checks the lifespan and removes bullet if it is over a threshold
+ int threshold = 300; //threshold - the bullets are removed after 300 frames
+ for (int i = 0; i < projectiles.length; i++) {
+ if (projectiles[i] != null && projectiles[i].getLifespan() >= threshold) { //only does this if there are bullets on the map and if one have been alive for 300 frames
+ root.getChildren().remove(projectiles[i]); //removes the projectile child
+ projectiles[i] = null; //removes projectile from array.
+ }
+ }
+
+ if (left) { //moves if the boolean is true, this is smoother than having the move in the start function
+ player.rotateLeft();
+ }
+ if (right) {
+ player.rotateRight();
+ }
+ if (forward) {
+ player.moveForward();
+ }
+ if (backward) {
+ player.moveBackward();
+ }
+ }
+
+ public void start(Stage stage) throws Exception {
+ Scene scene = new Scene(createContent()); //creates a scene with the root createContent as input
+ projectiles = player.getProjectiles(); //initializes the projectile array
+
+ //sets booleans to false if key is released
+ scene.setOnKeyReleased(e -> {
+ switch (e.getCode()) {
+ case LEFT:
+ left = false;
+ break;
+ case RIGHT:
+ right = false;
+ break;
+ case UP:
+ forward = false;
+ break;
+ case DOWN:
+ backward = false;
+ break;
+ }
+ });
+
+ //sets booleans to true if key is pressed
+ scene.setOnKeyPressed(e -> {
+ switch (e.getCode()) {
+ case LEFT:
+ left = true;
+ break;
+ case RIGHT:
+ right = true;
+ break;
+ case UP:
+ forward = true;
+ break;
+ case DOWN:
+ backward = true;
+ break;
+ case SPACE:
+ Projectile p = player.shoot();
+ projectiles = player.getProjectiles();
+ if (p != null) {
+ root.getChildren().add(p);
+ }
+ break;
+ }
+ });
+ stage.setScene(scene);//creates a stage using the scene that uses the root
+ stage.show();
+ }
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/Tank game - Client/src/Map.java b/Tank game - Client/src/Map.java
new file mode 100644
index 00000000..1280f48f
--- /dev/null
+++ b/Tank game - Client/src/Map.java
@@ -0,0 +1,20 @@
+import javafx.scene.paint.Color;
+import javafx.scene.shape.Rectangle;
+
+public class Map extends Rectangle {
+ //final static Color color = Color.GRAY;
+ final static int width = 100;
+ final static int height = 100;
+
+
+
+ Map(int x, int y){
+ super();
+ setHeight(height);
+ setWidth(width);
+ setTranslateX(x);
+ setTranslateY(y);
+ }
+
+}
+
diff --git a/Tank game - Client/src/Projectile.java b/Tank game - Client/src/Projectile.java
new file mode 100644
index 00000000..1182af63
--- /dev/null
+++ b/Tank game - Client/src/Projectile.java
@@ -0,0 +1,58 @@
+import javafx.scene.paint.Color;
+import javafx.scene.shape.Circle;
+
+public class Projectile extends Circle {
+
+ final static int MAX_SPEED = 5;
+ static final int RADIUS = 5;
+
+ private Tank player;
+
+ private double xSpeed;
+ private double ySpeed;
+ public boolean dead = false;
+ int angle;
+ double angleR;
+ int lifespan;
+
+ Projectile(float x, float y, Tank tank) {
+ super(x, y, RADIUS); //bruger constructor fra Rectangle som er superclass
+ setFill(Color.HOTPINK);
+ this.angle = tank.getAngle(); //henter den vinkel tanken har
+ this.angleR = Math.toRadians(angle); //laver vinklen til radianer
+ //this.player = tank; //gemmer hvilken tank der har affyret
+ setSpeed(); //kalder metoden set speed og gemmer en x og y speed
+ }
+
+ void setSpeed() {
+ //sets x and y speed according the the tanks angle in radians
+ this.xSpeed = MAX_SPEED * Math.cos(angleR);
+ this.ySpeed = MAX_SPEED * Math.sin(angleR);
+ }
+
+ void moveBullet(Map map) {
+ this.setCenterX(getCenterX() + xSpeed); //affyrer skud med dens vinkel fra setSpeed
+ this.setCenterY(getCenterY() + ySpeed);
+ if (this.getCenterX() > map.getTranslateX() && this.getCenterX() < map.getTranslateX() + map.getWidth() && this.getCenterY() < map.getTranslateY() && this.getCenterY() < map.getTranslateY() + map.getHeight() && this.getBoundsInParent().intersects(map.getBoundsInParent())) {
+ ySpeed = -ySpeed; //inverter hastigheden hvis en top eller bund væg rammes
+ } else if (this.getBoundsInParent().intersects(map.getBoundsInParent())) {
+ xSpeed = -xSpeed; //inverter speed hvis sidevæg rammes
+ }
+ lifespan++; //incrementer lifespan hver frame
+ }
+
+
+ Tank collision(Tank[] tank){ //method that returns a tank that has been hit
+ for (int i = 0; i < tank.length; i++) {
+ if (this.getBoundsInParent().intersects(tank[i].getBoundsInParent())) {
+ //lifespan = 300;
+ return tank[i];
+ }
+ }
+ return null;
+ }
+
+ public int getLifespan() {
+ return lifespan;
+ }
+}
diff --git a/Tank game - Client/src/TODO list b/Tank game - Client/src/TODO list
new file mode 100644
index 00000000..ee35aec3
--- /dev/null
+++ b/Tank game - Client/src/TODO list
@@ -0,0 +1,23 @@
+Fjern bullets
+DONE> efter timer
+DONE> efter ramt tank
+
+Lav colission
+> tank --> væg
+> tank --> tank
+> bullet --> tank
+
+Map
+
+Lobby
+
+Scoreboard
+
+End game screen
+
+List af ting vi skal sende til serveren
+
+Liste vi skal bruge fra serveren
+> array med tanks
+> tank ID
+
diff --git a/Tank game - Client/src/Tank.java b/Tank game - Client/src/Tank.java
new file mode 100644
index 00000000..463442f2
--- /dev/null
+++ b/Tank game - Client/src/Tank.java
@@ -0,0 +1,84 @@
+import javafx.scene.paint.Color;
+import javafx.scene.shape.Rectangle;
+import javafx.scene.transform.Rotate;
+
+public class Tank extends Rectangle {
+ boolean dead = false; //is not used for anything YET
+ private int angle = 0; //variable that stores the tanks angle
+ private int angleIncrease = 3;
+ private int moveSpeed = 5;
+ final static int MAX_PROJECTILES = 10; //max amount of projectiles a player can have at the same time
+ private Projectile[] projectiles = new Projectile[MAX_PROJECTILES]; //array with the tanks projectiles
+ final String playerID; //either bullet or player-- IS NOT UTILISED YET
+
+ Tank(int x, int y, int w, int h, String playerID, Color color) { //constructor
+ super(w, h, color);
+ this.playerID = playerID;
+ setTranslateX(x);
+ setTranslateY(y);
+ }
+
+ public Projectile[] getProjectiles() {
+ return projectiles; //returns the tanks array of projectiles
+ }
+
+ void setDead(){
+ dead = true;
+ }
+
+ Projectile shoot() { //shoot method, returns a projectile array or null
+ for(int i = 0; i < projectiles.length; i++){
+ if(projectiles[i] == null){ //let's the player shoot if there is an empty space in the array aka. there are less than 10 bullets on the map
+ int k = 70; //offset value
+
+ //x and y for the center of the tank
+ float centerX = (float)this.getTranslateX()+(float)this.getWidth()/2; //center of tank
+ float centerY = (float)this.getTranslateY()+(float)this.getHeight()/2;
+
+ //cos and sin for the tanks angle
+ float cos = (float)Math.cos(Math.toRadians(getAngle()*-1));
+ float sin = (float)Math.sin(Math.toRadians(getAngle()*-1));
+
+ //cos and sin multiplied with a constant, calculating the x and y offset
+ float widthOffset = cos*k;
+ float heightOffset = sin*k;
+
+ //start coordinates for x and y
+ float x = centerX+widthOffset;
+ float y = centerY-heightOffset;
+
+ Projectile p = new Projectile(x,y, this); //creates a new projectile
+ projectiles[i] = p; //puts the bullets in the bullet array
+ return projectiles[i]; //returns the array, now with bullets in it
+ }
+ }
+ return null;
+ }
+
+
+ void rotateLeft() { //function for rotating a sprite left, pivoting around its middle
+ getTransforms().add(new Rotate(-angleIncrease, getX() + getWidth() / 2, getY() + getHeight() / 2));
+ angle += -angleIncrease;
+ }
+
+ void rotateRight() { //function for rotating a sprite right, pivoting around its middle
+ getTransforms().add(new Rotate(+angleIncrease, getX() + getWidth() / 2, getY() + getHeight() / 2));
+ angle += angleIncrease;
+ }
+
+ void moveForward() {
+ double angleR = Math.toRadians(angle);
+ setTranslateX(getTranslateX() + moveSpeed * Math.cos(angleR));
+ setTranslateY(getTranslateY() + moveSpeed * Math.sin(angleR));
+ }
+
+ void moveBackward() {
+ double angleR = Math.toRadians(angle);
+ setTranslateX(getTranslateX() - moveSpeed * Math.cos(angleR));
+ setTranslateY(getTranslateY() - moveSpeed * Math.sin(angleR));
+ }
+
+ public int getAngle() {
+ return angle;
+ }
+}
diff --git a/Tank game - Client/src/test5.java b/Tank game - Client/src/test5.java
new file mode 100644
index 00000000..42e523de
--- /dev/null
+++ b/Tank game - Client/src/test5.java
@@ -0,0 +1,109 @@
+import javafx.animation.AnimationTimer;
+import javafx.application.Application;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.scene.layout.Pane;
+import javafx.scene.paint.Color;
+import javafx.stage.Stage;
+
+import java.util.List;
+import java.util.stream.Collectors;
+/*
+public class test5 extends Application {
+ private Pane root = new Pane();
+ int width = 1200;
+ int height = 700;
+
+ private Tank player = new Tank(300, 300, 70, 40, "player", Color.BLUE);
+
+
+ private Parent createContent() {
+ root.setPrefSize(width, height);
+ root.getChildren().add(player);
+
+
+ AnimationTimer timer = new AnimationTimer() {
+ @Override
+ public void handle(long now) {
+ update();
+ }
+ };
+ timer.start();
+ //nextLevel(); //initiater enemies - skal slette
+ return root;
+ }
+
+ /* private void nextLevel() { //laver de røde enemies - skal slettes senere
+ for (int i = 0; i < 10; i++) {
+ Sprite s = new Sprite(90 + i * 100, 150, 30, 30, "enemy", Color.RED);
+ root.getChildren().add(s);
+ }
+ }
+
+ */
+
+ /* private List projectiles() { //funktion der returner en liste
+ System.out.println(root.getChildren().stream().map(n -> (Projectile) n).collect(Collectors.toList()));
+ return root.getChildren().stream().map(n -> (Projectile) n).collect(Collectors.toList());
+ }
+
+ */
+
+ /* private void update() {
+ projectiles().forEach(p -> { //handles what happens to the sprites/bullets
+ final int angle = player.getAngle();
+ p.moveBullet();
+ if (p.getBoundsInParent().intersects(player.getBoundsInParent())) {
+ player.dead = true;
+ p.dead = true;
+ }
+ });
+
+
+
+ root.getChildren().removeIf(n -> {
+ Projectile p = (Projectile) n;
+ return p.dead;
+ });
+ }
+
+ private void shoot(Tank who) { //shoot function, creates sprites from shooting player
+ int bulletW = 5; //bullet width
+ int bulletH = 5; //bullet height
+ Projectile p = new Projectile((int) who.getTranslateX() + (int) who.getWidth() / 2, (int) who.getTranslateY() + (int) who.getHeight() / 2, who);
+ //Sprite s = new Sprite((int) who.getTranslateX() + (int) who.getWidth() / 2, (int) who.getTranslateY() + (int) who.getHeight() / 2, bulletW, bulletH, who.type + "bullet", Color.BLACK);
+ //root.getChildren().add(s);
+ root.getChildren().add(p);
+ }
+
+ public void start(Stage stage) throws Exception {
+ Scene scene = new Scene(createContent());
+
+ scene.setOnKeyPressed(e -> { //movement switch case
+ switch (e.getCode()) {
+ case LEFT:
+ player.rotateLeft();
+ break;
+ case RIGHT:
+ player.rotateRight();
+ break;
+ case UP:
+ player.moveForward();
+ break;
+ case DOWN:
+ player.moveBackward();
+ break;
+ case SPACE:
+ shoot(player);
+ }
+ });
+ stage.setScene(scene);
+ stage.show();
+ }
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
+
+*/
\ No newline at end of file
diff --git a/Tank game - Client/src/update b/Tank game - Client/src/update
new file mode 100644
index 00000000..578abd17
--- /dev/null
+++ b/Tank game - Client/src/update
@@ -0,0 +1,29 @@
+ private void update() {
+ sprites().forEach(s -> { //handles what happens to the sprites/bullets
+ switch (s.type) {
+ /*case "enemybullet":
+ if (s.getBoundsInParent().intersects(player.getBoundsInParent())) {
+ player.dead = true;
+ s.dead = true;
+ }
+ break;
+ */
+
+ case "playerbullet":
+ final int angle = player.getAngle();
+ s.moveBullet(angle);
+ sprites().stream().filter(e -> e.type.equals("enemy")).forEach(enemy -> {
+ if (s.getBoundsInParent().intersects(enemy.getBoundsInParent())) {
+ enemy.dead = true;
+ s.dead = true;
+ }
+ });
+ break;
+ }
+ });
+
+ root.getChildren().removeIf(n -> {
+ Sprite s = (Sprite) n;
+ return s.dead;
+ });
+ }
\ No newline at end of file