mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-24 19:59:53 -04:00
Shapes now handle radial gradient fills. Handled one sprite (new Anya attack) export including initializing a container with movie clip arguments for no apparent reason, so loosened SpriteParser a bit to handle this.
This commit is contained in:
parent
1f3b02440a
commit
994584f13a
3 changed files with 10 additions and 2 deletions
|
@ -96,6 +96,8 @@ module.exports = class SpriteBuilder
|
||||||
shape.graphics.lf shapeData.lf...
|
shape.graphics.lf shapeData.lf...
|
||||||
else if shapeData.fc?
|
else if shapeData.fc?
|
||||||
shape.graphics.f @colorMap[shapeKey] or shapeData.fc
|
shape.graphics.f @colorMap[shapeKey] or shapeData.fc
|
||||||
|
else if shapeData.rf?
|
||||||
|
shape.graphics.rf shapeData.rf...
|
||||||
if shapeData.ls?
|
if shapeData.ls?
|
||||||
shape.graphics.ls shapeData.ls...
|
shape.graphics.ls shapeData.ls...
|
||||||
else if shapeData.sc?
|
else if shapeData.sc?
|
||||||
|
|
|
@ -52,7 +52,7 @@ module.exports = class SpriteParser
|
||||||
container.bounds[0] -= @width / 2
|
container.bounds[0] -= @width / 2
|
||||||
container.bounds[1] -= @height / 2
|
container.bounds[1] -= @height / 2
|
||||||
[shapeKeys, localShapes] = @getShapesFromBlock container, source
|
[shapeKeys, localShapes] = @getShapesFromBlock container, source
|
||||||
localContainers = @getContainersFromMovieClip container, source
|
localContainers = @getContainersFromMovieClip container, source, true # Added true because anya attack was breaking, but might break other imports
|
||||||
addChildArgs = @getAddChildCallArguments container, source
|
addChildArgs = @getAddChildCallArguments container, source
|
||||||
instructions = []
|
instructions = []
|
||||||
for bn in addChildArgs
|
for bn in addChildArgs
|
||||||
|
@ -248,9 +248,13 @@ module.exports = class SpriteParser
|
||||||
if fillCall.callee.property.name is 'lf'
|
if fillCall.callee.property.name is 'lf'
|
||||||
linearGradientFillSource = @subSourceFromRange fillCall.parent.range, source
|
linearGradientFillSource = @subSourceFromRange fillCall.parent.range, source
|
||||||
linearGradientFill = @grabFunctionArguments linearGradientFillSource.replace(/.*?lf\(/, 'lf('), true
|
linearGradientFill = @grabFunctionArguments linearGradientFillSource.replace(/.*?lf\(/, 'lf('), true
|
||||||
|
else if fillCall.callee.property.name is 'rf'
|
||||||
|
radialGradientFillSource = @subSourceFromRange fillCall.parent.range, source
|
||||||
|
radialGradientFill = @grabFunctionArguments radialGradientFillSource.replace(/.*?lf\(/, 'lf('), true
|
||||||
else
|
else
|
||||||
fillColor = fillCall.arguments[0]?.value ? null
|
fillColor = fillCall.arguments[0]?.value ? null
|
||||||
console.error 'What is this?! Not a fill!' unless fillCall.callee.property.name is 'f'
|
callName = fillCall.callee.property.name
|
||||||
|
console.error 'What is this?! Not a fill!', callName unless callName is 'f'
|
||||||
strokeCall = node.parent.parent.parent.parent
|
strokeCall = node.parent.parent.parent.parent
|
||||||
if strokeCall.object.callee.property.name is 'ls'
|
if strokeCall.object.callee.property.name is 'ls'
|
||||||
linearGradientStrokeSource = @subSourceFromRange strokeCall.parent.range, source
|
linearGradientStrokeSource = @subSourceFromRange strokeCall.parent.range, source
|
||||||
|
@ -301,6 +305,7 @@ module.exports = class SpriteParser
|
||||||
shape.ss = strokeStyle if strokeStyle
|
shape.ss = strokeStyle if strokeStyle
|
||||||
shape.fc = fillColor if fillColor
|
shape.fc = fillColor if fillColor
|
||||||
shape.lf = linearGradientFill if linearGradientFill
|
shape.lf = linearGradientFill if linearGradientFill
|
||||||
|
shape.rf = radialGradientFill if radialGradientFill
|
||||||
shape.ls = linearGradientStroke if linearGradientStroke
|
shape.ls = linearGradientStroke if linearGradientStroke
|
||||||
if name.search('shape') isnt -1 and shape.fc is 'rgba(0,0,0,0.451)' and not shape.ss and not shape.sc
|
if name.search('shape') isnt -1 and shape.fc is 'rgba(0,0,0,0.451)' and not shape.ss and not shape.sc
|
||||||
console.log 'Skipping a shadow', name, shape, 'because we\'re doing shadows separately now.'
|
console.log 'Skipping a shadow', name, shape, 'because we\'re doing shadows separately now.'
|
||||||
|
|
|
@ -7,6 +7,7 @@ c.extendNamedProperties ThangTypeSchema # name first
|
||||||
ShapeObjectSchema = c.object {title: 'Shape'},
|
ShapeObjectSchema = c.object {title: 'Shape'},
|
||||||
fc: {type: 'string', title: 'Fill Color'}
|
fc: {type: 'string', title: 'Fill Color'}
|
||||||
lf: {type: 'array', title: 'Linear Gradient Fill'}
|
lf: {type: 'array', title: 'Linear Gradient Fill'}
|
||||||
|
rf: {type: 'array', title: 'Radial Gradient Fill'}
|
||||||
ls: {type: 'array', title: 'Linear Gradient Stroke'}
|
ls: {type: 'array', title: 'Linear Gradient Stroke'}
|
||||||
p: {type: 'string', title: 'Path'}
|
p: {type: 'string', title: 'Path'}
|
||||||
de: {type: 'array', title: 'Draw Ellipse'}
|
de: {type: 'array', title: 'Draw Ellipse'}
|
||||||
|
|
Loading…
Add table
Reference in a new issue