diff options
| author | Michele Bini <michele.bini@gmail.com> | 2015-10-30 00:30:27 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2015-10-30 00:30:27 (GMT) |
| commit | d18fd2e75228c94bcaee9e743e8f1d0cc604e6e5 (patch) | |
| tree | 9b91ad2a1d42f498eb006ad50dc684abfc3c82d6 | |
| parent | c84cd73774717ab9ec9fad7156acea3bbd9f6d8c (diff) | |
continued...
| -rw-r--r-- | game.html.coffee | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/game.html.coffee b/game.html.coffee index c073f42..372bb63 100644 --- a/game.html.coffee +++ b/game.html.coffee @@ -850,6 +850,8 @@ genPage = -> ctx.fillRect w - 1, 0, 1, h @ @brew 'SeamlessPlane', @ParallaxPlane, -> + @initSeamlessPlane = @init + @frameSeamlessPlane = @frame @withRect = (rx,ry,rw,rh,cb)@> { w, h } = @ if (ex = rx + rw) > w @@ -876,7 +878,6 @@ genPage = -> @withRect (@@random() * @w | 0), (@@random() * @h | 0), s, s >> 2, (x,y,w,h)-> ctx.fillRect x,y,w,h @ - @initSeamlessPlane ?= @SeamlessPlane::init @method 'init', (options)@> { lower, w, h, moltf, colors } = @ if lower? @@ -893,7 +894,6 @@ genPage = -> x = 200 while x-- > 0 @randomStuff() - @frameSeamlessPlane ?= @SeamlessPlane::frame @frame = (t)@> { ctx, moltf } = @ @@ -1088,12 +1088,10 @@ genPage = -> @lower = seafloor @ @ - @bluescape = - __proto__: @SeamlessPlane:: - bluescapeSuper: @SeamlessPlane:: - lower: @waterscape - logzoom: 0 - frame: (t,sx,sy)@> + @bluescape = do(waterscape = @waterscape)=> @SeamlessPlane::spawn -> + @lower = waterscape + @logzoom = 0 + @frame = (t,sx,sy)@> { ctx, w, h } = @ x = @x + sx @@ -1126,7 +1124,7 @@ genPage = -> # t.fillRect 0, 0, 100, 100 # t.clearRect 0, 0, 100, 100 # t.drawImage t, 0, 0, 100, 100, 50, 50, 100, 100 - init: (options)@> + @init = (options)@> { w, h, lower } = @ @w = w @@ -1135,13 +1133,13 @@ genPage = -> lower.w = (w >> 2) * 5 lower.h = (h >> 2) * 5 - @bluescapeSuper.init.call @, options + @initSeamlessPlane options ctx <. @ # ctx.fillStyle = "#0099dd" # ctx.fillRect 0, 0, @w, @h - + @ @setup = -> { time, bluescape, radx, rady } = @ |
