mirror of
https://github.com/wassname/phaser.git
synced 2026-07-11 00:40:20 +08:00
Tidying up the wip folder and updating pixi.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
var logo;
|
||||
var background;
|
||||
var filter;
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('phaser', 'assets/sprites/phaser2.png');
|
||||
game.load.script('fire', '../filters/Fire.js');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
|
||||
background = game.add.sprite(0, 0);
|
||||
background.width = 800;
|
||||
background.height = 600;
|
||||
|
||||
filter = game.add.filter('Fire', 800, 600);
|
||||
filter.alpha = 0.0;
|
||||
|
||||
background.filters = [filter];
|
||||
|
||||
logo = game.add.sprite(game.world.centerX, game.world.centerY, 'phaser');
|
||||
logo.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.input.onDown.add(removeBackground, this);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
filter.update();
|
||||
|
||||
}
|
||||
|
||||
function removeBackground() {
|
||||
|
||||
console.log('removeBackground');
|
||||
|
||||
// background.destroy();
|
||||
background.removeFilter(filter);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user