Made updatePosition use getWorldPosition

This commit is contained in:
Akaza Akari 2014-03-05 19:54:58 -08:00
parent 99f43028a0
commit 51d7bd656d

View file

@ -197,12 +197,9 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
updatePosition: ->
return unless @thang?.pos and @options.camera?
wop = @getWorldPosition()
[p0, p1] = [@lastPos, @thang.pos]
if bobOffset = @getBobOffset()
p1 = p1.copy?() or _.clone(p1)
p1.z += bobOffset
return if p0 and p0.x is p1.x and p0.y is p1.y and p0.z is p1.z and not @options.camera.tweeningZoomTo
wop = x: p1.x, y: p1.y, z: if @thang.isLand then 0 else p1.z - @thang.depth / 2
sup = @options.camera.worldToSurface wop
[@displayObject.x, @displayObject.y] = [sup.x, sup.y]
@lastPos = p1.copy?() or _.clone(p1)