1.0.3 release - fixed Text and Bitmap Fonts, Animation documentation and more examples

This commit is contained in:
Richard Davey
2013-09-17 16:50:47 +01:00
parent f4734b1143
commit 3c5ea01e09
29 changed files with 1253 additions and 392 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
$title = "Sprite Sheet";
require('../head.php');
?>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create });
function preload() {
// 37x45 is the size of each frame
// There are 18 frames in the PNG - you can leave this value blank if the frames fill up the entire PNG, but in this case there are some
// blank frames at the end, so we tell the loader how many to load
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
}
function create() {
var mummy = game.add.sprite(300, 200, 'mummy');
// Here we add a new animation called 'walk'
// Because we didn't give any other parameters it's going to make an animation from all available frames in the 'mummy' sprite sheet
mummy.animations.add('walk');
// And this starts the animation playing by using its key ("walk")
// 30 is the frame rate (30fps)
// true means it will loop when it finishes
mummy.animations.play('walk', 30, true);
}
})();
</script>
<?php
require('../foot.php');
?>
+38
View File
@@ -0,0 +1,38 @@
<?php
$title = "Animation from a Texture Atlas";
require('../head.php');
?>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create });
function preload() {
game.load.atlasJSONHash('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
}
function create() {
// This sprite is using a texture atlas for all of its animation data
var bot = game.add.sprite(200, 200, 'bot');
// Here we add a new animation called 'run'
// We haven't specified any frames because it's using every frame in the texture atlas
bot.animations.add('run');
// And this starts the animation playing by using its key ("run")
// 15 is the frame rate (15fps)
// true means it will loop when it finishes
bot.animations.play('run', 15, true);
}
})();
</script>
<?php
require('../foot.php');
?>