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