Speech
This commit is contained in:
parent
2a31ac0fa1
commit
4a2ee93577
5 changed files with 50 additions and 3 deletions
|
@ -7,6 +7,7 @@ Title: Entire game on one screen
|
|||
|
||||
* TODO HUD
|
||||
** hud: energie progress bar :aaron:
|
||||
** i key
|
||||
|
||||
* TODO OUTRO
|
||||
** win screen
|
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
@ -13,6 +13,31 @@ app.game =
|
|||
@hud.start()
|
||||
@speechbubble.start()
|
||||
|
||||
@intro = true
|
||||
@startIntro()
|
||||
|
||||
startIntro: ->
|
||||
@speechbubble.setFix 90, 27
|
||||
@speechbubble.say 'help', 2000
|
||||
|
||||
@timeout = window.setTimeout @intro2, 3000
|
||||
|
||||
intro2: =>
|
||||
app.game.speechbubble.say 'damn', 2000
|
||||
app.game.timeout = window.setTimeout app.game.intro3, 3000
|
||||
|
||||
intro3: =>
|
||||
app.game.speechbubble.say 'need', 3500
|
||||
app.game.timeout = window.setTimeout app.game.intro4, 4500
|
||||
|
||||
intro4: =>
|
||||
app.game.speechbubble.say 'collect', 3500
|
||||
app.game.timeout = window.setTimeout app.game.introEnd, 3500
|
||||
|
||||
introEnd: =>
|
||||
@intro = false
|
||||
app.game.speechbubble.setMouse()
|
||||
|
||||
render: ->
|
||||
for tile, i in @map
|
||||
y = Math.floor(i/20)
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
app.game.speechbubble =
|
||||
start: ->
|
||||
@sprite = [0, 0, 27, 13]
|
||||
@positioning = 'mouse'
|
||||
|
||||
say: (text) ->
|
||||
setFix: (x, y) ->
|
||||
@x = x
|
||||
@y = y
|
||||
|
||||
@positioning = 'fixed'
|
||||
|
||||
setMouse: ->
|
||||
@positioning = 'mouse'
|
||||
|
||||
say: (text, timeout = 1000) ->
|
||||
clearTimeout(@timeout) if @timeout
|
||||
|
||||
switch text
|
||||
|
@ -10,12 +20,23 @@ app.game.speechbubble =
|
|||
when 'toofar' then @sprite = [0, 13, 90, 13]
|
||||
when 'nores' then @sprite = [0, 26, 90, 13]
|
||||
when 'nosel' then @sprite = [0, 39, 90, 13]
|
||||
when 'damn' then @sprite = [0, 52, 90, 13]
|
||||
when 'need' then @sprite = [0, 65, 90, 13]
|
||||
when 'collect' then @sprite = [0, 78, 90, 13]
|
||||
|
||||
@visible = true
|
||||
@timeout = window.setTimeout @hide, 1000
|
||||
@timeout = window.setTimeout @hide, timeout
|
||||
|
||||
hide: =>
|
||||
app.game.speechbubble.visible = false
|
||||
|
||||
render: ->
|
||||
app.layer.drawRegion app.images.speechbubbles, @sprite, app.game.mouseX+5, app.game.mouseY-15 if @visible
|
||||
switch @positioning
|
||||
when 'mouse'
|
||||
x = app.game.mouseX+5
|
||||
y = app.game.mouseY-15
|
||||
when 'fixed'
|
||||
x = @x
|
||||
y = @y
|
||||
|
||||
app.layer.drawRegion app.images.speechbubbles, @sprite, x, y if @visible
|
Loading…
Reference in a new issue