Skip to content

Commit a50a8d3

Browse files
committed
Added support for scrollFactor to the BuildGameObject.
1 parent 2aadd2a commit a50a8d3

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

v3/src/gameobjects/BuildGameObject.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ var BuildGameObject = function (state, gameObject, config)
3030
gameObject.scaleY = GetAdvancedValue(scale, 'y', 1);
3131
}
3232

33+
// ScrollFactor
34+
// Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }}
35+
36+
var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null);
37+
38+
if (typeof scrollFactor === 'number')
39+
{
40+
gameObject.setScrollFactor(scrollFactor);
41+
}
42+
else if (scrollFactor !== null)
43+
{
44+
gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1);
45+
gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1);
46+
}
47+
3348
// Rotation
3449

3550
gameObject.rotation = GetAdvancedValue(config, 'rotation', 0);

0 commit comments

Comments
 (0)