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
2d252f63
Commit
2d252f63
authored
2 years ago
by
Paolo.Brasolin
Browse files
Options
Downloads
Patches
Plain Diff
feat: #fe make game over screen informative
parent
0a93861f
No related branches found
No related tags found
No related merge requests found
Pipeline
#23944
passed with warnings
2 years ago
Stage: setup
Stage: check
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/js/fight_scene.ts
+9
-1
9 additions, 1 deletion
frontend/src/js/fight_scene.ts
frontend/src/js/game_over_scene.ts
+45
-6
45 additions, 6 deletions
frontend/src/js/game_over_scene.ts
with
54 additions
and
7 deletions
frontend/src/js/fight_scene.ts
+
9
−
1
View file @
2d252f63
...
...
@@ -43,6 +43,7 @@ export default class FightScene extends Phaser.Scene {
beDevice
:
Types
.
Device
;
beGame
:
Types
.
Game
;
typewriter
:
Typewriter
;
acceptedWords
:
number
;
score
:
number
;
health
:
number
;
hud
:
HUD
;
...
...
@@ -111,6 +112,7 @@ export default class FightScene extends Phaser.Scene {
init
()
{
this
.
score
=
0
;
this
.
health
=
100
;
this
.
acceptedWords
=
0
;
this
.
uiDimensions
=
this
.
initUiDimensions
();
this
.
hud
=
new
HUD
(
this
,
{
...
...
@@ -360,7 +362,12 @@ export default class FightScene extends Phaser.Scene {
this
.
sound
.
play
(
"
sfx_game_over
"
);
this
.
typewriter
.
setActive
(
false
);
this
.
typewriter
.
resetInputStatus
();
this
.
scene
.
start
(
"
game_over
"
,
{
music
:
this
.
music
});
this
.
scene
.
start
(
"
game_over
"
,
{
music
:
this
.
music
,
words
:
this
.
acceptedWords
,
score
:
this
.
beGame
.
score
,
time
:
this
.
beGame
.
ended_at_gmtm
,
});
}
initCluesGroup
()
{
...
...
@@ -442,6 +449,7 @@ export default class FightScene extends Phaser.Scene {
this
.
hud
.
showSubmitFeedback
(
"
red
"
,
inputStatus
.
final
);
new
Spear
(
this
,
this
.
player
,
undefined
);
}
else
{
this
.
acceptedWords
+=
1
;
this
.
sound
.
play
(
"
sfx_hi_beep
"
);
backend
.
updateClue
(
match
.
beClue
.
id
,
{
ended_at
:
new
Date
().
toISOString
(),
...
...
This diff is collapsed.
Click to expand it.
frontend/src/js/game_over_scene.ts
+
45
−
6
View file @
2d252f63
import
"
phaser
"
;
import
BackgroundScene
from
"
./background_scene
"
;
import
{
formatTime
,
ICONS
}
from
"
./hud
"
;
export
default
class
GameOverScene
extends
Phaser
.
Scene
{
music
!
:
Phaser
.
Sound
.
BaseSound
;
...
...
@@ -23,7 +24,12 @@ export default class GameOverScene extends Phaser.Scene {
this
.
music
.
play
();
}
create
(
data
:
{
music
?:
Phaser
.
Sound
.
BaseSound
})
{
create
(
data
:
{
music
?:
Phaser
.
Sound
.
BaseSound
;
words
:
number
;
score
:
number
;
time
:
number
;
})
{
(
this
.
scene
.
get
(
"
background
"
)
as
BackgroundScene
).
dropCurtain
();
(
this
.
scene
.
get
(
"
background
"
)
as
BackgroundScene
).
atmosphere
.
stop
()
...
...
@@ -34,20 +40,53 @@ export default class GameOverScene extends Phaser.Scene {
);
this
.
drawTitle
();
this
.
drawSubtitle
(
data
.
words
);
this
.
drawResult
(
data
.
score
,
data
.
time
);
this
.
drawCTA
();
this
.
bindEvents
();
}
drawTitle
()
{
const
text
=
"
ÖTZI
\n
DIED
"
;
const
text
=
"
ÖTZI
LOST
"
;
const
title
=
this
.
add
.
text
(
0
,
0
,
text
,
{
font
:
"
bold 64px Courier
"
,
color
:
"
#ff0000
"
,
});
title
.
setOrigin
(
0.5
,
0.5
);
title
.
setOrigin
(
0.5
,
1
);
title
.
setPosition
(
this
.
cameras
.
main
.
width
*
0.5
,
this
.
cameras
.
main
.
height
*
0.4
,
this
.
cameras
.
main
.
height
*
0.3
,
);
}
drawSubtitle
(
wordCount
=
1234
)
{
const
text
=
`but you donated\n
${
wordCount
}
WORDS\n
${
ICONS
.
HEALTH
}
️ Thank you!
${
ICONS
.
HEALTH
}
`
;
const
subtitle
=
this
.
add
.
text
(
0
,
0
,
text
,
{
font
:
"
bold 32px Courier
"
,
color
:
"
#aaff00
"
,
align
:
"
center
"
,
testString
:
text
,
});
subtitle
.
setOrigin
(
0.5
,
0
);
subtitle
.
setPosition
(
this
.
cameras
.
main
.
width
*
0.5
,
this
.
cameras
.
main
.
height
*
0.3
,
);
}
drawResult
(
score
=
12345678
,
time
=
12
*
60
*
1000
+
34
*
1000
+
56
*
10
)
{
const
timer
=
formatTime
(
time
);
const
text
=
`
${
score
}
\u2009
${
ICONS
.
SCORE
}
\n
${
timer
}
\u2009
${
ICONS
.
CLOCK
}
`
;
const
title
=
this
.
add
.
text
(
0
,
0
,
text
,
{
font
:
"
bold 32px Courier
"
,
color
:
"
#ffffff
"
,
align
:
"
right
"
,
testString
:
text
,
});
title
.
setOrigin
(
0.5
,
1
);
title
.
setPosition
(
this
.
cameras
.
main
.
width
*
0.5
,
this
.
cameras
.
main
.
height
*
0.7
,
);
}
...
...
@@ -57,10 +96,10 @@ export default class GameOverScene extends Phaser.Scene {
font
:
"
bold 32px Courier
"
,
color
:
"
#ffffff
"
,
});
cta
.
setOrigin
(
0.5
,
0
.5
);
cta
.
setOrigin
(
0.5
,
0
);
cta
.
setPosition
(
this
.
cameras
.
main
.
width
*
0.5
,
this
.
cameras
.
main
.
height
*
0.7
,
this
.
cameras
.
main
.
height
*
0.7
5
,
);
}
...
...
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