2014-02-28 03:09:04 +00:00
|
|
|
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
|
2014-02-07 02:31:29 +00:00
|
|
|
|
|
|
|
function preload() {
|
|
|
|
|
2014-02-28 03:55:06 +00:00
|
|
|
game.load.image('pic', '/phaser/examples/assets/pics/1984-nocooper-space.png');
|
2014-02-07 02:31:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var image;
|
|
|
|
var bmd;
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
2014-02-28 03:55:06 +00:00
|
|
|
console.log('pic box 11');
|
2014-02-07 02:31:29 +00:00
|
|
|
|
2014-02-28 03:55:06 +00:00
|
|
|
game.add.sprite(0, 0, 'pic');
|
2014-02-07 02:31:29 +00:00
|
|
|
|
2014-02-28 03:55:06 +00:00
|
|
|
bmd = game.add.bitmapData(800, 600);
|
|
|
|
bmd.context.fillStyle = 'rgba(255,0,0,1)';
|
|
|
|
bmd.context.fillRect(0, 0, 300, 100);
|
2014-02-07 02:31:29 +00:00
|
|
|
|
2014-02-28 03:55:06 +00:00
|
|
|
image = game.add.image(0, 100, bmd);
|
2014-02-07 02:31:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
|
2014-02-28 03:55:06 +00:00
|
|
|
bmd.context.fillRect(game.input.x, game.input.y, 8, 8);
|
2014-02-07 02:31:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
|
2014-02-28 03:55:06 +00:00
|
|
|
game.debug.renderText(game.input.x, 32, 32);
|
2014-02-07 02:31:29 +00:00
|
|
|
|
|
|
|
}
|