Skip to content
Snippets Groups Projects
Commit ded4dd7b authored by Azurlors's avatar Azurlors
Browse files

Affiche rudimentaire du sol plus mise à jour UML

parent 2f939fd0
No related branches found
No related tags found
No related merge requests found
...@@ -10,22 +10,16 @@ engine.GameController <|-- engine.GameEngineGraphical ...@@ -10,22 +10,16 @@ engine.GameController <|-- engine.GameEngineGraphical
engine.Game <|-- engine.GameEngineGraphical engine.Game <|-- engine.GameEngineGraphical
engine.GamePainter <|-- engine.GameEngineGraphical engine.GamePainter <|-- engine.GameEngineGraphical
engine.GraphicalInterface <|-- engine.GameEngineGraphical engine.GraphicalInterface <|-- engine.GameEngineGraphical
engine.Cmd <|-- jeu.Controller
engine.DrawingPanel <|-- engine.GraphicalInterface engine.DrawingPanel <|-- engine.GraphicalInterface
engine.GamePainter <|-- engine.DrawingPanel engine.GamePainter <|-- engine.DrawingPanel
environment.Coordonnees <|-- entity.Character environment.Coordonnees <|-- entity.Entity
environment.Coordonnees <|-- entity.Monster environment.Coordonnees *-- jeu.Jeu
engine.GamePainter <|.. environment.Obstacle entity.Character *-- jeu.Jeu
interface engine.GameController { interface engine.GameController {
+ Cmd getCommand() + Cmd getCommand()
} }
enum engine.Cmd {
+ LEFT
+ RIGHT
+ JUMP
+ IDLE
}
class engine.GraphicalInterface { class engine.GraphicalInterface {
- DrawingPanel panel - DrawingPanel panel
+ <<Create>> GraphicalInterface(GamePainter,GameController) + <<Create>> GraphicalInterface(GamePainter,GameController)
...@@ -64,10 +58,9 @@ class engine.GameEngineGraphical { ...@@ -64,10 +58,9 @@ class engine.GameEngineGraphical {
+ void run() + void run()
} }
class entity.Character { class entity.Character {
- masse
+ void deplacements() + void deplacements()
+ void attaque() + void attaque()
+ Coordonnees positions
+ int vmax
} }
class entity.Monster{ class entity.Monster{
+ Coordonnees positions + Coordonnees positions
...@@ -88,6 +81,8 @@ entity.Entity <|.. entity.Monster ...@@ -88,6 +81,8 @@ entity.Entity <|.. entity.Monster
class environment.Object { class environment.Object {
} }
class environment.Obstacle{ class environment.Obstacle{
- HashMap<String, Coordonnees> extremites
- int static defaultUnit
} }
class environment.Coordonnees{ class environment.Coordonnees{
- int x - int x
...@@ -105,13 +100,16 @@ class jeu.Painter{ ...@@ -105,13 +100,16 @@ class jeu.Painter{
# {static} int HEIGHT # {static} int HEIGHT
+ <<Create>> Painter() + <<Create>> Painter()
+ void draw(BufferedImage) + void draw(BufferedImage)
- void drawCharacter(Graphics2D)
- void drawSol(Graphics2D)
- void drawObstacle(Graphics2D)
+ int getWidth() + int getWidth()
+ int getHeight() + int getHeight()
} }
class jeu.Controller { class jeu.Controller {
- Cmd commandeEnCours - boolean isRightPressed, isLeftPressed, isSpacePressed
+ <<Create>> PacmanController() + <<Create>> Controller()
+ Cmd getCommand() + ArrayList<Boolean> getCommand()
+ void keyPressed(KeyEvent) + void keyPressed(KeyEvent)
+ void keyReleased(KeyEvent) + void keyReleased(KeyEvent)
+ void keyTyped(KeyEvent) + void keyTyped(KeyEvent)
...@@ -121,14 +119,9 @@ class jeu.Jeu{ ...@@ -121,14 +119,9 @@ class jeu.Jeu{
+ void evolve(Cmd) + void evolve(Cmd)
+ boolean isFinished() + boolean isFinished()
} }
<<<<<<< HEAD
class environment.Physique{ class environment.Physique{
- double g - double g
- double lambda - double lambda
} }
=======
>>>>>>> b21761b421591b5fad482fd94972d5eb53ff8a31
@enduml @enduml
\ No newline at end of file
...@@ -65,7 +65,7 @@ public class GameEngineGraphical { ...@@ -65,7 +65,7 @@ public class GameEngineGraphical {
// affiche le game // affiche le game
this.gui.paint(); this.gui.paint();
// met en attente // met en attente
Thread.sleep(1); Thread.sleep(2);
} }
} }
......
...@@ -6,15 +6,14 @@ import environnement.Physique; ...@@ -6,15 +6,14 @@ import environnement.Physique;
import jeu.Jeu; import jeu.Jeu;
public class Character extends Entity{ public class Character extends Entity{
//Coordonnees coord;
//double vitesseMax; // vitesse max
double vitesseActuX = 0; // vitesse actuelle supposée nulle au départ double vitesseActuX = 0; // vitesse actuelle supposée nulle au départ
double vitesseActuZ = 0; double vitesseActuZ = 0;
double m; private double masse;
public Character(Coordonnees c,double vitesseMax,double m){ public Character(Coordonnees c,double vitesseMax,double m){
super(c,vitesseMax); super(c,vitesseMax);
this.m = m; this.masse = m;
} }
@Override @Override
...@@ -59,7 +58,7 @@ public class Character extends Entity{ ...@@ -59,7 +58,7 @@ public class Character extends Entity{
} }
public double getM() { public double getM() {
return m; return masse;
} }
......
package environnement;
public class Object {
}
...@@ -6,7 +6,7 @@ public class Obstacle { ...@@ -6,7 +6,7 @@ public class Obstacle {
//private final Coordonnees centre; //private final Coordonnees centre;
private HashMap<String, Coordonnees> extremites; private HashMap<String, Coordonnees> extremites;
private int defaultUnit = 10; private static int defaultUnit = 10;
public Obstacle(Coordonnees c){ public Obstacle(Coordonnees c){
HashMap<String, Coordonnees> extremites = new HashMap<String,Coordonnees>(); HashMap<String, Coordonnees> extremites = new HashMap<String,Coordonnees>();
......
...@@ -24,11 +24,11 @@ public class Controller implements GameController{ ...@@ -24,11 +24,11 @@ public class Controller implements GameController{
*/ */
@Override @Override
public ArrayList<Boolean> getCommand() { public ArrayList<Boolean> getCommand() {
ArrayList<Boolean> a = new ArrayList<Boolean>(); ArrayList<Boolean> cmd = new ArrayList<Boolean>();
a.add(isRightPressed); cmd.add(isRightPressed);
a.add(isLeftPressed); cmd.add(isLeftPressed);
a.add(isSpacePressed); cmd.add(isSpacePressed);
return a; return cmd;
} }
@Override @Override
......
package jeu; package jeu;
import engine.Game;
import environnement.Coordonnees;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import entity.Character; import entity.Character;
import engine.Game;
import environnement.Coordonnees;
public class Jeu implements Game{ public class Jeu implements Game{
......
package jeu; package jeu;
import engine.GamePainter; import engine.GamePainter;
import environnement.Obstacle;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import static jeu.Jeu.charac; import static jeu.Jeu.charac;
import static jeu.Jeu.getCoordSol;
public class Painter implements GamePainter{ public class Painter implements GamePainter{
...@@ -18,9 +21,8 @@ public class Painter implements GamePainter{ ...@@ -18,9 +21,8 @@ public class Painter implements GamePainter{
public void draw(BufferedImage im) { public void draw(BufferedImage im) {
Graphics2D crayon = (Graphics2D) im.getGraphics(); Graphics2D crayon = (Graphics2D) im.getGraphics();
crayon.setColor(Color.blue); crayon.setColor(Color.blue);
int x = (int) charac.getCoord().getX(); drawCharacter(crayon);
int y = (int) charac.getCoord().getZ(); drawSol(crayon);
crayon.fillRect(x-15,y-30,30,60);
} }
@Override @Override
...@@ -32,4 +34,18 @@ public class Painter implements GamePainter{ ...@@ -32,4 +34,18 @@ public class Painter implements GamePainter{
public int getHeight() { public int getHeight() {
return HEIGHT; return HEIGHT;
} }
private void drawCharacter(Graphics2D crayon){
int x = (int) charac.getCoord().getX();
int y = (int) charac.getCoord().getZ();
crayon.fillRect(x-15,y-30,30,60);
}
private void drawObstacle(Graphics2D crayon, Obstacle obstacle){
}
private void drawSol(Graphics2D crayon){
crayon.drawLine(0,(int) getCoordSol().getZ(),getWidth(),(int) getCoordSol().getZ());
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment