From 4a2ee935778846bfaab7598cfc3ca0f4687cd555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20M=C3=BCller?= Date: Sun, 7 Dec 2014 18:41:33 +0100 Subject: [PATCH] Speech --- notes.org | 1 + public/images/speechbubbles.png | Bin 1646 -> 2141 bytes public/images/speechbubbles.psd | Bin 46604 -> 63683 bytes src/game.coffee | 25 +++++++++++++++++++++++++ src/speechbubble.coffee | 27 ++++++++++++++++++++++++--- 5 files changed, 50 insertions(+), 3 deletions(-) diff --git a/notes.org b/notes.org index b1bf741..4b06934 100644 --- a/notes.org +++ b/notes.org @@ -7,6 +7,7 @@ Title: Entire game on one screen * TODO HUD ** hud: energie progress bar :aaron: +** i key * TODO OUTRO ** win screen \ No newline at end of file diff --git a/public/images/speechbubbles.png b/public/images/speechbubbles.png index 233fb02dbad24b01b3f5e40fec1084dfcc76254f..2254b0cf6e1716a4a9d372feed42b6e63ec6fdd9 100644 GIT binary patch delta 1275 zcmVMeUkfg?1Y!63&$;)g3I#X?fw7bFD|2ad;@ev>|g&} z6Mt~!=AjvMn4MClm%a%^&_owDuU#QO`i= z@^!`DhX!;6`9LTOpd-kyKflnp9&j-PvOz5S1?%2B*et%@SH3tdMpDW2J$V#ZCQ`{V zyb7#UGn9@;h*Gx1CnM#`$w%~To{ zqh*y!D#f?MCZr^jj+9G1GDuU#t{0lwuYalXN5QXJ z{+7$Wk`!u{OQViU@8f#7&Qx+ItB^`aC8QG6oJpmcp`3)$)-BcJQDjxEVbRPq($4-#?KY#SYsTwEmFtjZ8ny0kl#)}Wx}^`O zbrF(V(3)Pz$eq4Q8J!yLd(8B1dskZ2nUYdc`(3JAQ^zc>LzStm8-I6?sJoQ4UfbwY4HRasbp|5L@HUi4y2M1=*SPa8McmmpPwz4F0uU0gIucGQz_>hQhP0> z&JXWPEo~UF#LdgTOI1=Sx13D#%XeuhUGI?p$mMIML+~15bkxvz*4ah_e`t0sH2%gIU^7k{3gT1q!^iJPZpq)95(-lr{l^b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RYP}+8^9mv3-O7d>nI=BdsNmZqjduQ;ppjrDm--7C2Vukj diff --git a/src/game.coffee b/src/game.coffee index 2b57577..fcf42c2 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -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) diff --git a/src/speechbubble.coffee b/src/speechbubble.coffee index d32f2c5..83c5e4c 100644 --- a/src/speechbubble.coffee +++ b/src/speechbubble.coffee @@ -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 \ No newline at end of file + 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 \ No newline at end of file