(scene, gameObject, config)
| 25 | * @return {Phaser.GameObjects.GameObject} The built Game Object. |
| 26 | */ |
| 27 | var BuildGameObject = function (scene, gameObject, config) |
| 28 | { |
| 29 | // Position |
| 30 | |
| 31 | gameObject.x = GetAdvancedValue(config, 'x', 0); |
| 32 | gameObject.y = GetAdvancedValue(config, 'y', 0); |
| 33 | gameObject.depth = GetAdvancedValue(config, 'depth', 0); |
| 34 | |
| 35 | // Flip |
| 36 | |
| 37 | gameObject.flipX = GetAdvancedValue(config, 'flipX', false); |
| 38 | gameObject.flipY = GetAdvancedValue(config, 'flipY', false); |
| 39 | |
| 40 | // Scale |
| 41 | // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} |
| 42 | |
| 43 | var scale = GetAdvancedValue(config, 'scale', null); |
| 44 | |
| 45 | if (typeof scale === 'number') |
| 46 | { |
| 47 | gameObject.setScale(scale); |
| 48 | } |
| 49 | else if (scale !== null) |
| 50 | { |
| 51 | gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); |
| 52 | gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); |
| 53 | } |
| 54 | |
| 55 | // ScrollFactor |
| 56 | // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} |
| 57 | |
| 58 | var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); |
| 59 | |
| 60 | if (typeof scrollFactor === 'number') |
| 61 | { |
| 62 | gameObject.setScrollFactor(scrollFactor); |
| 63 | } |
| 64 | else if (scrollFactor !== null) |
| 65 | { |
| 66 | gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); |
| 67 | gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); |
| 68 | } |
| 69 | |
| 70 | // Rotation |
| 71 | |
| 72 | gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); |
| 73 | |
| 74 | var angle = GetAdvancedValue(config, 'angle', null); |
| 75 | |
| 76 | if (angle !== null) |
| 77 | { |
| 78 | gameObject.angle = angle; |
| 79 | } |
| 80 | |
| 81 | // Alpha |
| 82 | |
| 83 | gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); |
| 84 |
no test coverage detected
searching dependent graphs…