diff --git a/Tests/assets/tests/cloud-big-2x.png b/Tests/assets/tests/cloud-big-2x.png new file mode 100644 index 00000000..bdc5d1ea Binary files /dev/null and b/Tests/assets/tests/cloud-big-2x.png differ diff --git a/Tests/assets/tests/cloud-big.png b/Tests/assets/tests/cloud-big.png new file mode 100644 index 00000000..b8498800 Binary files /dev/null and b/Tests/assets/tests/cloud-big.png differ diff --git a/Tests/assets/tests/cloud-narrow-2x.png b/Tests/assets/tests/cloud-narrow-2x.png new file mode 100644 index 00000000..3d2a65e8 Binary files /dev/null and b/Tests/assets/tests/cloud-narrow-2x.png differ diff --git a/Tests/assets/tests/cloud-narrow.png b/Tests/assets/tests/cloud-narrow.png new file mode 100644 index 00000000..b2f11230 Binary files /dev/null and b/Tests/assets/tests/cloud-narrow.png differ diff --git a/Tests/assets/tests/cloud-small-2x.png b/Tests/assets/tests/cloud-small-2x.png new file mode 100644 index 00000000..b2fe625b Binary files /dev/null and b/Tests/assets/tests/cloud-small-2x.png differ diff --git a/Tests/assets/tests/cloud-small.png b/Tests/assets/tests/cloud-small.png new file mode 100644 index 00000000..14f5f8ae Binary files /dev/null and b/Tests/assets/tests/cloud-small.png differ diff --git a/Tests/assets/tests/ground-2x.png b/Tests/assets/tests/ground-2x.png new file mode 100644 index 00000000..9588e6b2 Binary files /dev/null and b/Tests/assets/tests/ground-2x.png differ diff --git a/Tests/assets/tests/ground.png b/Tests/assets/tests/ground.png new file mode 100644 index 00000000..c4e678ec Binary files /dev/null and b/Tests/assets/tests/ground.png differ diff --git a/Tests/assets/tests/river-2x.png b/Tests/assets/tests/river-2x.png new file mode 100644 index 00000000..abed28ac Binary files /dev/null and b/Tests/assets/tests/river-2x.png differ diff --git a/Tests/assets/tests/river.png b/Tests/assets/tests/river.png new file mode 100644 index 00000000..a9d366b2 Binary files /dev/null and b/Tests/assets/tests/river.png differ diff --git a/Tests/assets/tests/sky-2x.png b/Tests/assets/tests/sky-2x.png new file mode 100644 index 00000000..d7aae77d Binary files /dev/null and b/Tests/assets/tests/sky-2x.png differ diff --git a/Tests/assets/tests/sky.png b/Tests/assets/tests/sky.png new file mode 100644 index 00000000..b187718d Binary files /dev/null and b/Tests/assets/tests/sky.png differ diff --git a/Tests/assets/tiles/ground-tile.png b/Tests/assets/tiles/ground-tile.png new file mode 100644 index 00000000..6455834b Binary files /dev/null and b/Tests/assets/tiles/ground-tile.png differ diff --git a/Tests/cameras/scrollfactor-compare.js b/Tests/cameras/scrollfactor-compare.js new file mode 100644 index 00000000..867ae52e --- /dev/null +++ b/Tests/cameras/scrollfactor-compare.js @@ -0,0 +1,44 @@ +/// +(function () { + var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render); + function init() { + game.world.setSize(1280, 600, true); + game.load.image('ground', 'assets/tests/ground-2x.png'); + game.load.image('river', 'assets/tests/river-2x.png'); + game.load.image('sky', 'assets/tests/sky-2x.png'); + game.load.image('cloud0', 'assets/tests/cloud-big-2x.png'); + game.load.image('cloud1', 'assets/tests/cloud-narrow-2x.png'); + game.load.image('cloud2', 'assets/tests/cloud-small-2x.png'); + game.load.start(); + } + function create() { + // background sky, which does not move at all + game.add.sprite(0, 0, 'sky') + .scrollFactor.setTo(0, 0); + + // clouds with different scroll factor which moves slower than camera + game.add.sprite(200, 120, 'cloud0') + .scrollFactor.setTo(0.3, 0.3); + game.add.sprite(-60, 120, 'cloud1') + .scrollFactor.setTo(0.5, 0.3); + game.add.sprite(900, 170, 'cloud2') + .scrollFactor.setTo(0.7, 0.3); + + // forground objects which moves equal or faster than camera + game.add.sprite(0, 360, 'ground') + .scrollFactor.setTo(0.5, 0.5); + game.add.sprite(0, 400, 'river') + .scrollFactor.setTo(1.3, 1.3); + } + function update() { + if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { + game.camera.scroll.x -= 3; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { + game.camera.scroll.x += 3; + } + } + function render() { + // game.camera.renderDebugInfo(32, 32); + } +})();