Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LEGER ROMAIN
CasseBrique
Commits
546b8478
Commit
546b8478
authored
Jan 08, 2016
by
Rominho15
Browse files
Version 7.2 : Gestion des niveaux en multijoueurs
parent
9e01888d
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/example/rleger/cassebrique/Controller/GameController.java
View file @
546b8478
...
...
@@ -55,7 +55,7 @@ public class GameController {
// place la batte en dessous de la balle
int
batX
=
gameModel
.
getGround
().
getCenter
().
x
;
int
batY
=
3
*
gameModel
.
getGround
().
getCenter
().
y
/
2
;
int
batY
=
5
*
gameModel
.
getGround
().
getCenter
().
y
/
3
;
// met à jour la position de la batte dans le modèle
gameModel
.
getBat
().
setX
(
batX
);
...
...
@@ -66,7 +66,7 @@ public class GameController {
if
(
gameModel
.
getBat2
()
!=
null
)
{
// place la batte en dessous de la balle
int
bat2X
=
gameModel
.
getGround
().
getCenter
().
x
;
int
bat2Y
=
gameModel
.
getGround
().
getCenter
().
y
/
2
;
int
bat2Y
=
gameModel
.
getGround
().
getCenter
().
y
/
3
;
// met à jour la position de la batte dans le modèle
gameModel
.
getBat2
().
setX
(
bat2X
);
...
...
app/src/main/java/com/example/rleger/cassebrique/Model/GameModel.java
View file @
546b8478
...
...
@@ -22,8 +22,6 @@ public class GameModel{
if
(
p
==
2
)
bat2
=
new
Bat
(
50
,
50
);
Log
.
e
(
"bat2"
,
""
+
bat2
);
ball
=
new
Ball
(
15
,
15
);
events
=
new
Evenements
();
brickGroups
=
new
ArrayList
<>();
...
...
@@ -126,6 +124,10 @@ public class GameModel{
int
x
=
distL
;
int
y
=
distH
;
if
(
getBat2
()
!=
null
)
y
=
ground
.
getHeight
()/
3
;
for
(
int
i
=
0
;
i
<
nbBricksY
;
i
++)
{
for
(
int
j
=
0
;
j
<
nbBricksX
;
j
++)
{
switch
(
j
)
{
...
...
@@ -211,6 +213,9 @@ public class GameModel{
int
x
=
distL
;
int
y
=
distH
;
if
(
getBat2
()
!=
null
)
y
=
ground
.
getHeight
()/
3
;
for
(
int
j
=
0
;
j
<
nbBricksY
;
j
++)
{
for
(
int
i
=
0
;
i
<
nbBricksX
;
i
++)
{
switch
(
getColor2
(
j
,
i
))
{
...
...
app/src/main/java/com/example/rleger/cassebrique/View/GameView.java
View file @
546b8478
...
...
@@ -191,7 +191,7 @@ public class GameView extends View {
canvas
.
drawRect
(
xBat2
,
yBat2
,
xBat2
+
wBat2
,
yBat2
+
hBat2
,
paintBat2
);
// Curseur
canvas
.
drawCircle
(
xBat2
+
wBat2
/
2
,
yBat2
-
hBat2
-
20
,
7
,
paintBall
);
canvas
.
drawCircle
(
xBat2
+
wBat2
/
2
,
yBat2
-
20
,
7
,
paintBall
);
}
for
(
int
g
=
0
;
g
<
gameControlleur
.
getGameModel
().
getBrickGroupsSize
()
;
g
++)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment