I'm trying to access instance variables from within a nested object ('action'). The only workaround I could find was using a local var ('_') to represent the parent object.
Class Mover
...
Constructor () =>
_ = this
@mode = "wave"
@action= {
wave: ->
_.x = _.ox
_.y = _.oy = Math.cos(window.G.time * _.speed + _.c + _.vary) * _.amp - _.amp * .5
return
jump: ->
_.y = _.oy = Math.min(0,Math.cos(window.G.time*_.speed + _.c * _.vary)) * _.amp - _.amp * .5
_.x = _.ox
return
@loop =>
@action[@mode]()