diff --git a/src/App/Bomb/Bomb.java b/src/App/Bomb/Bomb.java index 26e17429c9775562561c9025c605ce4a9c807fc8..8b1d401f6579eac42d762f65a9180d7d73800493 100644 --- a/src/App/Bomb/Bomb.java +++ b/src/App/Bomb/Bomb.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import App.*; import App.Block.ImbreakableBlock; import App.Block.OneLifeBlock; +import App.Player.Player; // La classe Bomb représente une bombe public class Bomb{ diff --git a/src/App/Display/PlayerDisplay.java b/src/App/Display/PlayerDisplay.java index 10a66add5d2a7ba30c51aa1e65bbad3886287d5b..4650cdb3e9aa78d747cd13ff80d1913567fa75ec 100644 --- a/src/App/Display/PlayerDisplay.java +++ b/src/App/Display/PlayerDisplay.java @@ -1,5 +1,7 @@ package App.Display; -import App.*; +import App.Player.GhostPlayer; +import App.Player.Player; + import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; diff --git a/src/App/Display/TextDisplay.java b/src/App/Display/TextDisplay.java new file mode 100644 index 0000000000000000000000000000000000000000..f3672bc7c9c33da3dfdfd858e5de57bc1b6a44bd --- /dev/null +++ b/src/App/Display/TextDisplay.java @@ -0,0 +1,26 @@ +package App.Display; +import java.awt.Font; +import java.awt.Color; +import java.awt.Graphics; + +public class TextDisplay { + private String text; + private int size; + private int x; + private int y; + private Graphics g; + + public TextDisplay(String text, int size, int x, int y, Graphics g){ + this.text = text; + this.size = size; + this.x = x; + this.y = y; + this.g = g; + } + + public void draw(){ + g.setFont(new Font("TimesRoman", Font.PLAIN, size)); + g.setColor(Color.white); + g.drawString(text, x, y); + } +} diff --git a/src/App/Fire.java b/src/App/Fire.java index e3cddb389ccfeaf5f01c72f6413bacc2f2bc211a..fb5f075b768ae7b3df8a57753da5681907c038d8 100644 --- a/src/App/Fire.java +++ b/src/App/Fire.java @@ -2,6 +2,8 @@ package App; import java.util.ArrayList; +import App.Player.Player; + /** * La classe Fire représente une explosion (feu) dans le jeu Bomberman. * Elle est définie par ses coordonnées (i, j) sur la grille du terrain et sa puissance. diff --git a/src/App/GamePanel.java b/src/App/GamePanel.java index f34f74063482dc7b00d953213a61ffca9a225974..8fd1167bfc3d97e9925cedf15bc0059654c22011 100644 --- a/src/App/GamePanel.java +++ b/src/App/GamePanel.java @@ -18,7 +18,7 @@ public class GamePanel extends JPanel implements Runnable{ final int originalTileSize = 16; //16x16 tile final int scale = 4; final int tileSize = originalTileSize * scale; // 48x48 tile - final int maxScreenCol = 16; + final int maxScreenCol = 17; final int maxScreenRow = 12; final int screenWidth = tileSize * maxScreenCol; // 1024 pixels final int screenHeight = tileSize * maxScreenRow; // 768 pixels @@ -219,5 +219,43 @@ public class GamePanel extends JPanel implements Runnable{ PlayerDisplay p2 = new PlayerDisplay(game.getPlayerFromList(1), g); p1.draw(); p2.draw(); + + // Text Player1 + TextDisplay p1_t = new TextDisplay("Player1 (red):", 25, game.getnbX() * 60, 60, g); + p1_t.draw(); + + String text = "Speed = " + game.getPlayerFromList(0).getSpeed(); + + TextDisplay p1_speed_t = new TextDisplay(text, 25, game.getnbX() * 60, 60 * 2, g); + p1_speed_t.draw(); + + text = "Firepower = " + game.getPlayerFromList(0).getFirePower(); + + TextDisplay p1_firep_t = new TextDisplay(text, 25, game.getnbX() * 60, 60 * 3, g); + p1_firep_t.draw(); + + text = "BombLimit = " + game.getPlayerFromList(0).getBombLimit(); + + TextDisplay p1_bombl_t = new TextDisplay(text, 25, game.getnbX() * 60, 60 * 4, g); + p1_bombl_t.draw(); + + // Text Player2 + TextDisplay p2_t = new TextDisplay("Player2 (blue):", 25, game.getnbX() * 60, 60 * 6, g); + p2_t.draw(); + + text = "Speed = " + game.getPlayerFromList(1).getSpeed(); + + TextDisplay p2_speed_t = new TextDisplay(text, 25, game.getnbX() * 60, 60 * 7, g); + p2_speed_t.draw(); + + text = "Firepower = " + game.getPlayerFromList(1).getFirePower(); + + TextDisplay p2_firep_t = new TextDisplay(text, 25, game.getnbX() * 60, 60 * 8, g); + p2_firep_t.draw(); + + text = "BombLimit = " + game.getPlayerFromList(1).getBombLimit(); + + TextDisplay p2_bombl_t = new TextDisplay(text, 25, game.getnbX() * 60, 60 * 9, g); + p2_bombl_t.draw(); } } diff --git a/src/App/Ground.java b/src/App/Ground.java index b4171187e6d38cc03e9f2ee58ac76e15fc0c4cdf..f616284896234ce82977a58916f7ad8b1d814480 100644 --- a/src/App/Ground.java +++ b/src/App/Ground.java @@ -2,6 +2,9 @@ package App; import App.Block.*; import App.Bomb.*; import App.Item.*; +import App.Player.GhostPlayer; +import App.Player.Player; + import java.util.*; /** diff --git a/src/App/Item/Bag.java b/src/App/Item/Bag.java index a13f4ead2af594daf98025b2872fe6b97e7cc247..bed83f00fe481cc32d2199efe7620b7254113933 100644 --- a/src/App/Item/Bag.java +++ b/src/App/Item/Bag.java @@ -1,6 +1,6 @@ package App.Item; -import App.Player; +import App.Player.Player; public class Bag extends Item { diff --git a/src/App/Item/Boot.java b/src/App/Item/Boot.java index 4fd1144c8e0ffef4831ef59448f6b4bb7d599cd2..ee1d92e5771cd491f239992168dc164a2d392379 100644 --- a/src/App/Item/Boot.java +++ b/src/App/Item/Boot.java @@ -1,6 +1,6 @@ package App.Item; -import App.Player; +import App.Player.Player; // La classe Boot hérite de la classe abstraite Item public class Boot extends Item { diff --git a/src/App/Item/Item.java b/src/App/Item/Item.java index 139bc2b99937018ca499ab2638cb966b2c570004..7c9c4db3011f176da66b86fa060b73173433fe79 100644 --- a/src/App/Item/Item.java +++ b/src/App/Item/Item.java @@ -1,5 +1,5 @@ package App.Item; -import App.*; +import App.Player.Player; // La classe abstraite Item représente tous les types d'Item sur le terrain public abstract class Item { diff --git a/src/App/Item/Power.java b/src/App/Item/Power.java index 8534fa714c442373979e3cc557576b1c35f71424..d9c58f16fbd7f57cc08b9260157911bd6f003be3 100644 --- a/src/App/Item/Power.java +++ b/src/App/Item/Power.java @@ -1,6 +1,6 @@ package App.Item; -import App.Player; +import App.Player.Player; // La classe Power hérite de la classe abstraite Item public class Power extends Item { diff --git a/src/App/Item/Shield.java b/src/App/Item/Shield.java index f3b1b00274ae94fef07a8b5ff870de521d571487..f7f3e11e1660c621ba94b74a679f9b79fa56824b 100644 --- a/src/App/Item/Shield.java +++ b/src/App/Item/Shield.java @@ -1,6 +1,6 @@ package App.Item; -import App.Player; +import App.Player.Player; // La classe Boot hérite de la classe abstraite Item public class Shield extends Item { diff --git a/src/App/GhostPlayer.java b/src/App/Player/GhostPlayer.java similarity index 86% rename from src/App/GhostPlayer.java rename to src/App/Player/GhostPlayer.java index c6b3df039fb5dc103b6ce0d8ccc78135b4c82750..fabc27466b83c62fbb30a4cfd6cadf0cdacf18be 100644 --- a/src/App/GhostPlayer.java +++ b/src/App/Player/GhostPlayer.java @@ -1,5 +1,6 @@ -package App; +package App.Player; +import App.Ground; import App.Bomb.Bomb; public class GhostPlayer extends Player { diff --git a/src/App/Player.java b/src/App/Player/Player.java similarity index 99% rename from src/App/Player.java rename to src/App/Player/Player.java index 49551087491419b4c1838dd7ed0eeddc47c0ea01..726486934e1d4690043f7e7b1036241f297567d5 100644 --- a/src/App/Player.java +++ b/src/App/Player/Player.java @@ -1,4 +1,5 @@ -package App; +package App.Player; +import App.Ground; import App.Bomb.*; /**