mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
Tracked down an evil bug in Group.swap that caused the linked list to get corrupted in an upward (B to A) neighbour swap.
This commit is contained in:
@@ -10,7 +10,7 @@ BasicGame.MainMenu.prototype = {
|
||||
|
||||
create: function () {
|
||||
|
||||
// We've already preloaded our assets, so let's kick right into the Main Menu itself
|
||||
// We've already preloaded our assets, so let's kick right into the Main Menu itself.
|
||||
// Here all we're doing is playing some music and adding a picture and button
|
||||
// Naturally I expect you to do something significantly better :)
|
||||
|
||||
|
||||
@@ -17,12 +17,13 @@ BasicGame.Preloader.prototype = {
|
||||
this.background = this.add.sprite(0, 0, 'preloaderBackground');
|
||||
this.preloadBar = this.add.sprite(300, 400, 'preloaderBar');
|
||||
|
||||
// This sets the preloadBar sprite as a loader sprite, basically
|
||||
// what that does is automatically crop the sprite from 0 to full-width
|
||||
// This sets the preloadBar sprite as a loader sprite.
|
||||
// What that does is automatically crop the sprite from 0 to full-width
|
||||
// as the files below are loaded in.
|
||||
this.load.setPreloadSprite(this.preloadBar);
|
||||
|
||||
// Here we load most of the assets our game needs
|
||||
// Here we load the rest of the assets our game needs.
|
||||
// As this is just a Project Template I've not provided these assets, swap them for your own.
|
||||
this.load.image('titlepage', 'images/title.jpg');
|
||||
this.load.atlas('playButton', 'images/play_button.png', 'images/play_button.json');
|
||||
this.load.audio('titleMusic', ['audio/main_menu.mp3']);
|
||||
@@ -33,7 +34,7 @@ BasicGame.Preloader.prototype = {
|
||||
|
||||
create: function () {
|
||||
|
||||
// Once the load has finished we disable the crop because we're going to sit in the update loop for a short while
|
||||
// Once the load has finished we disable the crop because we're going to sit in the update loop for a short while as the music decodes
|
||||
this.preloadBar.cropEnabled = false;
|
||||
|
||||
},
|
||||
@@ -51,7 +52,7 @@ BasicGame.Preloader.prototype = {
|
||||
|
||||
if (this.cache.isSoundDecoded('titleMusic') && this.ready == false)
|
||||
{
|
||||
this.ready = false;
|
||||
this.ready = true;
|
||||
this.game.state.start('MainMenu');
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Phaser Basic Project Template</title>
|
||||
<script src="phaser.min.js"></script>
|
||||
<script src="Boot.js"></script>
|
||||
<script src="Preloader.js"></script>
|
||||
<script src="MainMenu.js"></script>
|
||||
@@ -17,7 +18,7 @@
|
||||
window.onload = function() {
|
||||
|
||||
// Create your Phaser game and inject it into the gameContainer div.
|
||||
// We did it in a window.onload event, but you can do it anywhere (requireJS load, anonymous function, jQuery dom ready, etc - whatever floats your boat)
|
||||
// We did it in a window.onload event, but you can do it anywhere (requireJS load, anonymous function, jQuery dom ready, - whatever floats your boat)
|
||||
var game = new Phaser.Game(1024, 768, Phaser.AUTO, 'gameContainer');
|
||||
|
||||
// Add the States your game has.
|
||||
|
||||
Reference in New Issue
Block a user