mirror of
https://github.com/wassname/phaser.git
synced 2026-08-04 13:14:14 +08:00
Fixed an issue in Text. Fixed the background color issue with Canvas games. Updated the Examples viewer so the side-by-side focuses the iframe now. Added new "Extend Group" example.
This commit is contained in:
@@ -250,6 +250,10 @@
|
||||
"file": "display+order.js",
|
||||
"title": "display order"
|
||||
},
|
||||
{
|
||||
"file": "extending+a+group.js",
|
||||
"title": "extending a group"
|
||||
},
|
||||
{
|
||||
"file": "for+each.js",
|
||||
"title": "for each"
|
||||
|
||||
@@ -36,6 +36,9 @@ $(document).ready(function(){
|
||||
var height = $(window).height() - 270;
|
||||
$("#panel").css('height', height + 'px');
|
||||
|
||||
// iFrame focus
|
||||
$('a').click(function(e) { $('#viewer').focus(); });
|
||||
|
||||
})
|
||||
|
||||
.fail(function() {
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
window.onload = function() {
|
||||
|
||||
// Here is a custom group
|
||||
// It will automatically create 30 sprites of the given image when created.
|
||||
|
||||
MonsterGroup = function (game, image, action) {
|
||||
|
||||
Phaser.Group.call(this, game);
|
||||
|
||||
for (var i = 0; i < 30; i++)
|
||||
{
|
||||
var sprite = this.create(game.world.randomX, game.world.randomY, image);
|
||||
|
||||
if (action == 'bounce')
|
||||
{
|
||||
game.add.tween(sprite).to({ y: sprite.y - 100 }, 2000, Phaser.Easing.Elastic.Out, true, 0, 1000, true);
|
||||
}
|
||||
else if (action == 'slide')
|
||||
{
|
||||
game.add.tween(sprite).to({ x: sprite.x + 200 }, 4000, Phaser.Easing.Elastic.Out, true, 0, 1000, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
MonsterGroup.prototype = Object.create(Phaser.Group.prototype);
|
||||
MonsterGroup.prototype.constructor = MonsterGroup;
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create });
|
||||
|
||||
var customGroup1;
|
||||
var customGroup2;
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('ufo', 'assets/sprites/ufo.png');
|
||||
game.load.image('baddie', 'assets/sprites/space-baddie.png');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
customGroup1 = new MonsterGroup(game, 'ufo', 'bounce');
|
||||
customGroup2 = new MonsterGroup(game, 'baddie', 'slide');
|
||||
|
||||
}
|
||||
|
||||
}();
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
<div class="header">
|
||||
<div class="box100 no-padding">
|
||||
<div class="phaser-version">
|
||||
<span>Phaser Version: 1.1.2</span>
|
||||
<span>Phaser Version: 1.1.3</span>
|
||||
<a id="upgrade" href="https://github.com/photonstorm/phaser" class="version-button">New version: </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p id="total">Total examples: </p>
|
||||
<p>Phaser version: 1.1.2</p>
|
||||
<p>Phaser version: 1.1.3</p>
|
||||
<p><a href="index.html">Switch to Full View</a></p>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user