Trying to make a splash screen which appears, lasts a few seconds, then disappears and loads the next state but I can’t seem to get the timing function to work. Any help?
var splashState = {
preload: function () {
// Add a 'loading...' label on the screen
var loadingLabel = game.add.text(game.world.centerX, 150, 'SUPER COOL GAMES',
{ font: '30px Arial', fill: '#ffffff' });
//set an anchor to the loading Label
loadingLabel.anchor.setTo(0.5, 0.5);
},
create: function() {
// Go to the menu state
game.state.start(‘menu’);
setTimeout(function () {
//game.state.start("GameMenu");
}, 4000);
}
};