mirror of
https://github.com/wassname/phaser.git
synced 2026-07-08 00:10:32 +08:00
1.0.3 release - fixed Text and Bitmap Fonts, Animation documentation and more examples
This commit is contained in:
@@ -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');
|
||||
?>
|
||||
@@ -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');
|
||||
?>
|
||||
File diff suppressed because one or more lines are too long
@@ -5,69 +5,69 @@
|
||||
</tileset>
|
||||
<layer name="Tile Layer 1" width="64" height="64">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,
|
||||
2,3,4,5,2,6,2,3,6,7,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,2,6,2,3,6,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
19,19,37,19,19,36,19,22,23,24,0,0,0,0,0,0,0,0,0,0,0,18,19,19,37,19,19,36,19,22,23,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
|
||||
19,36,19,19,21,19,19,39,40,41,0,0,0,0,0,0,0,0,0,0,0,35,19,36,19,19,38,19,19,39,40,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
53,54,53,53,55,53,54,55,57,60,0,0,0,0,0,0,0,0,0,0,0,52,53,54,53,53,55,53,54,55,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,19,19,
|
||||
6,2,3,6,7,0,0,0,0,0,0,13,14,0,0,0,0,0,0,13,14,0,0,0,0,1,34,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,19,19,19,19,
|
||||
36,19,22,23,24,0,0,0,0,0,1,30,31,9,0,0,0,0,1,30,31,9,0,0,0,59,55,57,60,0,0,0,0,0,0,47,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,19,19,19,19,19,
|
||||
19,19,39,40,41,0,0,0,0,0,25,19,19,26,0,0,0,0,25,19,19,26,0,0,0,0,0,0,0,0,0,0,0,0,1,64,65,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,
|
||||
20,54,55,57,60,0,0,0,0,0,59,57,53,60,0,0,0,0,59,57,53,60,0,0,0,0,0,0,0,0,0,0,0,0,59,57,56,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,
|
||||
24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
|
||||
43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
43,0,0,0,0,0,0,47,48,0,0,0,0,0,47,48,0,0,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,19,
|
||||
19,9,0,0,0,1,4,64,65,2,3,4,5,2,64,65,3,6,7,0,1,2,2,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,0,19,
|
||||
19,26,0,0,0,18,19,19,19,19,19,37,19,19,36,19,22,23,24,0,18,19,19,24,0,0,0,0,0,0,0,0,0,0,1,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,43,0,0,0,25,19,19,19,19,36,19,19,19,19,19,39,40,41,0,18,19,19,19,9,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,41,0,0,0,42,19,19,19,53,54,53,53,55,53,54,55,57,60,0,59,56,56,56,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
|
||||
19,43,0,0,0,18,19,19,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,
|
||||
19,26,0,0,0,35,19,19,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,66,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
37,26,0,0,0,52,56,56,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,19,
|
||||
19,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,13,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,9,0,0,0,1,19,19,19,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,0,19,
|
||||
19,26,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,2,30,30,31,2,6,7,0,0,13,0,0,0,0,0,0,0,0,59,57,60,0,0,0,42,19,19,19,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,19,
|
||||
19,43,0,0,0,0,0,0,0,0,0,0,0,1,20,21,22,23,19,19,19,19,19,19,19,6,3,30,4,7,0,0,0,0,0,0,0,0,0,0,0,44,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,41,0,49,50,51,0,47,48,0,0,0,1,36,37,38,39,40,19,19,19,19,19,19,19,19,19,19,19,26,0,0,0,0,0,0,0,0,0,44,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,19,3,66,67,68,2,64,65,6,2,3,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,57,57,58,0,0,0,0,0,0,44,19,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,19,20,19,19,19,19,19,37,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,41,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,19,0,0,0,0,0,19,
|
||||
37,19,19,19,19,19,20,19,19,38,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,57,60,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,19,19,19,0,0,0,0,19,
|
||||
19,19,20,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,41,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,19,
|
||||
19,38,19,19,19,19,19,19,19,19,19,19,19,19,57,57,57,57,57,57,57,57,57,57,60,0,0,0,0,0,0,0,19,19,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,19,19,19,19,19,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,19,19,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,19,19,19,19,19,19,19,19,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,19,19,0,0,0,0,0,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,19,19,19,19,0,0,0,0,0,19,19,19,19,19,0,19,19,0,0,0,0,0,19,19,19,19,0,0,0,0,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,19,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,19,19,19,19,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,19,19,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,19,19,19,19,19,19,19,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,19,
|
||||
19,19,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,19,19,19,19,19,19,19,
|
||||
19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,
|
||||
19,19,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,
|
||||
19,19,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,
|
||||
19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,19,19,0,0,19,19,19,19,19,19,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,53,53,19,19,36,19,19,37,19,36,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,57,54,57,19,19,36,36,19,20,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,19,19,37,38,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,54,19,36,19,36,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,19,19,22,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,19,39,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,20,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,19,21,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,19,19,38,21,19,
|
||||
50,0,49,0,0,0,49,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,48,0,0,0,49,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,57,53,19,19,22,
|
||||
67,3,66,5,2,6,66,67,6,7,0,0,0,0,0,0,0,0,0,0,0,1,2,64,65,5,2,6,66,67,6,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,19,39,
|
||||
19,19,37,19,19,36,19,22,23,24,0,0,0,0,0,0,0,0,0,0,0,18,19,19,37,19,19,36,19,22,23,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,0,0,0,0,52,19,
|
||||
19,36,19,19,21,19,19,39,40,41,0,0,0,0,0,0,0,0,0,0,0,35,19,36,19,19,38,19,19,39,40,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,19,41,0,0,0,0,0,25,
|
||||
53,54,53,53,55,53,54,55,57,60,0,0,0,0,0,0,0,0,0,0,0,52,53,54,53,53,55,53,54,55,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,57,53,60,0,0,0,0,0,18,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,6,5,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,54,55,57,58,0,0,0,0,0,0,8,9,0,0,0,0,0,0,0,0,0,42,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,19,41,0,0,0,0,0,0,0,50,8,19,
|
||||
6,2,3,6,7,0,0,0,0,0,0,13,14,0,0,0,0,0,0,13,14,0,0,0,0,1,34,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,57,53,60,0,0,0,0,0,0,1,67,19,19,
|
||||
36,19,22,23,24,0,0,0,0,0,1,30,31,9,0,0,0,0,1,30,31,9,0,0,0,59,55,57,60,0,0,0,0,0,0,47,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,19,19,19,19,
|
||||
19,19,39,40,41,0,0,0,0,0,25,19,19,26,0,0,0,0,25,19,19,26,0,0,0,0,0,0,0,0,0,0,0,0,1,64,65,9,0,0,0,0,0,46,7,0,0,0,0,0,0,0,0,0,0,0,0,0,1,19,19,19,19,19,
|
||||
20,54,55,57,60,0,0,0,0,0,59,57,53,60,0,0,0,0,59,57,53,60,0,0,0,0,0,0,0,0,0,0,0,0,59,57,56,60,0,0,0,0,1,5,19,7,0,0,0,0,0,0,0,0,0,0,0,0,52,57,54,53,19,19,
|
||||
24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,53,19,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,19,
|
||||
43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,58,0,0,0,0,14,14,14,0,0,0,0,0,0,0,0,0,0,35,
|
||||
43,0,0,0,0,0,0,47,48,0,0,0,0,0,47,48,0,0,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,31,31,31,9,17,0,0,0,0,0,0,0,0,18,
|
||||
19,9,0,0,0,1,4,64,65,2,3,4,5,2,64,65,3,6,7,0,1,2,2,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,57,19,36,57,60,0,0,0,0,0,0,0,0,25,
|
||||
19,26,0,0,0,18,19,19,19,19,19,37,19,19,36,19,22,23,24,0,18,19,19,24,0,0,0,0,0,0,0,0,0,0,1,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,60,0,0,0,0,0,0,0,0,0,0,42,
|
||||
19,43,0,0,0,25,19,19,19,19,36,19,19,19,19,19,39,40,41,0,18,19,19,19,9,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,
|
||||
19,41,0,0,0,42,19,19,19,53,54,53,53,55,53,54,55,57,60,0,59,56,56,56,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,19,
|
||||
19,43,0,0,0,18,19,19,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,19,19,
|
||||
19,26,0,0,0,35,19,19,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,66,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,7,0,0,0,0,0,0,0,0,0,0,0,0,59,53,54,19,
|
||||
37,26,0,0,0,52,56,56,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,19,19,0,0,0,0,0,0,0,0,0,19,
|
||||
19,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,13,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,9,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,0,19,
|
||||
19,26,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,2,30,30,31,2,6,7,0,0,13,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,59,19,19,19,0,0,0,0,0,0,0,0,19,
|
||||
19,43,0,0,0,0,0,0,0,0,0,0,0,1,20,21,22,23,19,19,19,19,19,19,19,6,3,30,4,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,41,0,49,50,51,0,47,48,0,0,0,1,36,37,38,39,40,19,19,19,19,19,19,19,19,19,19,19,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,19,3,66,67,68,2,64,65,6,2,3,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,57,57,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,19,20,19,19,19,19,19,37,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,19,19,0,0,0,0,19,
|
||||
37,19,19,19,19,19,20,19,19,38,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,57,60,0,0,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,19,19,0,0,0,0,0,19,19,19,19,0,0,0,0,19,
|
||||
19,19,20,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,41,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,19,
|
||||
19,38,19,19,19,19,19,19,19,19,19,19,19,19,57,57,57,57,57,57,57,57,57,57,60,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,19,19,19,19,19,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,19,19,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,19,
|
||||
19,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,19,19,19,19,19,19,19,19,0,0,0,0,0,19,19,0,0,0,0,0,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,19,19,0,0,0,0,19,19,19,19,0,0,0,0,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,0,0,19,19,19,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,19,19,19,19,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,
|
||||
19,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,19,
|
||||
19,19,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,
|
||||
19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,
|
||||
19,19,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,
|
||||
19,19,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,
|
||||
19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,
|
||||
19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,19,19,19,0,19,19,19,19,19,19,19,19,19,19,
|
||||
19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,19,19,19,19,19,19,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,
|
||||
19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,19,19,19,19,19,19,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,
|
||||
19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19
|
||||
</data>
|
||||
</layer>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
$title = "Modified bounding box";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(50, 200, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
sprite1.body.velocity.x = 100;
|
||||
|
||||
// This adjusts the collision body size.
|
||||
// 100x100 is the new width/height.
|
||||
// See the offset bounding box for another example.
|
||||
sprite1.body.setSize(100, 100, 0, 0);
|
||||
|
||||
sprite2 = game.add.sprite(700, 220, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
console.log(obj1.name + ' collided with ' + obj2.name);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderRectangle(sprite1.body);
|
||||
game.debug.renderRectangle(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
$title = "Larger bounding box";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(50, 200, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
sprite1.body.velocity.x = 100;
|
||||
|
||||
// In this example the new collision box is much larger than the original sprite
|
||||
sprite1.body.setSize(400, 50, -100, 20);
|
||||
|
||||
sprite2 = game.add.sprite(700, 220, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
console.log(obj1.name + ' collided with ' + obj2.name);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderRectangle(sprite1.body);
|
||||
game.debug.renderRectangle(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
$title = "Offset bounding box";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(50, 200, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
sprite1.body.velocity.x = 100;
|
||||
|
||||
// This adjusts the collision body size.
|
||||
// 100x50 is the new width/height.
|
||||
// 50, 25 is the X and Y offset of the newly sized box.
|
||||
// In this case the box is 50px in and 25px down.
|
||||
sprite1.body.setSize(100, 50, 50, 25);
|
||||
|
||||
sprite2 = game.add.sprite(700, 220, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
console.log(obj1.name + ' collided with ' + obj2.name);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderRectangle(sprite1.body);
|
||||
game.debug.renderRectangle(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
@@ -41,6 +41,7 @@
|
||||
player = game.add.sprite(32, 32, 'dude');
|
||||
player.body.bounce.y = 0.2;
|
||||
player.body.collideWorldBounds = true;
|
||||
player.body.gravity.y = 10;
|
||||
|
||||
player.animations.add('left', [0, 1, 2, 3], 10, true);
|
||||
player.animations.add('turn', [4], 20, true);
|
||||
@@ -55,7 +56,7 @@
|
||||
game.physics.collide(player, map);
|
||||
|
||||
player.body.velocity.x = 0;
|
||||
player.body.acceleration.y = 500;
|
||||
// player.body.acceleration.y = 500;
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
|
||||
+13
-2
@@ -50,6 +50,7 @@
|
||||
<script src="../src/core/Group.js"></script>
|
||||
<script src="../src/core/World.js"></script>
|
||||
<script src="../src/core/Game.js"></script>
|
||||
|
||||
<script src="../src/input/Input.js"></script>
|
||||
<script src="../src/input/Keyboard.js"></script>
|
||||
<script src="../src/input/Mouse.js"></script>
|
||||
@@ -57,41 +58,51 @@
|
||||
<script src="../src/input/Pointer.js"></script>
|
||||
<script src="../src/input/Touch.js"></script>
|
||||
<script src="../src/input/InputHandler.js"></script>
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
|
||||
<script src="../src/gameobjects/Events.js"></script>
|
||||
<script src="../src/gameobjects/GameObjectFactory.js"></script>
|
||||
<script src="../src/gameobjects/Sprite.js"></script>
|
||||
<script src="../src/gameobjects/TileSprite.js"></script>
|
||||
<script src="../src/gameobjects/Text.js"></script>
|
||||
<script src="../src/gameobjects/BitmapText.js"></script>
|
||||
<script src="../src/gameobjects/Button.js"></script>
|
||||
<script src="../src/gameobjects/Graphics.js"></script>
|
||||
<script src="../src/gameobjects/RenderTexture.js"></script>
|
||||
<script src="../src/gameobjects/BitmapText.js"></script>
|
||||
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
<script src="../src/system/StageScaleMode.js"></script>
|
||||
<script src="../src/system/Device.js"></script>
|
||||
<script src="../src/system/RequestAnimationFrame.js"></script>
|
||||
|
||||
<script src="../src/math/RandomDataGenerator.js"></script>
|
||||
<script src="../src/math/Math.js"></script>
|
||||
<script src="../src/math/QuadTree.js"></script>
|
||||
|
||||
<script src="../src/geom/Circle.js"></script>
|
||||
<script src="../src/geom/Point.js"></script>
|
||||
<script src="../src/geom/Rectangle.js"></script>
|
||||
|
||||
<script src="../src/net/Net.js"></script>
|
||||
|
||||
<script src="../src/tween/TweenManager.js"></script>
|
||||
<script src="../src/tween/Tween.js"></script>
|
||||
<script src="../src/tween/Easing.js"></script>
|
||||
|
||||
<script src="../src/time/Time.js"></script>
|
||||
|
||||
<script src="../src/animation/AnimationManager.js"></script>
|
||||
<script src="../src/animation/Animation.js"></script>
|
||||
<script src="../src/animation/Frame.js"></script>
|
||||
<script src="../src/animation/FrameData.js"></script>
|
||||
<script src="../src/animation/Parser.js"></script>
|
||||
|
||||
<script src="../src/loader/Cache.js"></script>
|
||||
<script src="../src/loader/Loader.js"></script>
|
||||
<script src="../src/loader/Parser.js"></script>
|
||||
|
||||
<script src="../src/sound/Sound.js"></script>
|
||||
<script src="../src/sound/SoundManager.js"></script>
|
||||
|
||||
<script src="../src/utils/Debug.js"></script>
|
||||
<script src="../src/utils/Color.js"></script>
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
$title = "Bitmap Fonts ahoy";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.bitmapFont('desyrel', 'assets/fonts/desyrel.png', 'assets/fonts/desyrel.xml');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
game.add.bitmapText(200, 100, 'Phaser & Pixi\nrocking!', { font: '64px Desyrel', align: 'center' });
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$title = "Hello Arial";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { create: create });
|
||||
|
||||
function create() {
|
||||
|
||||
var text = "- phaser -\nwith a sprinkle of\npixi dust";
|
||||
var style = { font: "65px Arial", fill: "#ff0044", align: "center" };
|
||||
|
||||
var t = game.add.text(game.world.centerX, game.world.centerY, text, style);
|
||||
t.anchor.setTo(0.5, 0.5);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
$title = "Kern of Duty";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 480, Phaser.AUTO, '', { preload: preload, create: create, update: update });
|
||||
|
||||
var content = [
|
||||
" ",
|
||||
"photon storm presents",
|
||||
"a phaser production",
|
||||
" ",
|
||||
"Kern of Duty",
|
||||
" ",
|
||||
"directed by rich davey",
|
||||
"rendering by mat groves",
|
||||
" ",
|
||||
"03:45, November 4th, 2014",
|
||||
"somewhere in the north pacific",
|
||||
"mission control bravo ...",
|
||||
];
|
||||
|
||||
var t = 0;
|
||||
var s;
|
||||
var index = 0;
|
||||
var line = '';
|
||||
|
||||
function preload() {
|
||||
game.load.image('cod', 'assets/pics/cod.jpg');
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
game.add.sprite(0, 0, 'cod');
|
||||
|
||||
var style = { font: "30pt Courier", fill: "#19cb65", stroke: "#119f4e", strokeThickness: 2 };
|
||||
|
||||
s = game.add.text(32, 380, '', style);
|
||||
t = game.time.now + 80;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
if (game.time.now > t && index < content.length)
|
||||
{
|
||||
// get the next character in the line
|
||||
if (line.length < content[index].length)
|
||||
{
|
||||
line = content[index].substr(0, line.length + 1);
|
||||
s.setText(line);
|
||||
t = game.time.now + 80;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = game.time.now + 2000;
|
||||
|
||||
if (index < content.length)
|
||||
{
|
||||
index++;
|
||||
line = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
$title = "Text Stroke";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { create: create, update: update });
|
||||
|
||||
var s;
|
||||
|
||||
function create() {
|
||||
|
||||
var text = "--- phaser ---\nwith a sprinkle of\npixi dust";
|
||||
var style = { font: "bold 40pt Arial", fill: "#ffffff", align: "center", stroke: "#258acc", strokeThickness: 8 };
|
||||
|
||||
s = game.add.text(game.world.centerX, game.world.centerY, text, style);
|
||||
s.anchor.setTo(0.5, 0.5);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
s.angle += 1;
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
Reference in New Issue
Block a user