jancoow 10 жил өмнө
parent
commit
34e4965065

+ 2 - 4
server/server/LevelReader.java

@@ -32,7 +32,7 @@ public class LevelReader {
 	
 	
 	private static Level readLevel(List<String> levelfile) throws NumberFormatException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException{
 	private static Level readLevel(List<String> levelfile) throws NumberFormatException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException{
 		Level level = new Level();
 		Level level = new Level();
-		if(levelfile.size() == 3){
+		if(levelfile.size() == 2){
 			String[] ballsstrings = levelfile.get(0).split("\\|"); //split all the balls
 			String[] ballsstrings = levelfile.get(0).split("\\|"); //split all the balls
 			for(String ball:ballsstrings){
 			for(String ball:ballsstrings){
 				String[]ballstring = ball.split(",");
 				String[]ballstring = ball.split(",");
@@ -50,9 +50,7 @@ public class LevelReader {
 				}
 				}
 			}
 			}
 			
 			
-			String[] powerupsstring = levelfile.get(1).split("\\|");
-			
-			level.setTime(Integer.parseInt(levelfile.get(2)));
+			level.setTime(Integer.parseInt(levelfile.get(1)));
 		}
 		}
 		return level;
 		return level;
 	}
 	}

+ 2 - 2
server/server/match/Match.java

@@ -157,8 +157,8 @@ public class Match implements Runnable {
 	
 	
 		
 		
 		//Sending the new information to the players
 		//Sending the new information to the players
-		String playerinfo = "2|"+player1.getX()+"|"+player1.getY()+"|"+player1.getHealth()+"|"+player1.getSpeed()+"|"+player1.getScore()+"|"+	
-							player2.getX()+"|"+player2.getY()+"|"+player2.getHealth()+"|"+player2.getSpeed()+"|"+player2.getScore();
+		String playerinfo = "2|"+player1.getX()+"|"+player1.getY()+"|"+player1.getHealth()+"|"+player1.getScore()+"|"+	
+							player2.getX()+"|"+player2.getY()+"|"+player2.getHealth()+"|"+player2.getScore();
 		
 		
 		String ballsinfo =",";
 		String ballsinfo =",";
 		for(Ball b:balls){
 		for(Ball b:balls){

+ 0 - 11
server/server/match/levels/Level.java

@@ -4,26 +4,19 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 import server.match.objects.Ball;
 import server.match.objects.Ball;
-import server.match.objects.PowerUp;
 
 
 public class Level {
 public class Level {
 	private List<Ball> startballs;
 	private List<Ball> startballs;
-	private List<PowerUp> powerups;
 	private int time;
 	private int time;
 	
 	
 	public Level(){
 	public Level(){
 		this.startballs = new ArrayList<Ball>();
 		this.startballs = new ArrayList<Ball>();
-		this.powerups = new ArrayList<PowerUp>();
 	}
 	}
 	
 	
 	public void addBall(Ball b){
 	public void addBall(Ball b){
 		startballs.add(b);
 		startballs.add(b);
 	}
 	}
 	
 	
-	public void addPowerUp(PowerUp p){
-		powerups.add(p);
-	}
-	
 	public void setTime(int t){
 	public void setTime(int t){
 		time = t;
 		time = t;
 	}
 	}
@@ -32,10 +25,6 @@ public class Level {
 		return startballs;
 		return startballs;
 	}
 	}
 
 
-	public List<PowerUp> getPowerups() {
-		return powerups;
-	}
-
 	public int getTime() {
 	public int getTime() {
 		return time;
 		return time;
 	}
 	}

+ 0 - 1
server/server/match/levels/level1.bb

@@ -1,3 +1,2 @@
 2,200,red,200,400,-1,0.0
 2,200,red,200,400,-1,0.0
-speed
 18000
 18000

+ 0 - 1
server/server/match/levels/level2.bb

@@ -1,3 +1,2 @@
 2,200,green,200,200,-1,0.0|3,300,magenta,500,200,1,0.0
 2,200,green,200,200,-1,0.0|3,300,magenta,500,200,1,0.0
-speed|life
 30000
 30000

+ 0 - 7
server/server/match/objects/Player.java

@@ -10,7 +10,6 @@ import main.Window;
 public class Player extends DrawObject {
 public class Player extends DrawObject {
 
 
 	private int score, health, speed = 10;
 	private int score, health, speed = 10;
-	private ArrayList<PowerUp> powerups;
 	private Double beginlocation;
 	private Double beginlocation;
 	
 	
 	public Player(BufferedImage image, int x, int y) {
 	public Player(BufferedImage image, int x, int y) {
@@ -18,7 +17,6 @@ public class Player extends DrawObject {
 		super.setPosition(x, y);
 		super.setPosition(x, y);
 		beginlocation = new Point2D.Double(x,y);
 		beginlocation = new Point2D.Double(x,y);
 		health = 5;
 		health = 5;
-		powerups = new ArrayList<PowerUp>();
 	}
 	}
 	
 	
 	public void walkLeft(){
 	public void walkLeft(){
@@ -55,9 +53,4 @@ public class Player extends DrawObject {
 	public void setHealth(int health){
 	public void setHealth(int health){
 		this.health = health;
 		this.health = health;
 	}
 	}
-
-	public int getSpeed() {
-		return speed; 
-	}
-	
 }
 }

+ 0 - 11
server/server/match/objects/PowerUp.java

@@ -1,11 +0,0 @@
-package server.match.objects;
-
-import java.awt.image.BufferedImage;
-
-public class PowerUp extends DrawObject {
-	
-	public PowerUp(BufferedImage image) {
-		super(image);
-	}
-
-}

+ 2 - 2
src/model/NetworkConnection.java

@@ -65,8 +65,8 @@ public class NetworkConnection {
 					messagesplit = message.split(",");
 					messagesplit = message.split(",");
 					
 					
 					String[] playersplit = messagesplit[0].split("\\|");
 					String[] playersplit = messagesplit[0].split("\\|");
-					play.updatePlayerInfo(Integer.parseInt(playersplit[1]), Integer.parseInt(playersplit[2]), Integer.parseInt(playersplit[3]), Integer.parseInt(playersplit[4]), Integer.parseInt(playersplit[5]), play.getPlayer1());
-					play.updatePlayerInfo(Integer.parseInt(playersplit[6]), Integer.parseInt(playersplit[7]), Integer.parseInt(playersplit[8]), Integer.parseInt(playersplit[9]), Integer.parseInt(playersplit[10]), play.getPlayer2());
+					play.updatePlayerInfo(Integer.parseInt(playersplit[1]), Integer.parseInt(playersplit[2]), Integer.parseInt(playersplit[3]), Integer.parseInt(playersplit[4]), play.getPlayer1());
+					play.updatePlayerInfo(Integer.parseInt(playersplit[5]), Integer.parseInt(playersplit[6]), Integer.parseInt(playersplit[7]), Integer.parseInt(playersplit[8]), play.getPlayer2());
 					
 					
 					String[] ballsplit = messagesplit[1].split("\\|");
 					String[] ballsplit = messagesplit[1].split("\\|");
 					if(ballsplit.length/4 != play.getBalls().size()){
 					if(ballsplit.length/4 != play.getBalls().size()){

+ 0 - 10
src/model/objects/Player.java

@@ -11,7 +11,6 @@ import main.Window;
 public class Player extends DrawObject {
 public class Player extends DrawObject {
 
 
 	private int score, health, speed = 10;
 	private int score, health, speed = 10;
-	private ArrayList<PowerUp> powerups;
 	
 	
 	private long lastMovement;
 	private long lastMovement;
 	private int lastDirection, frame;
 	private int lastDirection, frame;
@@ -25,7 +24,6 @@ public class Player extends DrawObject {
 		beginlocation = new Point2D.Double(x,y);
 		beginlocation = new Point2D.Double(x,y);
 		this.name = name;
 		this.name = name;
 		spriteimage = image;
 		spriteimage = image;
-		powerups = new ArrayList<PowerUp>();
 	}
 	}
 	
 	
 	public void update(){
 	public void update(){
@@ -75,12 +73,4 @@ public class Player extends DrawObject {
 			lastMovement = System.currentTimeMillis();
 			lastMovement = System.currentTimeMillis();
 		super.setX(x);
 		super.setX(x);
 	}
 	}
-		
-	public int getSpeed() {
-		return speed;
-	}
-	
-	public void setSpeed(int speed){
-		this.speed = speed;
-	}
 }
 }

+ 0 - 11
src/model/objects/PowerUp.java

@@ -1,11 +0,0 @@
-package model.objects;
-
-import java.awt.image.BufferedImage;
-
-public class PowerUp extends DrawObject {
-	
-	public PowerUp(BufferedImage image) {
-		super(image);
-	}
-
-}

+ 3 - 2
src/model/state/PlayState.java

@@ -63,12 +63,13 @@ public class PlayState extends State{
 
 
 	
 	
 	/* UPDATE AND PAINTING*/
 	/* UPDATE AND PAINTING*/
-	public void updatePlayerInfo(int x, int y, int health, int speed, int score, Player player){
+	public void updatePlayerInfo(int x, int y, int health, int score, Player player){
 		player.setX(x);
 		player.setX(x);
 		player.setY(y);
 		player.setY(y);
 		player.setHealth(health);
 		player.setHealth(health);
 		player.setScore(score);
 		player.setScore(score);
 	}
 	}
+	
 	public void updateLines(int l1x, int l1y, int l1h, int l2x, int l2y, int l2h){
 	public void updateLines(int l1x, int l1y, int l1h, int l2x, int l2y, int l2h){
 		if(line1 == null)
 		if(line1 == null)
 			line1 = new ShootingLine(l1x, l1y);
 			line1 = new ShootingLine(l1x, l1y);
@@ -80,7 +81,7 @@ public class PlayState extends State{
 		line2.setLength(l2h);
 		line2.setLength(l2h);
 		line2.setStartx(l2x);
 		line2.setStartx(l2x);
 		line2.setStarty(l2y);
 		line2.setStarty(l2y);
-	};
+	}
 	
 	
 	@Override
 	@Override
 	public void update() {		
 	public void update() {