phaser/Tests/sprites/scale sprite 1.js

21 lines
777 B
JavaScript
Raw Normal View History

2013-05-29 02:58:56 +01:00
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
2013-05-29 02:58:56 +01:00
}
var smallBunny;
function create() {
// Here we'll assign the new sprite to the local smallBunny variable
smallBunny = game.add.sprite(0, 0, 'bunny');
// And now let's scale the sprite by half
2013-05-29 02:58:56 +01:00
// You can do either:
//smallBunny.scale.x = 0.5;
//smallBunny.scale.y = 0.5;
2013-05-29 02:58:56 +01:00
// Or you can set them both at the same time using setTo:
smallBunny.scale.setTo(0.5, 0.5);
2013-05-29 02:58:56 +01:00
}
})();