Permalink
Browse files

add eye pain

  • Loading branch information...
1 parent ceae5a3 commit 36346b302eac5fbe7d5780e3aac550fa255c2597 @leafo committed Apr 19, 2015
Showing with 27 additions and 1 deletion.
  1. +1 −0 emitters.moon
  2. +24 −1 face.moon
  3. +2 −0 game.moon
  4. BIN images/adit-pain.png
View
@@ -11,6 +11,7 @@ class ThreshEmitter extends TextEmitter
with p = TextParticle @str, ...
p.dscale = 1
p.dspin = math.random!
+ p.scale = 1.5
vr = (random_normal! - 0.5) * 2
p.vel = Vec2d(0,-100 + -80 * vr)\random_heading 30
View
@@ -127,7 +127,13 @@ class Eye extends Box
class Face extends Box
- lazy sprite: => imgfy "images/adit.png"
+ lazy {
+ sprite: => imgfy "images/adit.png"
+ pain_sprite: => Spriter "images/adit-pain.png"
+ }
+
+ pain_left: "28,86,29,17"
+ pain_right: "85,85,32,17"
eye_w: 20
eye_h: 10
@@ -161,6 +167,12 @@ class Face extends Box
eye_offset: (col=1) =>
@eyes[col]\center!
+ on_eye_pain: (col) =>
+ name = col == 1 and "left" or "right"
+ @["#{name}_hurts"] = Sequence ->
+ wait 0.5
+ @["#{name}_hurts"] = nil
+
draw: =>
if DEBUG
g.rectangle "line", @unpack!
@@ -171,6 +183,13 @@ class Face extends Box
g.translate -@tongue.x, -@tongue.y
@sprite\draw @x, @y
+
+ if @left_hurts
+ @pain_sprite\draw @pain_left, @x + 28, @y + 86
+
+ if @right_hurts
+ @pain_sprite\draw @pain_right, @x + 85, @y + 85
+
g.pop!
for eye in *@eyes
@@ -180,6 +199,10 @@ class Face extends Box
update: (dt) =>
@tongue\update dt
+
+ @left_hurts\update dt if @left_hurts
+ @right_hurts\update dt if @right_hurts
+
for eye in *@eyes
eye\update dt
View
@@ -84,6 +84,8 @@ class TrackField extends Box
nx, ny = @note_position note
@particles\add BreakEmitter note, @, nx,ny
+ @face\on_eye_pain note.col
+
if from_hit
@particles\add ThreshEmitter "miss", @, nx,ny
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 36346b3

Please sign in to comment.