Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MilderJoghurt
FrozenNumbers
Commits
f8a0ec10
Commit
f8a0ec10
authored
Jan 20, 2016
by
MAhrens
Browse files
Game is ended when one field is empty - letting that player win not yet implemented, but prepared
parent
7aafe111
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/src/org/milderjoghurt/frozennumbers/screens/GameOverScreen.java
View file @
f8a0ec10
...
...
@@ -16,6 +16,8 @@ import com.badlogic.gdx.math.Vector2;
import
com.badlogic.gdx.scenes.scene2d.ui.Label
;
import
com.badlogic.gdx.scenes.scene2d.ui.Table
;
import
org.milderjoghurt.frozennumbers.FrozenNumbersGame
;
import
org.milderjoghurt.frozennumbers.screens.GameScreen.Player
;
import
java.util.Map
;
...
...
@@ -30,7 +32,7 @@ public class GameOverScreen implements Screen {
float
wWidth
;
GlyphLayout
glyphLayout
=
new
GlyphLayout
();
public
GameOverScreen
(
int
p1Score
,
int
p2Score
)
{
public
GameOverScreen
(
int
p1Score
,
int
p2Score
,
Player
winner
)
{
p1
=
p1Score
;
p2
=
p2Score
;
...
...
core/src/org/milderjoghurt/frozennumbers/screens/GameScreen.java
View file @
f8a0ec10
...
...
@@ -60,6 +60,8 @@ public class GameScreen implements Screen {
private
Rectangle
m_Bounds
;
float
wWidth
,
wHeight
;
float
timerDefault
=
5
;
boolean
firstMoveP1
=
true
;
boolean
firstMoveP2
=
true
;
private
Hexagon
getCurrentHex
(
Bubble
b
)
{
Vector2
p
=
b
.
getPos
();
...
...
@@ -151,7 +153,6 @@ public class GameScreen implements Screen {
p
.
active
=
new
Bubble
(
p
.
sPos
.
cpy
());
p
.
active
.
setSize
(
bubblradius
*
2
,
bubblradius
*
2
);
p
.
active
.
setCenter
(
p
.
sPos
.
x
,
p
.
sPos
.
y
);
}
if
(
Gdx
.
input
.
justTouched
())
{
...
...
@@ -351,19 +352,39 @@ public class GameScreen implements Screen {
}
}
boolean
checkForEmptyP1
=
true
;
//lower
boolean
checkForEmptyP2
=
true
;
//upper
for
(
Hexagon
h
:
nachbarn
.
keySet
())
{
if
(
nachbarn
.
get
(
h
)!=
null
)
{
double
y
=
h
.
getCenterY
();
if
(
y
>
wHeight
-
3
*
bubblradius
||
y
<
4
*
bubblradius
)
if
(
y
>
wHeight
-
3
*
bubblradius
)
{
FrozenNumbersGame
.
m_Screens
.
put
(
"GameOverScreen"
,
new
GameOverScreen
(
p1
.
score
,
p2
.
score
));
FrozenNumbersGame
.
m_Screens
.
put
(
"GameOverScreen"
,
new
GameOverScreen
(
p1
.
score
,
p2
.
score
,
p1
));
FrozenNumbersGame
.
game
.
setScreen
(
FrozenNumbersGame
.
m_Screens
.
get
(
"GameOverScreen"
));
}
}
else
if
(
y
<
4
*
bubblradius
){
FrozenNumbersGame
.
m_Screens
.
put
(
"GameOverScreen"
,
new
GameOverScreen
(
p1
.
score
,
p2
.
score
,
p2
));
FrozenNumbersGame
.
game
.
setScreen
(
FrozenNumbersGame
.
m_Screens
.
get
(
"GameOverScreen"
));
}
}
if
(
h
.
getCenterY
()<
wHeight
/
2.0f
){
checkForEmptyP1
=
false
;
firstMoveP1
=
false
;
}
if
((
h
.
getCenterY
()-
20
)>
wHeight
/
2.0f
){
checkForEmptyP2
=
false
;
firstMoveP2
=
false
;
}
}
if
(!
firstMoveP1
&&
checkForEmptyP1
)
{
FrozenNumbersGame
.
m_Screens
.
put
(
"GameOverScreen"
,
new
GameOverScreen
(
p1
.
score
,
p2
.
score
,
p1
));
FrozenNumbersGame
.
game
.
setScreen
(
FrozenNumbersGame
.
m_Screens
.
get
(
"GameOverScreen"
));
}
if
(!
firstMoveP2
&&
checkForEmptyP2
)
{
FrozenNumbersGame
.
m_Screens
.
put
(
"GameOverScreen"
,
new
GameOverScreen
(
p1
.
score
,
p2
.
score
,
p2
));
FrozenNumbersGame
.
game
.
setScreen
(
FrozenNumbersGame
.
m_Screens
.
get
(
"GameOverScreen"
));
}
FrozenNumbersGame
.
viewport
.
apply
(
true
);
...
...
Write
Preview
Supports
Markdown
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