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
65865a5d
Commit
65865a5d
authored
Jan 14, 2016
by
Nils Hein
Browse files
Alternatives zählen der Punkte zum testen
parent
9a7d2540
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/src/org/milderjoghurt/frozennumbers/screens/GameScreen.java
View file @
65865a5d
...
...
@@ -99,7 +99,7 @@ public class GameScreen implements Screen {
nextTop
.
rotate
(
180
);
nextTop
.
setCenter
(
wWidth
/
4.0f
*
3.0f
,
wHeight
*
0.95f
);
nextBottom
.
setAlpha
(
0.
1
f
);
nextBottom
.
setAlpha
(
0.
3
f
);
nextTop
.
setAlpha
(
0.1f
);
nextBottomOverlay
=
new
Sprite
(
FrozenNumbersGame
.
assets
.
get
(
"sprites/btn_next.png"
,
Texture
.
class
));
...
...
@@ -226,6 +226,7 @@ public class GameScreen implements Screen {
nachbarn
.
put
(
point
,
new
Bubble
(
p
.
active
));
}
checkScore
(
point
,
p
.
active
.
getValue
(),
p
);
p
.
active
=
null
;
FrozenNumbersGame
.
assets
.
get
(
"snd/hit.mp3"
,
Sound
.
class
).
play
();
p
.
placedBubbleThisRound
=
true
;
...
...
@@ -240,6 +241,7 @@ public class GameScreen implements Screen {
p
.
active
.
setVel
(
new
Vector2
(
0
,
0
));
if
(!
nachbarn
.
containsKey
(
point
))
nachbarn
.
put
(
point
,
new
Bubble
(
p
.
active
));
checkScore
(
point
,
p
.
active
.
getValue
(),
p
);
p
.
active
=
null
;
FrozenNumbersGame
.
assets
.
get
(
"snd/hit.mp3"
,
Sound
.
class
).
play
();
p
.
placedBubbleThisRound
=
true
;
...
...
@@ -281,6 +283,25 @@ public class GameScreen implements Screen {
}
}
private
void
checkScore
(
Hexagon
h
,
float
val
,
Player
p
){
float
sum
=
0
;
List
<
Bubble
>
nei
=
new
ArrayList
<
Bubble
>();
for
(
Hexagon
n
:
map
.
getNeighborsOf
(
h
))
{
if
(
nachbarn
.
containsKey
(
n
))
{
sum
+=
nachbarn
.
get
(
n
).
getValue
();
nei
.
add
(
nachbarn
.
get
(
n
));
}
if
(
sum
%
10
==
val
&&
nei
.
size
()
>
1
)
break
;
}
if
(
sum
%
10
==
val
&&
nei
.
size
()
>
1
)
{
if
(!
nachbarn
.
get
(
h
).
isFrozen
())
{
removes
.
add
(
h
);
removes
.
addAll
(
map
.
getNeighborsOf
(
h
));
p
.
score
+=
sum
;
}
}
}
@Override
public
void
render
(
float
delta
)
{
removes
.
clear
();
...
...
@@ -301,28 +322,6 @@ public class GameScreen implements Screen {
bu
.
setForce
(
f
);
bu
.
isDamped
=
true
;
bu
.
Update
(
0.1f
);
float
sum
=
0
;
List
<
Bubble
>
nei
=
new
ArrayList
<
Bubble
>();
for
(
Hexagon
n
:
map
.
getNeighborsOf
(
h
))
{
if
(
nachbarn
.
containsKey
(
n
))
{
sum
+=
nachbarn
.
get
(
n
).
getValue
();
nei
.
add
(
nachbarn
.
get
(
n
));
}
}
if
(
sum
%
10
==
bu
.
getValue
()
&&
nei
.
size
()
>
1
)
{
if
(!
nachbarn
.
get
(
h
).
isFrozen
())
{
removes
.
add
(
h
);
removes
.
addAll
(
map
.
getNeighborsOf
(
h
));
if
(
p1
.
placedBubbleThisRound
)
{
p1
.
score
+=
sum
;
p1
.
placedBubbleThisRound
=
false
;
}
if
(
p2
.
placedBubbleThisRound
)
{
p2
.
score
+=
sum
;
p2
.
placedBubbleThisRound
=
false
;
}
}
}
}
//Freezing bubbles
...
...
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