diff --git a/Tests/assets/sprites/asteroids_ship_white.png b/Tests/assets/sprites/asteroids_ship_white.png new file mode 100644 index 00000000..6863fafd Binary files /dev/null and b/Tests/assets/sprites/asteroids_ship_white.png differ diff --git a/Tests/assets/tests/blue-circle.png b/Tests/assets/tests/blue-circle.png new file mode 100644 index 00000000..3599ff19 Binary files /dev/null and b/Tests/assets/tests/blue-circle.png differ diff --git a/Tests/assets/tests/magenta-circle.png b/Tests/assets/tests/magenta-circle.png new file mode 100644 index 00000000..f94db91c Binary files /dev/null and b/Tests/assets/tests/magenta-circle.png differ diff --git a/Tests/assets/tests/radar-surface.png b/Tests/assets/tests/radar-surface.png new file mode 100644 index 00000000..9df7ed5f Binary files /dev/null and b/Tests/assets/tests/radar-surface.png differ diff --git a/Tests/assets/tests/yellow-circle.png b/Tests/assets/tests/yellow-circle.png new file mode 100644 index 00000000..5f7ad7b6 Binary files /dev/null and b/Tests/assets/tests/yellow-circle.png differ diff --git a/Tests/cameras/camera fade.js b/Tests/cameras/camera fade.js new file mode 100644 index 00000000..42ba6cf1 --- /dev/null +++ b/Tests/cameras/camera fade.js @@ -0,0 +1,35 @@ +/// +(function () { + var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render); + + var circle1, circle2, circle3; + var fx; + + function init() { + game.world.setSize(800, 600, true); + game.load.image('blue', 'assets/tests/blue-circle.png'); + game.load.image('yellow', 'assets/tests/yellow-circle.png'); + game.load.image('magenta', 'assets/tests/magenta-circle.png'); + + game.load.start(); + } + function create() { + circle1 = game.add.sprite(114, 34, 'blue'); + circle2 = game.add.sprite(426, 86, 'yellow'); + circle3 = game.add.sprite(221, 318, 'magenta'); + + circle1.input.start(0, false, true); + + fx = game.camera.fx.add(Phaser.FX.Camera.Shake); + } + function update() { + if (circle1.input.justReleased(0, 20)) { + console.log('pressed'); + fx.start(0.05, 0.5, function() { + console.log('fin'); + }); + } + } + function render() { + } +})(); diff --git a/Tests/cameras/camera texture.js b/Tests/cameras/camera texture.js new file mode 100644 index 00000000..5608b2e6 --- /dev/null +++ b/Tests/cameras/camera texture.js @@ -0,0 +1,47 @@ +/// +(function () { + var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render); + + var radar; + var ships = []; + + var button; + + function init() { + game.world.setSize(800, 600, true); + game.load.image('radar-surface', 'assets/tests/radar-surface.png'); + game.load.image('ship', 'assets/sprites/asteroids_ship_white.png'); + game.load.image('enemy-ship', 'assets/sprites/asteroids_ship.png'); + + game.load.image('button', 'assets/tests/320x200.png'); + + game.load.start(); + } + function create() { + for (var i = 0; i < 4; i++) { + ships.push(game.add.sprite(100 + i * 10, 300 + i * 16, 'ship')); + } + ships.push(game.add.sprite(160, 320, 'enemy-ship')); + radar = game.add.sprite(0, 0, 'radar-surface'); + + game.camera.setSize(400, 600); + var camera2 = game.add.camera(0, 0, 400, 600); + camera2.x = 400; + + button = game.add.sprite(500, 100, 'button'); + button.input.start(0, false, true); + } + function update() { + if (button.input.justReleased(0, 20)) { + } + + for (var i = 0; i < ships.length; i++) { + ships[i].x += 1; + if (ships[i].x > 400) { + ships[i].x = 40; + } + } + } + function render() { + } +})(); diff --git a/Tests/cameras/edit-template.js b/Tests/cameras/edit-template.js new file mode 100644 index 00000000..ab18e7aa --- /dev/null +++ b/Tests/cameras/edit-template.js @@ -0,0 +1,47 @@ +/// +(function () { + var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render); + + var circle1, circle2, circle3; + var button; + + function init() { + game.world.setSize(800, 600, true); + game.load.image('blue', 'assets/tests/blue-circle.png'); + game.load.image('yellow', 'assets/tests/yellow-circle.png'); + game.load.image('magenta', 'assets/tests/magenta-circle.png'); + + game.load.image('button', 'assets/tests/320x200.png'); + + game.load.start(); + } + function create() { + circle1 = game.add.sprite(114, 34, 'blue'); + circle2 = game.add.sprite(426, 86, 'yellow'); + circle3 = game.add.sprite(221, 318, 'magenta'); + + circle1.input.start(0, false, true); + circle1.input.enableDrag(false); + + circle2.input.start(0, false, true); + circle2.input.enableDrag(false); + + circle3.input.start(0, false, true); + circle3.input.enableDrag(false); + + button = game.add.sprite(500, 100, 'button'); + button.input.start(0, false, true); + } + function update() { + if (button.input.justReleased(0, 20)) { + console.log('<1>: (' + circle1.x + ', ' + circle1.y + ')'); + console.log('<2>: (' + circle2.x + ', ' + circle2.y + ')'); + console.log('<3>: (' + circle3.x + ', ' + circle3.y + ')'); + } + } + function render() { + circle1.input.renderDebugInfo(32, 32); + circle2.input.renderDebugInfo(32, 160); + circle3.input.renderDebugInfo(32, 296); + } +})();