2013-08-29 06:06:16 +00:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>phaser.js - a new beginning</title>
|
|
|
|
<?php
|
|
|
|
require('js.php');
|
|
|
|
?>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
// Your game will work either from within a closure or not, it doesn't matter
|
|
|
|
(function () {
|
|
|
|
|
|
|
|
// In this approach we're simply using functions in the current scope to do what we need
|
2013-08-29 16:20:59 +00:00
|
|
|
var game = new Phaser.Game(800, 600, Phaser.RENDERER_AUTO, '', { preload: preload, create: create });
|
2013-08-29 06:06:16 +00:00
|
|
|
|
|
|
|
function preload() {
|
|
|
|
|
|
|
|
console.log('*** preload called');
|
|
|
|
|
|
|
|
game.load.image('cockpit', 'assets/pics/cockpit.png');
|
|
|
|
game.load.image('rememberMe', 'assets/pics/remember-me.jpg');
|
|
|
|
game.load.image('overdose', 'assets/pics/lance-overdose-loader_eye.png');
|
|
|
|
game.load.text('copyright', 'assets/warning - copyright.txt');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
|
|
|
console.log('*** create called');
|
|
|
|
|
|
|
|
// Let's try adding an image to the DOM
|
|
|
|
document.body.appendChild(game.cache.getImage('cockpit'));
|
|
|
|
document.body.appendChild(game.cache.getImage('overdose'));
|
|
|
|
|
|
|
|
// And some text
|
|
|
|
var para = document.createElement('pre');
|
|
|
|
para.innerHTML = game.cache.getText('copyright');
|
|
|
|
document.body.appendChild(para);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-08-29 13:38:51 +00:00
|
|
|
})();
|
2013-08-29 06:06:16 +00:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|