mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
Phaser.StageScaleMode has been renamed to ScaleManager and moved from the system folder to the core folder. It's still available under game.scale.
If your game references the old Phaser.StageScaleMode consts like SHOW_ALL you need to update them to Phaser.ScaleManager, i.e. Phaser.ScaleManager.SHOW_ALL. All of the Project Templates have been updated to reflect the above change.
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
<script src="../src/core/Stage.js"></script>
|
||||
<script src="../src/core/Group.js"></script>
|
||||
<script src="../src/core/World.js"></script>
|
||||
<script src="../src/core/ScaleManager.js"></script>
|
||||
<script src="../src/core/Game.js"></script>
|
||||
|
||||
<script src="../src/input/Input.js"></script>
|
||||
@@ -101,7 +102,6 @@
|
||||
<script src="../src/gameobjects/BitmapFont.js"></script>
|
||||
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
<script src="../src/system/StageScaleMode.js"></script>
|
||||
<script src="../src/system/Device.js"></script>
|
||||
<script src="../src/system/RequestAnimationFrame.js"></script>
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
<script src="../src/core/Stage.js"></script>
|
||||
<script src="../src/core/Group.js"></script>
|
||||
<script src="../src/core/World.js"></script>
|
||||
<script src="../src/core/ScaleManager.js"></script>
|
||||
<script src="../src/core/Game.js"></script>
|
||||
|
||||
<script src="../src/input/Input.js"></script>
|
||||
@@ -101,7 +102,6 @@
|
||||
<script src="../src/gameobjects/BitmapFont.js"></script>
|
||||
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
<script src="../src/system/StageScaleMode.js"></script>
|
||||
<script src="../src/system/Device.js"></script>
|
||||
<script src="../src/system/RequestAnimationFrame.js"></script>
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@ function create() {
|
||||
sprite = game.add.tileSprite(0, 0, 800, 600, 'starfield');
|
||||
sprite.autoScroll(0, 200);
|
||||
|
||||
game.add.image(200, 200, 'mummy');
|
||||
|
||||
game.world.scale.set(2);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
|
||||
|
||||
}
|
||||
|
||||
var mummy;
|
||||
var anim;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = 0xff8855;
|
||||
|
||||
mummy = game.add.sprite(300, 200, 'mummy', 5);
|
||||
|
||||
mummy.animations.updateIfVisible = false;
|
||||
|
||||
anim = mummy.animations.add('walk');
|
||||
|
||||
anim.play(2, false);
|
||||
// anim.play(2, true);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderText(anim.frame + ' / 17', 32, 32);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
var BasicGame = {};
|
||||
|
||||
BasicGame.Boot = function (game) {
|
||||
};
|
||||
|
||||
BasicGame.Boot.prototype = {
|
||||
|
||||
preload: function () {
|
||||
|
||||
this.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
|
||||
|
||||
},
|
||||
|
||||
create: function () {
|
||||
|
||||
this.state.start('MainMenu');
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
BasicGame.MainMenu = function (game) {
|
||||
|
||||
this.mummy;
|
||||
this.anim;
|
||||
|
||||
};
|
||||
|
||||
BasicGame.MainMenu.prototype = {
|
||||
|
||||
create: function () {
|
||||
|
||||
this.stage.backgroundColor = 0x2d2d2d;
|
||||
|
||||
this.mummy = this.add.sprite(200, 400, 'mummy');
|
||||
|
||||
this.anim = this.mummy.animations.add('walk');
|
||||
|
||||
this.anim.play(10, false);
|
||||
|
||||
this.mummy.events.onAnimationComplete.add(this.changeIt, this);
|
||||
|
||||
},
|
||||
|
||||
changeIt: function () {
|
||||
|
||||
this.state.start('GameOver');
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
BasicGame.GameOver = function (game) {
|
||||
|
||||
this.dude;
|
||||
|
||||
};
|
||||
|
||||
BasicGame.GameOver.prototype = {
|
||||
|
||||
create: function () {
|
||||
|
||||
this.stage.backgroundColor = 0xff7744;
|
||||
|
||||
this.dude = this.add.sprite(300, 300, 'mummy');
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example');
|
||||
|
||||
game.state.add('Boot', BasicGame.Boot);
|
||||
game.state.add('MainMenu', BasicGame.MainMenu);
|
||||
game.state.add('GameOver', BasicGame.GameOver);
|
||||
|
||||
game.state.start('Boot');
|
||||
@@ -89,4 +89,4 @@ game.state.add('Boot', BasicGame.Boot);
|
||||
game.state.add('Preloader', BasicGame.Preloader);
|
||||
game.state.add('MainMenu', BasicGame.MainMenu);
|
||||
|
||||
game.state.start('Boot', true, false, 'hello', 'world');
|
||||
game.state.start('Boot');
|
||||
|
||||
Reference in New Issue
Block a user