Skip to content

Commit

Permalink
level summary and end screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Urbas committed Nov 29, 2013
1 parent 9cc6b17 commit 1af3f76
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 97 deletions.
127 changes: 79 additions & 48 deletions app/scripts/game.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 20 additions & 13 deletions app/scripts/game/scenes/end.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Q = Game.Q
Q.scene "end", (stage) ->

# some math
marginY = Q.height * 0.2
marginY = Q.height * 0.25

# audio
Q.AudioManager.stopAll()
Expand All @@ -13,24 +13,31 @@ Q.scene "end", (stage) ->
x: Q.width/2
y: marginY/2
label: "The End"
size: 30
color: "#fff"
family: "Ubuntu"
color: "#f2da38"
family: "Jolly Lodger"
size: 100

# message
stage.insert new Q.UI.Text
x: Q.width/2
y: marginY/2 + 100
label: "You did it! If you like the game give us some feedback."
size: 30
color: "#fff"
family: "Ubuntu"
x: Q.width/2
y: Q.height/2
label: "You did it!\nIf you like the game, follow us on twitter.\nAlso please give us some feedback.\nThanks for your time!"
color: "#c4da4a"
family: "Boogaloo"
size: 36
align: "center"

# button
button = stage.insert new Q.UI.Button
x: Q.width/2
y: marginY/2 + 350
fill: "#CCCCCC"
label: "Play again"
y: Q.height - marginY/2
w: Q.width/3
h: 70
fill: "#c4da4a"
radius: 10
fontColor: "#353b47"
font: "400 58px Jolly Lodger"
label: "Back to all levels"
keyActionName: "confirm"
type: Q.SPRITE_UI | Q.SPRITE_DEFAULT

Expand Down
101 changes: 65 additions & 36 deletions app/scripts/game/scenes/level_summary.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Q = Game.Q
Q.scene "levelSummary", (stage) ->

# some math
marginY = Q.height * 0.2
marginY = Q.height * 0.25

# audio
Q.AudioManager.stopAll()
Expand All @@ -12,59 +12,88 @@ Q.scene "levelSummary", (stage) ->
stage.insert new Q.UI.Text
x: Q.width/2
y: marginY/2
label: "Well done! Let's see the level summary:"
size: 30
color: "#fff"
family: "Ubuntu"
label: "Well done!"
color: "#f2da38"
family: "Jolly Lodger"
size: 100

# add level summary
container = stage.insert new Q.UI.Container
x: Q.width/2
y: Q.height/2

lineHeight = 50

if stage.options.health
stage.insert new Q.UI.Text
x: Q.width/2
y: marginY/2 + 100
container.insert new Q.UI.Text
x: 0
y: -lineHeight * 2
label: "Health collected: " + stage.options.health.collected + "/" + stage.options.health.available
size: 30
color: "#fff"
family: "Ubuntu"
color: "#c4da4a"
family: "Boogaloo"
size: 36

if stage.options.zombies
stage.insert new Q.UI.Text
x: Q.width/2
y: marginY/2 + 150
container.insert new Q.UI.Text
x: 0
y: -lineHeight
label: "Zombies healed: " + stage.options.zombies.healed + "/" + stage.options.zombies.available
size: 30
color: "#fff"
family: "Ubuntu"
color: "#c4da4a"
family: "Boogaloo"
size: 36

if stage.options.bullets
stage.insert new Q.UI.Text
x: Q.width/2
y: marginY/2 + 200
container.insert new Q.UI.Text
x: 0
y: 0
label: "Bullets waisted: " + stage.options.bullets.waisted + "/" + stage.options.bullets.available
size: 30
color: "#fff"
family: "Ubuntu"
color: "#c4da4a"
family: "Boogaloo"
size: 36

if stage.options.zombieModeFound?
stage.insert new Q.UI.Text
x: Q.width/2
y: marginY/2 + 250
container.insert new Q.UI.Text
x: 0
y: lineHeight
label: "Zombie Mode: " + if stage.options.zombieModeFound then "done" else "not found"
size: 30
color: "#fff"
family: "Ubuntu"
color: "#c4da4a"
family: "Boogaloo"
size: 36


# button
button = stage.insert new Q.UI.Button
x: Q.width/2
y: marginY/2 + 350
fill: "#CCCCCC"
label: "Play Next"
# button next
buttonNext = stage.insert new Q.UI.Button
y: Q.height - marginY
w: Q.width/4
h: 70
fill: "#c4da4a"
radius: 10
fontColor: "#353b47"
font: "400 58px Jolly Lodger"
label: "Play next"
keyActionName: "confirm"
type: Q.SPRITE_UI | Q.SPRITE_DEFAULT

button.on "click", (e) ->
buttonNext.p.x = Q.width/2 + buttonNext.p.w/2 + 40

buttonNext.on "click", (e) ->
Game.stageLevel(Q.state.get("currentLevel") + 1)

# button back
buttonBack = stage.insert new Q.UI.Button
y: Q.height - marginY
w: Q.width/4
h: 70
fill: "#f2da38"
radius: 10
fontColor: "#353b47"
font: "400 58px Jolly Lodger"
label: "All levels"
type: Q.SPRITE_UI | Q.SPRITE_DEFAULT

buttonBack.p.x = Q.width/2 - buttonBack.p.w/2 - 40

buttonBack.on "click", (e) ->
Game.stageLevelSelectScreen()

# save progress in game
Expand Down

0 comments on commit 1af3f76

Please sign in to comment.