mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
41 lines
898 B
JavaScript
41 lines
898 B
JavaScript
|
|
var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create, update: update });
|
|
|
|
var background;
|
|
var filter;
|
|
|
|
function preload() {
|
|
|
|
game.load.image('phaser', 'assets/sprites/phaser.png');
|
|
game.load.image('texture', 'assets/textures/ooze.png');
|
|
game.load.script('filter', '../filters/Tunnel.js');
|
|
|
|
}
|
|
|
|
function create() {
|
|
|
|
background = game.add.sprite(0, 0, 'texture');
|
|
background.width = 800;
|
|
background.height = 600;
|
|
|
|
filter = game.add.filter('Tunnel', 800, 600, background.texture);
|
|
|
|
// You have the following value to play with (default value is 2.0):
|
|
filter.origin = 1.0;
|
|
|
|
background.filters = [filter];
|
|
|
|
var logo = game.add.sprite(game.world.centerX, game.world.centerY, 'phaser');
|
|
logo.anchor.setTo(0.5, 0.5);
|
|
|
|
}
|
|
|
|
function update() {
|
|
|
|
filter.update();
|
|
|
|
// Uncomment for coolness :)
|
|
filter.origin = filter.origin + 0.001;
|
|
|
|
}
|