diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index 5fef799bd..fe8c95b58 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -89,7 +89,10 @@ module.exports = Surface = class Surface extends CocoClass @dimmer?.destroy() @stage.clear() @musicPlayer?.destroy() - + @stage.removeEventListener 'stagemousemove', @onMouseMove + @stage.removeEventListener 'stagemousedown', @onMouseDown + @stage.removeAllEventListeners() + setWorld: (@world) -> @worldLoaded = true @world.getFrame(Math.min(@getCurrentFrame(), @world.totalFrames - 1)).restoreState() unless @options.choosing diff --git a/app/lib/world/GoalManager.coffee b/app/lib/world/GoalManager.coffee index 12d2fbe80..c48ed7d08 100644 --- a/app/lib/world/GoalManager.coffee +++ b/app/lib/world/GoalManager.coffee @@ -46,7 +46,7 @@ module.exports = class GoalManager extends CocoClass 'world:thang-collected-item': 'onThangCollectedItem' 'world:ended': 'onWorldEnded' - onLevelRestarted: => + onLevelRestarted: -> @goals = [] @goalStates = {} @userCodeMap = {} @@ -55,12 +55,12 @@ module.exports = class GoalManager extends CocoClass # INTERFACE AND LIFETIME OVERVIEW # main instance receives goal updates from the script manager - onAddGoals: (e) => + onAddGoals: (e) -> return unless e.worldName is @world.name goals = e.goals @addGoal(goal) for goal in goals - onRemoveGoals: (e) => + onRemoveGoals: (e) -> if e.goal in @goals @goals.remove(e.goal) delete @goalStates[e.goal] @@ -88,7 +88,7 @@ module.exports = class GoalManager extends CocoClass # main instance gets them and updates their existing goal states, # passes the word along - onNewWorldCreated: (e) => + onNewWorldCreated: (e) -> @updateGoalStates(e.goalStates) if e.goalStates? @world = e.world