BitmapData.addTo removed and enhanced BitmapData.add so it can accept either a single Sprite/Image or an Array of them.

BitmapData has had all of the EaselJS functions removed. It was just taking up space and you can do it all via BitmapData.context directly.
Camera following now working again.
This commit is contained in:
photonstorm
2014-02-13 14:19:41 +00:00
parent 9d6d3127ad
commit 30fbbec675
7 changed files with 135 additions and 973 deletions
+52
View File
@@ -0,0 +1,52 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
game.load.image('box', 'assets/sprites/block.png');
}
var cursors;
var sprite;
function create() {
game.world.setBounds(0, 0, 1920, 1200);
game.add.image(0, 0, 'backdrop');
sprite = game.add.sprite(300, 300, 'box');
game.camera.follow(sprite);
cursors = game.input.keyboard.createCursorKeys();
}
function update() {
if (cursors.left.isDown)
{
sprite.x -= 8;
}
else if (cursors.right.isDown)
{
sprite.x += 8;
}
if (cursors.up.isDown)
{
sprite.y -= 8;
}
else if (cursors.down.isDown)
{
sprite.y += 8;
}
}
function render() {
}
+47
View File
@@ -0,0 +1,47 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
game.load.image('box', 'assets/sprites/block.png');
}
var cursors;
function create() {
game.world.setBounds(0, 0, 1920, 1200);
game.add.sprite(0, 0, 'backdrop');
cursors = game.input.keyboard.createCursorKeys();
}
function update() {
if (cursors.left.isDown)
{
game.camera.x -= 8;
}
else if (cursors.right.isDown)
{
game.camera.x += 8;
}
if (cursors.up.isDown)
{
game.camera.y -= 8;
}
else if (cursors.down.isDown)
{
game.camera.y += 8;
}
}
function render() {
}
+1 -1
View File
@@ -22,7 +22,7 @@ function px2p(v) {
function create() {
// game.world.setBounds(0, 0, 1920, 1200);
game.world.setBounds(0, 0, 1920, 1200);
game.add.sprite(0, 0, 'backdrop');
game.physics.onBodyAdded.add(addedToWorld, this);