Nantes Université
Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
POO.23.24.7
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Service d'assistance
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Pierrick LERMITE
POO.23.24.7
Validations
deb7b9b3
Valider
deb7b9b3
rédigé
1 year ago
par
Pierrick Lermite
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
modif
parent
157b699f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
4
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
4 fichiers modifiés
src/App/Display/GroundDisplay.java
+6
-1
6 ajouts, 1 suppression
src/App/Display/GroundDisplay.java
src/App/GamePanel.java
+3
-0
3 ajouts, 0 suppression
src/App/GamePanel.java
src/App/Ground.java
+11
-4
11 ajouts, 4 suppressions
src/App/Ground.java
src/App/Player.java
+15
-1
15 ajouts, 1 suppression
src/App/Player.java
avec
35 ajouts
et
6 suppressions
src/App/Display/GroundDisplay.java
+
6
−
1
Voir le fichier @
deb7b9b3
...
...
@@ -9,17 +9,18 @@ import App.Block.Block;
public
class
GroundDisplay
{
private
Graphics
g
;
private
Ground
ground
;
private
int
blocksize
;
public
GroundDisplay
(
Ground
gr
,
Graphics
gg
){
this
.
g
=
gg
;
this
.
ground
=
gr
;
this
.
blocksize
=
60
;
}
public
void
draw
(){
Graphics2D
[][]
l_g
=
new
Graphics2D
[
ground
.
getnbX
()][
ground
.
getnbY
()];
Block
[][]
grid
=
ground
.
getGrid
();
int
blocksize
=
60
;
for
(
int
j
=
0
;
j
<
ground
.
getnbY
();
j
++){
for
(
int
i
=
0
;
i
<
ground
.
getnbX
();
i
++){
...
...
@@ -29,6 +30,10 @@ public class GroundDisplay {
l_g
[
i
][
j
].
setColor
(
Color
.
white
);
l_g
[
i
][
j
].
fillRect
(
i
*
blocksize
,
j
*
blocksize
,
blocksize
,
blocksize
);
}
if
(
grid
[
i
][
j
].
getLife
()
==
1
){
l_g
[
i
][
j
].
setColor
(
Color
.
yellow
);
l_g
[
i
][
j
].
fillRect
(
i
*
blocksize
,
j
*
blocksize
,
blocksize
,
blocksize
);
}
}
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/App/GamePanel.java
+
3
−
0
Voir le fichier @
deb7b9b3
...
...
@@ -100,6 +100,9 @@ public class GamePanel extends JPanel implements Runnable{
if
(
keyH
.
leftPressed
==
true
&&
!
game
.
collisionTestBLock
(
player1
,-
player1
.
getSpeed
()
,
0
)){
player1
.
addX
(-
player1
.
getSpeed
());
}
System
.
out
.
println
(
player1
.
getGridX
()
+
" "
+
player1
.
getGridY
());
}
public
void
paintComponent
(
Graphics
g
){
super
.
paintComponent
(
g
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/App/Ground.java
+
11
−
4
Voir le fichier @
deb7b9b3
...
...
@@ -26,16 +26,23 @@ public class Ground {
grid
[
i
][
j
]
=
new
ImbreakableBlock
();
}
else
{
//Vide
grid
[
i
][
j
]
=
new
VoidBlock
();
//Génération bloc cassable
if
(((
Math
.
random
()*
100
)
>=
33
)
&&
!((
j
==
1
&&
(
i
==
1
||
i
==
2
)
||
(
j
==
2
&&
i
==
1
)))
&&
!((
j
==
nby
-
2
&&
(
i
==
nbx
-
3
||
i
==
nbx
-
2
)
||
(
j
==
nby
-
3
&&
i
==
nbx
-
2
)))
){
grid
[
i
][
j
]
=
new
OneLifeBlock
();
}
else
{
//Vide
grid
[
i
][
j
]
=
new
VoidBlock
();
}
}
}
}
}
}
// A FINIR
public
boolean
collisionTestBLock
(
Player
p
,
int
dx
,
int
dy
){
int
boxsizeplayer
=
34
;
int
pX
=
p
.
getX
();
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/App/Player.java
+
15
−
1
Voir le fichier @
deb7b9b3
...
...
@@ -8,7 +8,21 @@ public class Player {
public
Player
(
int
xx
,
int
yy
){
this
.
x
=
xx
;
this
.
y
=
yy
;
this
.
speed
=
2
;
this
.
speed
=
4
;
}
public
int
getGridX
(){
int
boxsizebloc
=
60
;
int
boxsizeplayer
=
34
;
int
centerplayer
=
boxsizeplayer
/
2
;
return
(
this
.
x
+
centerplayer
)
/
boxsizebloc
;
}
public
int
getGridY
(){
int
boxsizebloc
=
60
;
int
boxsizeplayer
=
34
;
int
centerplayer
=
boxsizeplayer
/
2
;
return
(
this
.
y
+
centerplayer
)
/
boxsizebloc
;
}
public
int
getX
(){
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter