Making some major changes to Camera and World.

This commit is contained in:
Richard Davey
2013-10-04 14:41:15 +01:00
parent 54f073e5cb
commit e8bed83ac3
12 changed files with 235 additions and 536 deletions
+10 -5
View File
@@ -6,13 +6,15 @@
<script type="text/javascript">
// Here is a custom game object
MonsterBunny = function (game, x, y) {
MonsterBunny = function (game, x, y, rotateSpeed) {
Phaser.Sprite.call(this, game, x, y, 'bunny');
this.rotateSpeed = rotateSpeed;
};
MonsterBunny.prototype = Phaser.Utils.extend(true, Phaser.Sprite.prototype, PIXI.Sprite.prototype);
MonsterBunny.prototype = Object.create(Phaser.Sprite.prototype);
MonsterBunny.prototype.constructor = MonsterBunny;
/**
@@ -20,7 +22,7 @@ MonsterBunny.prototype.constructor = MonsterBunny;
*/
MonsterBunny.prototype.update = function() {
this.angle++;
this.angle += this.rotateSpeed;
};
@@ -36,11 +38,14 @@ MonsterBunny.prototype.update = function() {
function create() {
var wabbit = new MonsterBunny(game, 400, 300);
wabbit.lifespan = 3000;
var wabbit = new MonsterBunny(game, 200, 300, 1);
wabbit.anchor.setTo(0.5, 0.5);
var wabbit2 = new MonsterBunny(game, 600, 300, 0.5);
wabbit2.anchor.setTo(0.5, 0.5);
game.add.existing(wabbit);
game.add.existing(wabbit2);
}