Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Idle Spaceship Tycoon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Elias Fierke
Idle Spaceship Tycoon
Commits
35541bd7
Commit
35541bd7
authored
1 month ago
by
Elias Fierke
Browse files
Options
Downloads
Patches
Plain Diff
[feat:] coin amount display
parent
5428f3f7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/java/com/fiewie/idlespaceshiptycoon/GameStage.java
+20
-1
20 additions, 1 deletion
...c/main/java/com/fiewie/idlespaceshiptycoon/GameStage.java
with
20 additions
and
1 deletion
core/src/main/java/com/fiewie/idlespaceshiptycoon/GameStage.java
+
20
−
1
View file @
35541bd7
...
...
@@ -7,6 +7,7 @@ import com.badlogic.gdx.Gdx;
import
com.badlogic.gdx.Input
;
import
com.badlogic.gdx.scenes.scene2d.Stage
;
import
com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
;
import
com.badlogic.gdx.scenes.scene2d.ui.Image
;
import
com.badlogic.gdx.scenes.scene2d.ui.ImageButton
;
import
com.badlogic.gdx.scenes.scene2d.ui.Label
;
import
com.badlogic.gdx.scenes.scene2d.ui.Skin
;
...
...
@@ -36,18 +37,32 @@ public class GameStage extends Stage {
private
boolean
isGameOver
;
private
Table
gameOverMenu
;
public
Label
scoreLabel
;
public
Label
coinLabel
;
public
Image
coinImage
;
//public static BackgroundPool background_pool = new BackgroundPool();
public
GameStage
()
{
SoundManager
.
getInstance
().
playMusic
(
"soundtracks/main_game.wav"
,
true
);
BitmapFont
font
=
new
BitmapFont
();
font
.
getData
().
setScale
(
3
);
Label
.
LabelStyle
defaultLabelStyle
=
new
Label
.
LabelStyle
();
defaultLabelStyle
.
font
=
font
;
scoreLabel
=
new
Label
(
"Score: 0"
,
defaultLabelStyle
);
scoreLabel
.
setPosition
(
5
,
getHeight
()-
scoreLabel
.
getHeight
()-
5
);
scoreLabel
.
setPosition
(
10
,
getHeight
()-
scoreLabel
.
getHeight
()-
10
);
addActor
(
scoreLabel
);
coinImage
=
new
Image
(
new
Texture
(
"icon/coin.png"
));
coinImage
.
setPosition
(
getWidth
()
-
coinImage
.
getWidth
()
-
10
,
getHeight
()-
coinImage
.
getHeight
()-
10
);
coinLabel
=
new
Label
(
"0"
,
defaultLabelStyle
);
coinLabel
.
setPosition
(
getWidth
()
-
coinImage
.
getWidth
()
-
coinLabel
.
getWidth
()
-
20
,
getHeight
()-
coinLabel
.
getHeight
()-
10
);
addActor
(
coinLabel
);
addActor
(
coinImage
);
ship
=
new
SpaceShip
();
addActor
(
ship
);
enemies
=
new
Array
<>();
...
...
@@ -127,6 +142,8 @@ public class GameStage extends Stage {
coin
.
remove
();
coins
.
removeValue
(
coin
,
true
);
SoundManager
.
getInstance
().
playSound
(
"sounds/coin.mp3"
);
coinLabel
.
setText
(
ship
.
coins
);
coinLabel
.
setPosition
(
getWidth
()
-
coinImage
.
getWidth
()
-
coinLabel
.
getWidth
()
-
20
,
getHeight
()-
coinLabel
.
getHeight
()-
10
);
}
}
for
(
Enemy
enemy
:
enemies
)
{
...
...
@@ -212,6 +229,7 @@ public class GameStage extends Stage {
if
(
event
.
isHandled
())
{
System
.
out
.
println
(
"Start..."
);
Navigator
.
game
.
setScreen
(
new
MainMenu
());
//SoundManager.getInstance().fadeOutMusic(2);
}
return
false
;
});
...
...
@@ -221,6 +239,7 @@ public class GameStage extends Stage {
if
(
event
.
isHandled
())
{
System
.
out
.
println
(
"Start..."
);
Navigator
.
game
.
setScreen
(
new
ShopMenu
());
//SoundManager.getInstance().fadeOutMusic(2);
}
return
false
;
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment