diff --git a/conf.moon b/conf.moon index 6e92a0c..43ef4ad 100644 --- a/conf.moon +++ b/conf.moon @@ -16,7 +16,7 @@ export GAME_CONFIG = { love.conf = (t) -> t.window.width = 200 * GAME_CONFIG.scale - t.window.height = 230 * GAME_CONFIG.scale + t.window.height = 280 * GAME_CONFIG.scale t.title = "the game" t.author = "leafo" diff --git a/emitters.moon b/emitters.moon index 5d32d17..7aca42f 100644 --- a/emitters.moon +++ b/emitters.moon @@ -17,7 +17,7 @@ class ThreshEmitter extends TextEmitter p.accel = @accel p.color = @colors[@str] -class HitEmitter extends Emitter +class BreakEmitter extends Emitter accel: Vec2d 0, 300 count: 5 @@ -51,4 +51,4 @@ class SparkEmitter extends Emitter .vel = Vec2d(0, rand(-120, -150))\random_heading 40 .size = rand 2,6 -{ :HitEmitter, :SparkEmitter, :ThreshEmitter } +{ :BreakEmitter, :SparkEmitter, :ThreshEmitter } diff --git a/game.moon b/game.moon index 282f860..14f294a 100644 --- a/game.moon +++ b/game.moon @@ -5,13 +5,13 @@ import Bin, HList, VList, Label, Border from require "lovekit.ui" import Metronome, VisibilityMeter from require "ui" import Track from require "track" -import HitEmitter, SparkEmitter, ThreshEmitter from require "emitters" +import BreakEmitter, SparkEmitter, ThreshEmitter from require "emitters" import Face, Tongue from require "face" class TrackField extends Box - w: 200 - h: 200 + w: 140 + h: 240 min_delta: 120 @@ -40,21 +40,50 @@ class TrackField extends Box nx, ny = @note_position note - @particles\add HitEmitter note, @, nx, ny - @particles\add SparkEmitter @, nx, ny + @eat_note note thresh = @threshold_for_delta note.hit_delta @particles\add ThreshEmitter thresh, @, nx,ny @game\on_hit_note note + eat_note: (note) => + nx, ny = @note_position note + + spark = @particles\add SparkEmitter @, nx, ny + + local sprite + seq = Sequence -> + tween sprite, 0.2, x: @face.tongue.x, y: @face.tongue.y + tween sprite, 0.1, a: 0 + + sprite = { + a: 1 + x: nx, y: ny + + update: (dt) => + with seq\update dt + spark.x = @x + spark.y = @y + + draw: => + COLOR\pusha 255 * @a + note.sprite\draw note.quad, @x + note.ox, @y + note.oy + COLOR\pop! + + } + @particles\add sprite + -- note might be nil if it was a mis-press on_miss_note: (note, from_hit) => @chain = 0 - if from_hit and note + if note nx, ny = @note_position note - @particles\add ThreshEmitter "miss", @, nx,ny + @particles\add BreakEmitter note, @, nx,ny + + if from_hit + @particles\add ThreshEmitter "miss", @, nx,ny @shake! diff --git a/notes.moon b/notes.moon index b0df18d..773b0a3 100644 --- a/notes.moon +++ b/notes.moon @@ -17,9 +17,10 @@ class Note @sprite\draw @quad, @x + @ox, @y + @oy - g.rectangle "line", - @x - @w/2, @y - @h/2, - @w, @h + if DEBUG + g.rectangle "line", + @x - @w/2, @y - @h/2, + @w, @h class Note1 extends Note diff --git a/ui.moon b/ui.moon index 214b11d..ee5dc17 100644 --- a/ui.moon +++ b/ui.moon @@ -52,9 +52,10 @@ class Bar extends Box class VisibilityMeter extends VList p: 0.5 + w: 140 new: => - @bar = Bar 0,0, 200, 10 + @bar = Bar 0,0, 140, 10 super { Label "visibility"