Final release 1.1.4 examples finished.

This commit is contained in:
photonstorm
2014-02-05 16:55:02 +00:00
parent 02b75b9e23
commit e7a9b96d27
26 changed files with 2338 additions and 936 deletions
+2 -2
View File
@@ -26,14 +26,14 @@ function create() {
sprite2.name = 'yellow';
sprite2.body.rebound = false;
sprite2.body.velocity.x = -200;
game.add.tween(sprite.scale).to( { x: 3, y: 3 }, 2000, Phaser.Easing.Linear.None, true, 0, 1000, true);
}
function update() {
sprite2.body.velocity.x = -200;
game.physics.collide(sprite, sprite2);
}
+58
View File
@@ -0,0 +1,58 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
game.load.spritesheet('gameboy', 'assets/sprites/gameboy_seize_color_40x60.png', 40, 60);
game.load.image('atari', 'assets/sprites/atari130xe.png');
}
var sprite;
var sprite2;
var sprite3;
function create() {
game.stage.backgroundColor = '#124184';
// In this example the little Gameboy sprite can pass through the top/bottom of the Atari sprite
// Because it's set to ignore collisions on its top/bottom faces.
sprite = game.add.sprite(300, 200, 'atari');
sprite.name = 'atari';
sprite.body.collideWorldBounds = true;
sprite.body.checkCollision.up = false;
sprite.body.checkCollision.down = false;
sprite.body.immovable = true;
sprite2 = game.add.sprite(350, 400, 'gameboy', 2);
sprite2.name = 'gameboy';
sprite2.body.collideWorldBounds = true;
sprite2.body.bounce.setTo(1, 1);
sprite3 = game.add.sprite(0, 210, 'gameboy', 4);
sprite3.name = 'gameboy2';
sprite3.body.collideWorldBounds = true;
sprite3.body.bounce.setTo(1, 1);
sprite2.body.velocity.y = -200;
sprite3.body.velocity.x = 200;
}
function update() {
game.physics.collide(sprite, sprite2);
game.physics.collide(sprite, sprite3);
}
function render() {
// game.debug.renderBodyInfo(sprite, 16, 24);
game.debug.renderPhysicsBody(sprite.body);
game.debug.renderPhysicsBody(sprite2.body);
}
+1
View File
@@ -35,6 +35,7 @@ function create() {
// Here we'll create some chillis which the player can pick-up. They are still part of the same Group.
var c = group.create(game.rnd.integerInRange(100, 770), game.rnd.integerInRange(0, 570), 'veggies', 17);
c.name = 'chilli' + i;
c.body.immovable = true;
}
cursors = game.input.keyboard.createCursorKeys();