This repository has been archived on 2026-05-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
moonlight-skulk/phaser-tutorial/part1.html

46 lines
918 B
HTML
Raw Normal View History

2014-06-09 22:08:29 -07:00
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Phaser - Making your first game, part 1</title>
<script type="text/javascript" src="js/phaser.min.js"></script>
<style type="text/css">
body {
margin: 0;
}
</style>
</head>
<body>
<script type="text/javascript">
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
function preload() {
2014-06-09 22:30:58 -07:00
assets = {
2014-06-09 22:32:00 -07:00
'sky' : ['assets/sky.png'],
'ground' : ['assets/platform.png'],
'star' : ['assets/star.png'],
'dude' : ['assets/dude.png', 32, 48]
2014-06-09 22:30:58 -07:00
};
for (var k in assets) {
if ( assets[k].length == 0 ) {
2014-06-09 22:34:20 -07:00
game.load.image(k, assets[k][0]);
2014-06-09 22:30:58 -07:00
} else {
2014-06-09 22:33:42 -07:00
game.load.spritesheet(k, assets[k][0], assets[k][1], assets[k][2]);
2014-06-09 22:30:58 -07:00
}
}
2014-06-09 22:08:29 -07:00
}
function create() {
2014-06-09 22:30:58 -07:00
game.add.sprite(0, 0, 'star');
2014-06-09 22:08:29 -07:00
}
function update() {
}
</script>
</body>
2014-06-09 22:30:58 -07:00
</html>