summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2015-10-29 19:30:06 (GMT)
committerMichele Bini <michele.bini@gmail.com>2015-10-29 19:30:06 (GMT)
commit2fa910b84f5c30b1c1277894eb69f057d4eeab9b (patch)
tree968831b7ade480d4c8571f17239fb8d922c54ec7
parent3a19e01554e9d0c4e459a377d85084d9a22cc5f7 (diff)
continued...
-rw-r--r--game.html.coffee30
1 files changed, 14 insertions, 16 deletions
diff --git a/game.html.coffee b/game.html.coffee
index bec392d..0a56cc9 100644
--- a/game.html.coffee
+++ b/game.html.coffee
@@ -820,23 +820,21 @@ genPage = ->
t.drawImage canvas, -nx, -ny
# t.drawImage canvas, 0, 0, w, h, -nx, -ny, w*pmul, h*pmul
@
- @SeaFloor = do=>
- __proto__: @BoundParallaxPlane::
- SeaFloorProto: @BoundParallaxPlane::
+ @brew 'SeaFloor', @BoundParallaxPlane, ->
# terror: CuteluTerror =
# img: cuteluterror
# zoom: 6
# __proto__: ScaledImg
# color: "#051555"
- seafloorImg: seafloor
- init: (options)@>
+ @seafloorImg = seafloor
+ @method 'init', (options)@>
seafloorImg <. @
# @terror.init(options)
w = seafloorImg.width
h = seafloorImg.height
@w = w
@h = h
- @SeaFloorProto.init.call @, options
+ @initBoundParallaxPlane options
# { color, w, h } = @
# e = @document.createElement "canvas"
# e.width = w
@@ -849,9 +847,10 @@ genPage = ->
ctx.fillRect 0, 0, w, 1
ctx.fillRect 0, 0, 1, h
ctx.fillRect 0, h - 1, w, 1
- ctx.fillRect w - 1, 0, 1, h
- @SeamlessPlane =
- withRect: (rx,ry,rw,rh,cb)@>
+ ctx.fillRect w - 1, 0, 1, h
+ @
+ @brew 'SeamlessPlane', @ParallaxPlane, ->
+ @withRect = (rx,ry,rw,rh,cb)@>
{ w, h } = @
if (ex = rx + rw) > w
if (ey = ry + rh) > h
@@ -868,9 +867,9 @@ genPage = ->
cb rx, 0, rw, ey - h, 0, h - ry
else
cb rx, ry, rw, rh, 0, 0
- __proto__: @ParallaxPlane::
+ @
@WaterPlane = do=>
- waterscapeSuper: waterscapeSuper = @SeamlessPlane
+ waterscapeSuper: waterscapeSuper = @SeamlessPlane::
__proto__: waterscapeSuper
colors: [ "cyan", "blue" ]
randomStuff: @>
@@ -938,8 +937,7 @@ genPage = ->
{ w, o } = p
# throw o
@ctx.drawImage glyphs, o, 0, w + 4, lineHeight, x, y * scale, (w + 4) * scale, lineHeight * scale
- x += (w + 1) * scale
-
+ x += (w + 1) * scale
@narrator = do=>
first: null
last: null
@@ -1067,7 +1065,7 @@ genPage = ->
# @waterscapeSuperFrame.apply @, arguments
# # t.restore()
# logzoom: 0
- @seafloor = __proto__: @SeaFloor
+ @seafloor = new @SeaFloor
@getDepth = @>
r = @seafloor.fy / @seafloor.mfy
r < 0 then 0 else r
@@ -1091,8 +1089,8 @@ genPage = ->
logzoom: 2
lower: @seafloor
@bluescape =
- __proto__: @SeamlessPlane
- bluescapeSuper: @SeamlessPlane
+ __proto__: @SeamlessPlane::
+ bluescapeSuper: @SeamlessPlane::
lower: @waterscape
logzoom: 0
frame: (t,sx,sy)@>