-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJeu.java
More file actions
executable file
·70 lines (58 loc) · 1.55 KB
/
Jeu.java
File metadata and controls
executable file
·70 lines (58 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
public class Jeu {
private Terrain terrain;
private FenetreJeu fenetre;
private Bille bille;
private boolean jeuEnCours = true;
/* Initialisation d'un jeu avec le terrain initial décrit dans
le fichier [f] donné en paramètre */
public Jeu(String f) {
this.terrain = new Terrain(f, this);
this.bille = new Bille(1.5, 1.5, this);
this.fenetre = new FenetreJeu(this);
this.terrain.updateBillePosition(this.bille);
}
public void tour(){
if (jeuEnCours) {
bille.avance();
terrain.updateBillePosition(bille);
fenetre.repaint();
}
}
public void victoire() {
if (jeuEnCours) {
jeuEnCours = false;
Donjon.arreterTimer();
fenetre.afficherVictoire();
}
}
public void defaite() {
if (jeuEnCours) {
jeuEnCours = false;
Donjon.arreterTimer();
fenetre.afficherDefaite();
}
}
public void ouvrirPorte(int id) {
Porte p = terrain.getPorte(id);
if (p != null) {
p.ouvrir();
fenetre.repaint();
}
}
public boolean isJeuEnCours() {
return jeuEnCours;
}
public Terrain getTerrain(){
return this.terrain;
}
public FenetreJeu getFenetre(){
return this.fenetre;
}
public Bille getBille(){
return this.bille;
}
public static void main(String[] args) {
Jeu j = new Jeu("laby1.txt");
j.terrain.print();
}
}