   hasCargo: -> @next.hasCargo()
   getFacing: -> @next.getFacing()
   doHitWall: -> @next.doHitWall()
+  setAnimation: (anim) -> @next.setAnimation(anim)
+  setTexture: (tex) -> @next.setTexture(tex)
 
   seppuku: -> World.del(this)
 

@DebugLateralMovementAdapter = DebugLateralMovementAdapter
@FixedLocationAdapter = FixedLocationAdapter
@LimitedLifespanAdapter = LimitedLifespanAdapter


  doDetach: ->
    @stage.removeChild @sprite
    @next.doDetach()

class AnimationAdapter extends EntityAdapter
  constructor: (@period, @animations, @next) ->
    @currentAnimation = null
    @phase = Math.random() * 60*60*24*365

  setAnimation: (anim) ->
    @currentAnimation = anim

  doTick: ->
    if @currentAnimation?
      frames = @animations[@currentAnimation]
      frame = Math.floor((@phase + unixTime()) / @period) % frames.length
      @setTexture frames[frame]
    @next.doTick()

class DebugLateralMovementAdapter extends EntityAdapter
  doMoveLeft: (en) ->
