mirror of
https://github.com/wassname/phaser.git
synced 2026-09-09 11:28:47 +08:00
StateManager improving in leaps and bounds.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>phaser.js - a new beginning</title>
|
||||
<?php
|
||||
require('js.php');
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var state = {
|
||||
|
||||
preload: function() {
|
||||
|
||||
console.log('state preload called');
|
||||
game.load.image('rememberMe', 'assets/pics/remember-me.jpg');
|
||||
game.load.text('copyright', 'assets/warning - copyright.txt');
|
||||
|
||||
},
|
||||
|
||||
create: function() {
|
||||
|
||||
console.log('state create called');
|
||||
|
||||
// Let's try adding an image to the DOM
|
||||
document.body.appendChild(game.cache.getImage('rememberMe'));
|
||||
|
||||
// And some text
|
||||
var para = document.createElement('pre');
|
||||
para.innerHTML = game.cache.getText('copyright');
|
||||
document.body.appendChild(para);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.RENDERER_AUTO, '');
|
||||
|
||||
// In this instance we'll change to the state ourselves rather than pass it in the game constructor
|
||||
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user