mirror of
https://github.com/photonstorm/phaser
synced 2024-12-11 22:03:09 +00:00
30fbbec675
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.
47 lines
786 B
JavaScript
47 lines
786 B
JavaScript
|
|
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() {
|
|
|
|
|
|
}
|