Skip to content

Instantly share code, notes, and snippets.

@dariuszparys
Created January 23, 2015 08:24
Show Gist options
  • Save dariuszparys/d4e3e4a4050703f6b09f to your computer and use it in GitHub Desktop.
Save dariuszparys/d4e3e4a4050703f6b09f to your computer and use it in GitHub Desktop.
/// <reference path="phaser.min.js" />
//var phaserGame = new Phaser.Game(800, 600, Phaser.CANVAS, "demo", { preload: preload, create: create });
//function preload() {
//}
//function create() {
// var text = phaserGame.add.text(200, 200, "Hallo, ich bin Phaser", { font: "30px Arial", fill: "#ff00ff" });
// text.anchor.setTo(0.5, 0.5);
//}
var Welcome = function () {
};
Welcome.prototype = {
preload: function () {
},
create: function () {
var text = game.add.text(200, 200, "Hallo, ich bin Phaser", { font: "30px Arial", fill: "#ff00ff" });
text.anchor.setTo(0.5, 0.5);
game.time.events.add(Phaser.Timer.SECOND * 2, this.nextStatePlease);
},
nextStatePlease: function () {
game.state.start("Game", GameState);
}
}
var GameState = function () { };
GameState.prototype = {
preload: function () {
},
create: function () {
var text = game.add.text(200, 200, "Das Spiel", { font: "60px Arial", fill: "#ffff00" });
text.anchor.setTo(0.5, 0.5);
},
update: function () {
}
}
var game = new Phaser.Game(800, 600, Phaser.AUTO);
game.state.add("Welcome", Welcome, true);
game.state.add("Game", GameState);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment