JSFiddle - React, Tailwind, and code Playground
by shohan4556
HTML
<script src="//cdn.jsdelivr.net/phaser/2.4.4/phaser.min.js"></script>
JavaScript
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', {
preload: preload,
create: create
});
var dude1;
var dude2;
function preload() {
game.load.image('dude', 'http://examples.phaser.io/assets/sprites/phaser-dude.png');
}
function create() {
// Phaser.Physics.ARCADE
game.physics.startSystem(Phaser.Physics.ARCADE);
dude1 = game.add.sprite(0, game.world.centerY - 50, 'dude');
game.physics.enable(dude1, Phaser.Physics.ARCADE);
dude1.body.velocity.x = 10;
game.add.text(0, game.world.centerY, 'Phaser.Physics.ARCADE', {fill: '#fff'});
// Tween
dude2 = game.add.sprite(0, game.world.centerY + 50, 'dude');
game.add.tween(dude2).to({x: 800}, 80000, Phaser.Easing.Linear.None, false, 0, 0, false).start();
game.add.text(0, game.world.centerY + 95, 'Tween', {fill: '#fff'});
}
Phaser.Stage.prototype.visibilityChange = () => {
if (this.disableVisibilityChange) {
this.game.stage.disableVisibilityChange = true;
}
};
game.config.forceSetTimeOut = true;