|
14 | 14 | function create() { |
15 | 15 | // background sky, which does not move at all |
16 | 16 | game.add.sprite(0, 0, 'sky') |
17 | | - .scrollFactor.setTo(0, 0); |
| 17 | + .transform.scrollFactor.setTo(0, 0); |
18 | 18 |
|
19 | 19 | // clouds with different scroll factor which moves slower than camera |
20 | 20 | game.add.sprite(200, 120, 'cloud0') |
21 | | - .scrollFactor.setTo(0.3, 0.3); |
| 21 | + .transform.scrollFactor.setTo(0.3, 0.3); |
22 | 22 | game.add.sprite(-60, 120, 'cloud1') |
23 | | - .scrollFactor.setTo(0.5, 0.3); |
| 23 | + .transform.scrollFactor.setTo(0.5, 0.3); |
24 | 24 | game.add.sprite(900, 170, 'cloud2') |
25 | | - .scrollFactor.setTo(0.7, 0.3); |
| 25 | + .transform.scrollFactor.setTo(0.7, 0.3); |
26 | 26 |
|
27 | 27 | // forground objects which moves equal or faster than camera |
28 | 28 | game.add.sprite(0, 360, 'ground') |
29 | | - .scrollFactor.setTo(0.5, 0.5); |
| 29 | + .transform.scrollFactor.setTo(0.5, 0.5); |
30 | 30 | game.add.sprite(0, 400, 'river') |
31 | | - .scrollFactor.setTo(1.3, 1.3); |
| 31 | + .transform.scrollFactor.setTo(1.3, 1.3); |
32 | 32 | } |
33 | 33 | function update() { |
34 | 34 | if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { |
35 | | - game.camera.scroll.x -= 3; |
| 35 | + game.camera.x -= 3; |
36 | 36 | } |
37 | 37 | else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { |
38 | | - game.camera.scroll.x += 3; |
| 38 | + game.camera.x += 3; |
39 | 39 | } |
40 | 40 | } |
41 | 41 | function render() { |
|
0 commit comments