Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
oetzit
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
commul
oetzit
Commits
71a8b364
Commit
71a8b364
authored
2 years ago
by
Paolo Brasolin
Browse files
Options
Downloads
Patches
Plain Diff
feat: #fe use button for game over screen
parent
5f9b1cc9
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
frontend/src/js/game_over_scene.ts
+34
-15
34 additions, 15 deletions
frontend/src/js/game_over_scene.ts
with
34 additions
and
15 deletions
frontend/src/js/game_over_scene.ts
+
34
−
15
View file @
71a8b364
...
@@ -3,8 +3,24 @@ import { FONTS } from "./assets";
...
@@ -3,8 +3,24 @@ import { FONTS } from "./assets";
import
BackgroundScene
from
"
./background_scene
"
;
import
BackgroundScene
from
"
./background_scene
"
;
import
{
formatTime
,
ICONS
,
THIN_SPACE
}
from
"
./hud
"
;
import
{
formatTime
,
ICONS
,
THIN_SPACE
}
from
"
./hud
"
;
const
BUTTON_HIGHLIGHT_COLOR
=
"
darkorange
"
;
const
TEXT_STYLE
:
{
[
key
:
string
]:
Phaser
.
Types
.
GameObjects
.
Text
.
TextStyle
;
}
=
{
BUTTON
:
{
fontFamily
:
FONTS
.
MONO
,
fontStyle
:
"
bold
"
,
color
:
"
white
"
,
stroke
:
"
black
"
,
strokeThickness
:
8
,
testString
:
"
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
"
,
},
};
export
default
class
GameOverScene
extends
Phaser
.
Scene
{
export
default
class
GameOverScene
extends
Phaser
.
Scene
{
music
!
:
Phaser
.
Sound
.
BaseSound
;
music
!
:
Phaser
.
Sound
.
BaseSound
;
continueButton
!
:
Phaser
.
GameObjects
.
Text
;
constructor
()
{
constructor
()
{
super
(
"
game_over
"
);
super
(
"
game_over
"
);
...
@@ -95,26 +111,29 @@ export default class GameOverScene extends Phaser.Scene {
...
@@ -95,26 +111,29 @@ export default class GameOverScene extends Phaser.Scene {
}
}
drawCTA
()
{
drawCTA
()
{
const
text
=
"
press to continue
"
;
const
verb
=
this
.
game
.
device
.
os
.
desktop
?
"
Click
"
:
"
Tap
"
;
const
cta
=
this
.
add
.
text
(
0
,
0
,
text
,
{
const
text
=
`
${
verb
}
to continue`
;
fontSize
:
"
32px
"
,
this
.
continueButton
=
this
.
add
fontFamily
:
FONTS
.
MONO
,
.
text
(
this
.
cameras
.
main
.
centerX
,
this
.
cameras
.
main
.
height
*
0.8
,
text
,
{
fontStyle
:
"
bold
"
,
...
TEXT_STYLE
.
BUTTON
,
color
:
"
#ffffff
"
,
fontSize
:
"
32px
"
,
});
})
cta
.
setOrigin
(
0.5
,
0
);
.
setOrigin
(
0.5
,
0
)
cta
.
setPosition
(
.
setPadding
(
4
)
this
.
cameras
.
main
.
width
*
0.5
,
.
setInteractive
({
useHandCursor
:
true
})
this
.
cameras
.
main
.
height
*
0.8
,
.
on
(
"
pointerover
"
,
()
=>
);
this
.
continueButton
.
setStyle
({
stroke
:
BUTTON_HIGHLIGHT_COLOR
}),
)
.
on
(
"
pointerout
"
,
()
=>
this
.
continueButton
.
setStyle
({
stroke
:
TEXT_STYLE
.
BUTTON
.
stroke
}),
);
}
}
bindEvents
()
{
bindEvents
()
{
this
.
input
.
keyboard
.
once
(
"
keyup
"
,
this
.
startFight
.
bind
(
this
));
this
.
continueButton
.
on
(
"
pointerup
"
,
this
.
backToWelcome
.
bind
(
this
));
this
.
input
.
once
(
"
pointerup
"
,
this
.
startFight
.
bind
(
this
));
}
}
startFight
()
{
backToWelcome
()
{
(
this
.
scene
.
get
(
"
background
"
)
as
BackgroundScene
).
liftCurtain
();
(
this
.
scene
.
get
(
"
background
"
)
as
BackgroundScene
).
liftCurtain
();
this
.
scene
.
start
(
"
welcome
"
,
{
music
:
this
.
music
});
this
.
scene
.
start
(
"
welcome
"
,
{
music
:
this
.
music
});
}
}
...
...
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