mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-20 18:10:44 -04:00
Fixed the target mark.
This commit is contained in:
parent
8ae14e21ae
commit
9ace31d391
2 changed files with 9 additions and 6 deletions
app/lib/surface
|
@ -344,12 +344,12 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
angle = 180 - angle if angle > 90
|
||||
scaleX = 0.5 + 0.5 * (90 - angle) / 90
|
||||
|
||||
console.error "No thang for", @ unless @thang
|
||||
# console.error "No thang for", @ unless @thang
|
||||
# TODO: support using scaleFactorX/Y from the thang object
|
||||
@imageObject.scaleX = @baseScaleX * @scaleFactor * scaleX
|
||||
@imageObject.scaleY = @baseScaleY * @scaleFactor * scaleY
|
||||
|
||||
if (@thang.scaleFactor or 1) isnt @targetScaleFactor
|
||||
if @thang and (@thang.scaleFactor or 1) isnt @targetScaleFactor
|
||||
createjs.Tween.removeTweens(@)
|
||||
createjs.Tween.get(@).to({scaleFactor:@thang.scaleFactor or 1}, 2000, createjs.Ease.elasticOut)
|
||||
@targetScaleFactor = @thang.scaleFactor or 1
|
||||
|
|
|
@ -201,7 +201,8 @@ module.exports = class Mark extends CocoClass
|
|||
Backbone.Mediator.publish 'sprite:loaded'
|
||||
|
||||
update: (pos=null) ->
|
||||
return false unless @on and @mark and @sprite?.thangType.isFullyLoaded()
|
||||
return false unless @on and @mark
|
||||
return false if @sprite? and not @sprite.thangType.isFullyLoaded()
|
||||
@mark.visible = not @hidden
|
||||
@updatePosition pos
|
||||
@updateRotation()
|
||||
|
@ -250,10 +251,12 @@ module.exports = class Mark extends CocoClass
|
|||
scale = size / {selection: 128, target: 128, repair: 320, highlight: 160}[@name]
|
||||
if @sprite?.thang.spriteName.search(/(dungeon|indoor).wall/i) isnt -1
|
||||
scale *= 2
|
||||
@mark.scaleX = @mark.scaleY = Math.min 1, scale
|
||||
|
||||
if @markSprite?
|
||||
@mark.scaleX *= @markSprite.originalScaleX
|
||||
@mark.scaleY *= @markSprite.originalScaleY
|
||||
@markSprite.scaleFactor = scale
|
||||
@markSprite.updateScale()
|
||||
else
|
||||
@mark.scaleX = @mark.scaleY = Math.min 1, scale
|
||||
if @name in ['selection', 'target', 'repair']
|
||||
@mark.scaleY *= @camera.y2x # code applies perspective
|
||||
|
||||
|
|
Loading…
Reference in a new issue