Commit 6cddf2b0 authored by Prieur Maxime's avatar Prieur Maxime 🎵

Ajout du deuxieme boost augmentant la portée des explosions

parent da7ece93
1 13 17
#################
#p *************#
#p b************#
# #*# #*#*# #*#*#
#b** *** ***#
#f** *** ***#
#*#*# #*# # #*# #
#******* *****#
# #*# #*# #*# #*#
......
......@@ -8,7 +8,7 @@
#p#*#*#*#*#*### #
# b*****#*** r#
# #*# #*#*#*# #*#
#*******#*******#
#f******#*******#
#*# #*#*# #*#*# #
#****** *****#
#################
......
......@@ -7,7 +7,7 @@
#*#*#*#*#*#*#*#*#
#*#*#*#*#*#*#*#*#
#*#*#*#*#*#*#*#*#
#*#*#*#*#*#*#*#*#
#*#*#*#*#*#*#*#f#
# *****b #
############### #
#p #
......
......@@ -121,7 +121,8 @@ public class Board implements IRender {
Player._powerups.clear();
_game.playerSpeed = 3;
_game.bombRadius = 1;
_game.setBombRadius(0,1);
_game.setBombRadius(1,1);
_game.setBombRate(0,1);
_game.setBombRate(1,1);
......
......@@ -48,9 +48,9 @@ public class Game extends Canvas {
//can be modified with bonus
protected static int bombRadius = BOMBRADIUS;
private static int[] bombRadius;
protected static int playerSpeed = PLAYERSPEED;
private static int[] bombRate;
//Time in the level screen in seconds
protected int _screenDelay = SCREENDELAY;
......@@ -61,7 +61,6 @@ public class Game extends Canvas {
private Board _board;
private Screen screen;
private Frame _frame;
private static int[] bombRate;
//this will be used to render the game, each render is a calculated image saved here
private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
private int[] pixels = ((DataBufferInt)image.getRaster().getDataBuffer()).getData();
......@@ -74,6 +73,7 @@ public class Game extends Canvas {
_input = new Keyboard();
_board = new Board(this, _input, screen, this._frame._serverGame, this._frame._playerNum, level);
bombRate = new int[]{1,1};
bombRadius = new int[]{1,1};
addKeyListener(_input);
}
......@@ -193,28 +193,29 @@ public class Game extends Canvas {
bombRate[num] = bombNb;
}
public static void setBombRadius(int num, int bombRad) {
bombRate[num] = bombRad;
}
public static int getBombRate(int num) {
return bombRate[num];
}
public static int getBombRadius() {
return bombRadius;
public static int getBombRadius(int numPlayer) {
return bombRadius[numPlayer];
}
public static void addPlayerSpeed(int i) {
playerSpeed += i;
}
public static void addBombRadius(int i) {
bombRadius += i;
}
public static void addBombRate(int i, int num) {
bombRate[num] += i;
if (i>0)
System.out.println("AU BOMB RATE For player "+num+" = "+bombRate[num]);
}
public static void addBombRadius(int i, int num) {
bombRadius[num] += i;
}
//screen delay
public int getScreenDelay() {
return _screenDelay;
......
......@@ -84,7 +84,7 @@ public class Bomb extends AnimatedEntitiy {
_explosions = new DirectionalExplosion[4];
for (int i = 0; i < _explosions.length; i++) {
_explosions[i] = new DirectionalExplosion(_x, _y, i, Game.getBombRadius(), _board);
_explosions[i] = new DirectionalExplosion(_x, _y, i, Game.getBombRadius(_number), _board);
}
}
......
......@@ -22,6 +22,7 @@ import server.ServerGame;
import server.PlayerPosition;
import bombermandistribue.bomberman.entities.tile.powerup.PowerupBombs;
import bombermandistribue.bomberman.entities.tile.powerup.PowerupFlames;
public class Player extends Mob {
......@@ -282,6 +283,10 @@ public class Player extends Mob {
public void addBombPowerup(PowerupBombs p){
p.setBombValues(_number);
}
public void addFlamePowerup(PowerupFlames p){
p.setFlameValues(_number);
}
public void clearUsedPowerups() {
Powerup p;
......
......@@ -15,7 +15,6 @@ public class PowerupBombs extends Powerup {
public boolean collide(Entity e) {
if(e instanceof Player) {
System.out.println("Player "+((Player) e).getNum()+"Activated the PU.");
((Player) e).addBombPowerup(this);
remove();
return true;
......
......@@ -15,18 +15,21 @@ public class PowerupFlames extends Powerup {
public boolean collide(Entity e) {
if(e instanceof Player) {
((Player) e).addPowerup(this);
((Player) e).addFlamePowerup(this);
remove();
return true;
}
}
return false;
}
public void setFlameValues(int number) {
_active = true;
Game.addBombRadius(1, number);
}
@Override
public void setValues() {
_active = true;
Game.addBombRadius(1);
}
......
......@@ -127,7 +127,7 @@ public class Sprite {
|--------------------------------------------------------------------------
*/
public static Sprite powerup_bombs = new Sprite(50,SpriteSheet.powerup_bombs, 50,50);
public static Sprite powerup_flames = new Sprite(50,SpriteSheet.ground, 50,50);
public static Sprite powerup_flames = new Sprite(50,SpriteSheet.powerup_flames, 50,50);
public static Sprite powerup_speed = new Sprite(50,SpriteSheet.powerup_speed, 50,50);
public static Sprite powerup_wallpass = new Sprite(50,SpriteSheet.ground, 50,50);
public static Sprite powerup_detonator = new Sprite(50,SpriteSheet.ground, 50,50);
......
......@@ -56,6 +56,7 @@ public class SpriteSheet {
public static SpriteSheet powerup_bombs = new SpriteSheet("/textures/bonus/x2.png",50);
public static SpriteSheet powerup_speed = new SpriteSheet("/textures/bonus/speed.png",50);
public static SpriteSheet powerup_flames = new SpriteSheet("/textures/bonus/flame.png",50);
public SpriteSheet(String path, int size) {
_path = path;
SIZE = size;
......
......@@ -22,6 +22,7 @@ public class ServerGameImpl extends UnicastRemoteObject implements ServerGame {
private Boolean runningState = false;
private Thread controlThread;
private Boolean serverIsReset = true;
protected final int gameTime = 210000;
protected ServerGameImpl() throws RemoteException {
this.clientGames = new ArrayList<ClientGame>();
this.runningGames = new ArrayList<Running>();
......@@ -68,9 +69,8 @@ public class ServerGameImpl extends UnicastRemoteObject implements ServerGame {
public void startGame() throws RemoteException {
this.gameRunning = true;
this.controlThread = new Thread(new RunningTimeThread(this, 210000));
this.controlThread = new Thread(new RunningTimeThread(this, this.gameTime));
this.controlThread.start();
}
public int getChosenLevel() throws RemoteException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment