Tweaked when and how we shift the bounds of imported sprites. For things like Anya, especially Anya's attack, it wasn't working correctly.
This commit is contained in:
parent
abf28c2c19
commit
6bd6b2eea2
1 changed files with 9 additions and 8 deletions
|
@ -63,7 +63,13 @@ module.exports = class SpriteParser
|
||||||
instructions.push {t: c.t, gn: c.gn}
|
instructions.push {t: c.t, gn: c.gn}
|
||||||
break
|
break
|
||||||
@addContainer {c: instructions, b: container.bounds}, container.name
|
@addContainer {c: instructions, b: container.bounds}, container.name
|
||||||
for movieClip in movieClips
|
for movieClip, index in movieClips
|
||||||
|
if index is 0
|
||||||
|
for bounds in movieClip.frameBounds
|
||||||
|
bounds[0] -= @width / 2
|
||||||
|
bounds[1] -= @height / 2
|
||||||
|
movieClip.bounds[0] -= @width / 2
|
||||||
|
movieClip.bounds[1] -= @height / 2
|
||||||
localGraphics = @getGraphicsFromBlock(movieClip, source)
|
localGraphics = @getGraphicsFromBlock(movieClip, source)
|
||||||
[shapeKeys, localShapes] = @getShapesFromBlock movieClip, source
|
[shapeKeys, localShapes] = @getShapesFromBlock movieClip, source
|
||||||
localContainers = @getContainersFromMovieClip movieClip, source, true
|
localContainers = @getContainersFromMovieClip movieClip, source, true
|
||||||
|
@ -174,7 +180,7 @@ module.exports = class SpriteParser
|
||||||
frameBoundsSource = @subSourceFromRange frameBoundsRange, source
|
frameBoundsSource = @subSourceFromRange frameBoundsRange, source
|
||||||
if frameBoundsSource.search(/\[rect/) is -1 # some other statement; we don't have multiframe bounds
|
if frameBoundsSource.search(/\[rect/) is -1 # some other statement; we don't have multiframe bounds
|
||||||
console.log 'Didn\'t have multiframe bounds for this movie clip.'
|
console.log 'Didn\'t have multiframe bounds for this movie clip.'
|
||||||
frameBounds = [nominalBounds]
|
frameBounds = [_.clone(nominalBounds)]
|
||||||
else
|
else
|
||||||
lastRect = nominalBounds
|
lastRect = nominalBounds
|
||||||
frameBounds = []
|
frameBounds = []
|
||||||
|
@ -192,12 +198,7 @@ module.exports = class SpriteParser
|
||||||
bounds = [0, 0, 1, 1] # Let's try this.
|
bounds = [0, 0, 1, 1] # Let's try this.
|
||||||
frameBounds.push _.clone bounds
|
frameBounds.push _.clone bounds
|
||||||
else
|
else
|
||||||
frameBounds = [nominalBounds]
|
frameBounds = [_.clone(nominalBounds)]
|
||||||
|
|
||||||
# Subtract half of width/height parsed from lib.properties
|
|
||||||
for bounds in frameBounds
|
|
||||||
bounds[0] -= @width / 2
|
|
||||||
bounds[1] -= @height / 2
|
|
||||||
|
|
||||||
functionExpressions.push {name: name, bounds: nominalBounds, frameBounds: frameBounds, expression: node.parent.parent, kind: kind}
|
functionExpressions.push {name: name, bounds: nominalBounds, frameBounds: frameBounds, expression: node.parent.parent, kind: kind}
|
||||||
@walk ast, null, gatherFunctionExpressions
|
@walk ast, null, gatherFunctionExpressions
|
||||||
|
|
Reference in a new issue