mirror of
https://github.com/wassname/phaser.git
synced 2026-07-19 11:26:26 +08:00
Making some major changes to Camera and World.
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user