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
c97fe6a8
Commit
c97fe6a8
authored
Jan 06, 2016
by
Fjen Undso
Browse files
gamescreen: fix shotangle and bounds
parent
66dd2436
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/src/org/milderjoghurt/frozennumbers/screens/GameScreen.java
View file @
c97fe6a8
...
...
@@ -6,6 +6,7 @@ import com.badlogic.gdx.audio.Sound;
import
com.badlogic.gdx.graphics.Color
;
import
com.badlogic.gdx.graphics.GL20
;
import
com.badlogic.gdx.graphics.Texture
;
import
com.badlogic.gdx.graphics.g2d.Batch
;
import
com.badlogic.gdx.graphics.g2d.BitmapFont
;
import
com.badlogic.gdx.graphics.g2d.GlyphLayout
;
import
com.badlogic.gdx.graphics.g2d.Sprite
;
...
...
@@ -83,7 +84,7 @@ public class GameScreen implements Screen {
panel
=
new
Sprite
(
FrozenNumbersGame
.
assets
.
get
(
"panel_blue.png"
,
Texture
.
class
));
panel
.
setX
(
0
);
panel
.
setSize
(
wWidth
,
bubblradius
*
2
+
bubblradius
);
m_Bounds
=
new
Rectangle
(
bubblradius
,
bubblradius
,
(
float
)
wWidth
-
bubblradius
,
(
float
)
wHeight
-
bubblradius
);
m_Bounds
=
new
Rectangle
(
0
,
bubblradius
,
(
float
)
wWidth
,
(
float
)
wHeight
-
bubblradius
);
//bg = new Sprite(FrozenNumbersGame.assets.get("border.png", Texture.class));
...
...
@@ -146,7 +147,7 @@ public class GameScreen implements Screen {
FrozenNumbersGame
.
viewport
.
unproject
(
touchPoint
.
set
(
Gdx
.
input
.
getX
(),
Gdx
.
input
.
getY
()));
if
(
p
.
active
!=
null
)
{
if
(!
p
.
active
.
isFlying
&&
lower
&&
touchPoint
.
y
<
bound
)
{
Vector2
star
=
new
Vector2
(
touchPoint
.
x
,
wHeight
-
touchPoint
.
y
);
Vector2
star
=
new
Vector2
(
touchPoint
.
x
,
touchPoint
.
y
);
Vector2
ssrc
=
new
Vector2
(
wWidth
/
2
,
bubblradius
*
2
);
Vector2
speed
=
star
.
cpy
().
sub
(
ssrc
).
nor
();
speed
.
set
(
speed
.
x
,
Math
.
abs
(
speed
.
y
));
...
...
@@ -156,7 +157,7 @@ public class GameScreen implements Screen {
FrozenNumbersGame
.
assets
.
get
(
"snd/shot.mp3"
,
Sound
.
class
).
play
();
}
if
(!
p
.
active
.
isFlying
&&
!
lower
&&
touchPoint
.
y
>
bound
)
{
Vector2
star
=
new
Vector2
(
touchPoint
.
x
,
wHeight
-
touchPoint
.
y
);
Vector2
star
=
new
Vector2
(
touchPoint
.
x
,
touchPoint
.
y
);
Vector2
ssrc
=
new
Vector2
(
wWidth
/
2
,
wHeight
-
bubblradius
*
2
);
Vector2
speed
=
star
.
cpy
().
sub
(
ssrc
).
nor
();
speed
.
set
(
speed
.
x
,
-
1
*
Math
.
abs
(
speed
.
y
));
...
...
@@ -291,7 +292,10 @@ public class GameScreen implements Screen {
}
renderer
.
end
();
FrozenNumbersGame
.
batch
.
begin
();
Batch
batch
=
FrozenNumbersGame
.
batch
;
FrozenNumbersGame
.
viewport
.
apply
(
true
);
batch
.
setProjectionMatrix
(
FrozenNumbersGame
.
viewport
.
getCamera
().
combined
);
batch
.
begin
();
// for (Hexagon hexagon : map.getHexagons().values()) {
// comb.setCenter((float)hexagon.getCenterX(), (float)hexagon.getCenterY());
...
...
@@ -300,65 +304,65 @@ public class GameScreen implements Screen {
//bg.draw(FrozenNumbersGame.batch);
panel
.
setY
(
0
);
panel
.
draw
(
FrozenNumbersGame
.
batch
);
panel
.
draw
(
batch
);
//border.flip(false,true);
panel
.
setY
(
wHeight
-
panel
.
getHeight
());
panel
.
draw
(
FrozenNumbersGame
.
batch
);
panel
.
draw
(
batch
);
border
.
setRotation
(
0
);
border
.
setScale
(
1
,
1
);
border
.
setCenterY
(
wHeight
*
0.5f
);
border
.
draw
(
FrozenNumbersGame
.
batch
);
border
.
draw
(
batch
);
border
.
setScale
(
1
,
1
);
border
.
setCenterY
(
p1
.
sPos
.
y
+
bubblradius
);
border
.
draw
(
FrozenNumbersGame
.
batch
);
border
.
draw
(
batch
);
//border.flip(false,true);
border
.
setScale
(
1
,
-
1
);
border
.
setCenterY
(
p2
.
sPos
.
y
-
bubblradius
);
border
.
draw
(
FrozenNumbersGame
.
batch
);
border
.
draw
(
batch
);
border
.
draw
(
FrozenNumbersGame
.
batch
);
border
.
draw
(
batch
);
if
(
p1
.
active
!=
null
)
{
p1
.
active
.
draw
(
FrozenNumbersGame
.
batch
);
p1
.
active
.
draw
(
batch
);
drawTextCentered
(
String
.
valueOf
(
p1
.
active
.
getValue
()),
p1
.
active
.
getPos
().
x
,
p1
.
active
.
getPos
().
y
);
}
if
(
p1
.
next
!=
null
)
{
p1
.
next
.
draw
(
FrozenNumbersGame
.
batch
);
p1
.
next
.
draw
(
batch
);
drawTextCentered
(
String
.
valueOf
(
p1
.
next
.
getValue
()),
p1
.
next
.
getPos
().
x
,
p1
.
next
.
getPos
().
y
);
}
if
(
p2
.
active
!=
null
)
{
p2
.
active
.
draw
(
FrozenNumbersGame
.
batch
);
p2
.
active
.
draw
(
batch
);
drawTextCentered
(
String
.
valueOf
(
p2
.
active
.
getValue
()),
p2
.
active
.
getPos
().
x
,
p2
.
active
.
getPos
().
y
);
}
if
(
p2
.
next
!=
null
)
{
p2
.
next
.
draw
(
FrozenNumbersGame
.
batch
);
p2
.
next
.
draw
(
batch
);
drawTextCentered
(
String
.
valueOf
(
p2
.
next
.
getValue
()),
p2
.
next
.
getPos
().
x
,
p2
.
next
.
getPos
().
y
);
}
for
(
Bubble
bubble
:
nachbarn
.
values
())
{
bubble
.
draw
(
FrozenNumbersGame
.
batch
);
bubble
.
draw
(
batch
);
drawTextCentered
(
String
.
valueOf
(
bubble
.
getValue
()),
bubble
.
getPos
().
x
,
bubble
.
getPos
().
y
);
}
FrozenNumbersGame
.
assets
.
get
(
"size20.ttf"
,
BitmapFont
.
class
).
draw
(
FrozenNumbersGame
.
batch
,
lastpoint
,
10
,
40
);
FrozenNumbersGame
.
assets
.
get
(
"size20.ttf"
,
BitmapFont
.
class
).
draw
(
FrozenNumbersGame
.
batch
,
String
.
valueOf
(
p1
.
score
),
60
,
20
);
FrozenNumbersGame
.
assets
.
get
(
"size20.ttf"
,
BitmapFont
.
class
).
draw
(
batch
,
lastpoint
,
10
,
40
);
FrozenNumbersGame
.
assets
.
get
(
"size20.ttf"
,
BitmapFont
.
class
).
draw
(
batch
,
String
.
valueOf
(
p1
.
score
),
60
,
20
);
Label
p2ScoreLabel
=
new
Label
(
String
.
valueOf
(
p2
.
score
),
new
Label
.
LabelStyle
(
FrozenNumbersGame
.
assets
.
get
(
"size20.ttf"
,
BitmapFont
.
class
),
Color
.
WHITE
));
Table
container
=
new
Table
();
container
.
setTransform
(
true
);
container
.
add
(
p2ScoreLabel
);
container
.
setRotation
(
180
);
container
.
setPosition
(
Gdx
.
graphics
.
get
Width
()
-
60
,
Gdx
.
graphics
.
get
Height
()
-
10
);
container
.
draw
(
FrozenNumbersGame
.
batch
,
1
);
FrozenNumbersGame
.
batch
.
end
();
container
.
setPosition
(
w
Width
-
60
,
w
Height
-
10
);
container
.
draw
(
batch
,
1
);
batch
.
end
();
}
private
void
drawTextCentered
(
String
text
,
float
x
,
float
y
)
{
...
...
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