mirror of
https://github.com/wassname/phaser.git
synced 2026-07-07 00:06:37 +08:00
Fixed the TweenManager and added support to GameObjectFactory, so you can create tweens easily now all hooked in to the internal game clock. Also added the AnimationManager into Sprite, so you can create and play animations directly from sprites nice and easily.
This commit is contained in:
+13
-3
@@ -17,14 +17,24 @@
|
||||
var bunny;
|
||||
|
||||
function preload() {
|
||||
game.load.spritesheet('ms', 'assets/sprites/metalslug_mummy37x45.png', 37, 45);
|
||||
// 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('ms', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
bunny = new Phaser.Sprite(game, 0, 0, 'ms', 10);
|
||||
bunny = game.add.sprite(-40, 100, 'ms');
|
||||
|
||||
game.world.add(bunny);
|
||||
bunny.animations.add('walk');
|
||||
|
||||
bunny.animations.play('walk', 50, true);
|
||||
|
||||
// bunny.scale.x = 8;
|
||||
// bunny.scale.y = 8;
|
||||
|
||||
game.add.tween(bunny).to({ x: game.width }, 10000, Phaser.Easing.Linear.None, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user