mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-26 14:34:58 -05:00
Merge branch 'thanish-move-wizard' of git://github.com/mnmtanish/codecombat into mnmtanish-thanish-move-wizard
This commit is contained in:
commit
bb53942c2c
3 changed files with 35 additions and 5 deletions
|
@ -22,6 +22,7 @@ module.exports = class LevelBus extends Bus
|
|||
'level-show-victory': 'onVictory'
|
||||
'tome:spell-changed': 'onSpellChanged'
|
||||
'tome:spell-created': 'onSpellCreated'
|
||||
'self-wizard:move': 'moveWizard'
|
||||
|
||||
constructor: ->
|
||||
super(arguments...)
|
||||
|
@ -240,3 +241,12 @@ module.exports = class LevelBus extends Bus
|
|||
destroy: ->
|
||||
@session.off 'change:multiplayer', @onMultiplayerChanged, @
|
||||
super()
|
||||
|
||||
moveWizard : (x, y) =>
|
||||
wizardSprite = @getSelfWizard()
|
||||
position = wizardSprite.getCurrentPosition()
|
||||
position.x += x
|
||||
position.y += y
|
||||
wizardSprite.setTarget(position,1000)
|
||||
wizardSprite.updatePosition()
|
||||
Backbone.Mediator.publish 'camera-zoom-to', position
|
||||
|
|
|
@ -42,6 +42,7 @@ module.exports = class Camera extends CocoClass
|
|||
'level:restarted': 'onLevelRestarted'
|
||||
'sprite:mouse-down': 'onMouseDown'
|
||||
'sprite:dragged': 'onMouseDragged'
|
||||
'camera-zoom-to': 'onZoomTo'
|
||||
|
||||
# TODO: Fix tests to not use mainLayer
|
||||
constructor: (@canvasWidth, @canvasHeight, angle=Math.asin(0.75), hFOV=d2r(30)) ->
|
||||
|
@ -308,3 +309,6 @@ module.exports = class Camera extends CocoClass
|
|||
createjs.Tween.removeTweens @
|
||||
@finishTween = null
|
||||
super()
|
||||
|
||||
onZoomTo: (pos) ->
|
||||
@zoomTo(@worldToSurface(pos), @zoom)
|
||||
|
|
|
@ -36,6 +36,10 @@ module.exports = class PlaybackView extends View
|
|||
'⌘+p, p, ctrl+p': 'onTogglePlay'
|
||||
'⌘+[, ctrl+[': 'onScrubBack'
|
||||
'⌘+], ctrl+]': 'onScrubForward'
|
||||
'w, up': 'onMoveUpKey'
|
||||
's, down': 'onMoveDownKey'
|
||||
'a, left': 'onMoveLeftKey'
|
||||
'd, right': 'onMoveRightKey'
|
||||
|
||||
constructor: ->
|
||||
super(arguments...)
|
||||
|
@ -215,3 +219,15 @@ module.exports = class PlaybackView extends View
|
|||
$(window).off('resize', @onWindowResize)
|
||||
@onWindowResize = null
|
||||
super()
|
||||
|
||||
onMoveUpKey: ->
|
||||
Backbone.Mediator.publish 'self-wizard:move', 0, 10
|
||||
|
||||
onMoveDownKey: ->
|
||||
Backbone.Mediator.publish 'self-wizard:move', 0, -10
|
||||
|
||||
onMoveLeftKey: ->
|
||||
Backbone.Mediator.publish 'self-wizard:move', -10, 0
|
||||
|
||||
onMoveRightKey: ->
|
||||
Backbone.Mediator.publish 'self-wizard:move', 10, 0
|
||||
|
|
Loading…
Reference in a new issue