Updated Loader component and fixed a few Pointer issues.

This commit is contained in:
Richard Davey
2013-06-05 02:58:16 +01:00
parent d42f396ba0
commit 2f03f5fc43
118 changed files with 934 additions and 602 deletions
+8 -8
View File
@@ -101,7 +101,7 @@ module Phaser {
private _step: number = 0;
/**
* Whether loader complete loading or not.
* Whether load complete loading or not.
* @type {boolean}
*/
private _loadComplete: bool = false;
@@ -187,7 +187,7 @@ module Phaser {
* Reference to the assets loader.
* @type {Loader}
*/
public loader: Loader;
public load: Loader;
/**
* Reference to the math helper.
@@ -288,7 +288,7 @@ module Phaser {
this.add = new GameObjectFactory(this);
this.sound = new SoundManager(this);
this.cache = new Cache(this);
this.loader = new Loader(this, this.loadComplete);
this.load = new Loader(this, this.loadComplete);
this.time = new Time(this);
this.tweens = new TweenManager(this);
this.input = new Input(this);
@@ -353,7 +353,7 @@ module Phaser {
}
/**
* Called when the loader has finished after init was run.
* Called when the load has finished after init was run.
*/
private loadComplete() {
@@ -432,12 +432,12 @@ module Phaser {
if (this.onInitCallback !== null)
{
this.loader.reset();
this.load.reset();
this.onInitCallback.call(this.callbackContext);
// Is the loader empty?
if (this.loader.queueSize == 0)
// Is the load empty?
if (this.load.queueSize == 0)
{
if (this.onCreateCallback !== null)
{
@@ -584,7 +584,7 @@ module Phaser {
this.onDestroyCallback = null;
this.cache = null;
this.input = null;
this.loader = null;
this.load = null;
this.sound = null;
this.stage = null;
this.time = null;
+2 -2
View File
@@ -255,7 +255,7 @@ module Phaser {
public pauseGame() {
if (this.disablePauseScreen == false)
if (this.disablePauseScreen == false && this.pauseScreen)
{
this.pauseScreen.onPaused();
}
@@ -267,7 +267,7 @@ module Phaser {
public resumeGame() {
if (this.disablePauseScreen == false)
if (this.disablePauseScreen == false && this.pauseScreen)
{
this.pauseScreen.onResume();
}
+2 -2
View File
@@ -22,7 +22,7 @@ module Phaser {
this.camera = game.camera;
this.cache = game.cache;
this.input = game.input;
this.loader = game.loader;
this.load = game.load;
this.math = game.math;
this.motion = game.motion;
this.sound = game.sound;
@@ -66,7 +66,7 @@ module Phaser {
* Reference to the assets loader.
* @type {Loader}
*/
public loader: Loader;
public load: Loader;
/**
* Reference to the math helper.
+8 -13
View File
@@ -287,7 +287,7 @@ module Phaser.Components {
}
else
{
this._pointOutHandler(pointer);
this._pointerOutHandler(pointer);
return false;
}
}
@@ -316,7 +316,7 @@ module Phaser.Components {
}
public _pointOutHandler(pointer: Pointer) {
public _pointerOutHandler(pointer: Pointer) {
this._pointerData[pointer.id].isOver = false;
this._pointerData[pointer.id].isOut = true;
@@ -335,11 +335,8 @@ module Phaser.Components {
public _touchedHandler(pointer: Pointer): bool {
console.log('touched handler', this._pointerData[pointer.id]);
if (this._pointerData[pointer.id].isDown == false && this._pointerData[pointer.id].isOver == true)
{
//console.log('touchDown on', this._sprite.texture.cacheKey,this._sprite.frameName, this._sprite.frameBounds.width,this._sprite.frameBounds.height);
this._pointerData[pointer.id].isDown = true;
this._pointerData[pointer.id].isUp = false;
this._pointerData[pointer.id].timeDown = this.game.time.now;
@@ -362,8 +359,6 @@ module Phaser.Components {
public _releasedHandler(pointer: Pointer) {
console.log('release handler');
// If was previously touched by this Pointer, check if still is
if (this._pointerData[pointer.id].isDown && pointer.isUp)
{
@@ -562,7 +557,7 @@ module Phaser.Components {
this._dragPoint.setTo(this._sprite.x - pointer.x, this._sprite.y - pointer.y);
}
//pointer.draggedObject = this._sprite;
this.updateDrag(pointer);
}
@@ -678,13 +673,13 @@ module Phaser.Components {
*/
public renderDebugInfo(x: number, y: number, color?: string = 'rgb(255,255,255)') {
this._sprite.texture.context.font = '16px Courier';
this._sprite.texture.context.font = '14px Courier';
this._sprite.texture.context.fillStyle = color;
this._sprite.texture.context.fillText('Sprite Input: (' + this._sprite.frameBounds.width + ' x ' + this._sprite.frameBounds.height + ')', x, y);
this._sprite.texture.context.fillText('x: ' + this.pointerX(1).toFixed(1) + ' y: ' + this.pointerY(1).toFixed(1), x, y + 14);
this._sprite.texture.context.fillText('over: ' + this.pointerOver(1) + ' duration: ' + this.overDuration(1).toFixed(0), x, y + 28);
this._sprite.texture.context.fillText('down: ' + this.pointerDown(1) + ' duration: ' + this.downDuration(1).toFixed(0), x, y + 42);
this._sprite.texture.context.fillText('just over: ' + this.justOver(1) + ' just out: ' + this.justOut(1), x, y + 56);
this._sprite.texture.context.fillText('x: ' + this.pointerX().toFixed(1) + ' y: ' + this.pointerY().toFixed(1), x, y + 14);
this._sprite.texture.context.fillText('over: ' + this.pointerOver() + ' duration: ' + this.overDuration().toFixed(0), x, y + 28);
this._sprite.texture.context.fillText('down: ' + this.pointerDown() + ' duration: ' + this.downDuration().toFixed(0), x, y + 42);
this._sprite.texture.context.fillText('just over: ' + this.justOver() + ' just out: ' + this.justOut(), x, y + 56);
}
+1 -1
View File
@@ -904,7 +904,7 @@ module Phaser {
*/
public renderDebugInfo(x: number, y: number, color?: string = 'rgb(255,255,255)') {
this._game.stage.context.font = '24px Courier';
this._game.stage.context.font = '14px Courier';
this._game.stage.context.fillStyle = color;
this._game.stage.context.fillText('Input', x, y);
this._game.stage.context.fillText('Screen X: ' + this.x + ' Screen Y: ' + this.y, x, y + 14);
+2 -68
View File
@@ -348,29 +348,6 @@ module Phaser {
this.game.input.currentPointers++;
}
// Build our temporary click stack
/*
var _highestPriority = 0;
var _highestRenderID = 0;
var _highestRenderObject: number = -1;
for (var i = 0; i < this.game.input.totalTrackedObjects; i++)
{
if (this.game.input.inputObjects[i].input.checkPointerOver(this) && this.game.input.inputObjects[i].renderOrderID > _highestRenderID)
{
_highestRenderID = this.game.input.inputObjects[i].renderOrderID;
_highestRenderObject = i;
}
}
if (_highestRenderObject !== -1 && this._stateReset == false)
{
this.targetObject = this.game.input.inputObjects[_highestRenderObject];
this.targetObject.input._touchedHandler(this);
//_highestRenderObject.input._touchedHandler(this);
}
*/
if (this.targetObject !== null)
{
this.targetObject.input._touchedHandler(this);
@@ -406,50 +383,6 @@ module Phaser {
}
}
// Iterate through the tracked objects
// Build our temporary click stack
/*
var _highestPriority = 0;
var _highestRenderID = 0;
var _highestRenderObject = null;
for (var i = 0; i < this.game.input.totalTrackedObjects; i++)
{
if (this.game.input.inputObjects[i].input.enabled)
{
//if (this.game.input.inputObjects[i].input.update(this) && this.game.input.inputObjects[i].input.priorityID > _highestPriority)
if (this.game.input.inputObjects[i].input.update(this) && this.game.input.inputObjects[i].renderOrderID > _highestRenderID)
{
_highestRenderID = this.game.input.inputObjects[i].renderOrderID;
_highestRenderObject = this.game.input.inputObjects[i];
}
}
}
if (_highestRenderObject !== null)
{
_highestRenderObject.input._pointerOverHandler(this);
if (this.isDown && this._stateReset == false)
{
_highestRenderObject.input._touchedHandler(this);
}
// Now update all objects with the highest priority ID (can be more than 1)
//for (var i = 0; i < this.game.input.totalTrackedObjects; i++)
//{
// if (this.game.input.inputObjects[i].input.priorityID == _highestPriority)
// {
// if (this.game.input.inputObjects[i].input._touchedHandler(this) == false)
// {
// return;
// }
// }
//}
}
*/
}
}
@@ -499,7 +432,7 @@ module Phaser {
else
{
// Build our temporary click stack
var _highestRenderID = 0;
var _highestRenderID = -1;
var _highestRenderObject: number = -1;
for (var i = 0; i < this.game.input.totalTrackedObjects; i++)
@@ -517,6 +450,7 @@ module Phaser {
this.targetObject = this.game.input.inputObjects[_highestRenderObject];
this.targetObject.input._pointerOverHandler(this);
}
}
return this;
+6 -6
View File
@@ -107,7 +107,7 @@ module Phaser {
* @param key {string} Unique asset key of this image file.
* @param url {string} URL of image file.
*/
public addImageFile(key: string, url: string) {
public image(key: string, url: string) {
if (this.checkKeyExists(key) === false)
{
@@ -126,7 +126,7 @@ module Phaser {
* @param frameHeight {number} Height of each single frame.
* @param frameMax {number} How many frames in this sprite sheet.
*/
public addSpriteSheet(key: string, url: string, frameWidth: number, frameHeight: number, frameMax?: number = -1) {
public spritesheet(key: string, url: string, frameWidth: number, frameHeight: number, frameMax?: number = -1) {
if (this.checkKeyExists(key) === false)
{
@@ -145,7 +145,7 @@ module Phaser {
* @param [atlasData] {object} A JSON or XML data object.
* @param [format] {number} A value describing the format of the data.
*/
public addTextureAtlas(key: string, textureURL: string, atlasURL?: string = null, atlasData? = null, format?:number = Loader.TEXTURE_ATLAS_JSON_ARRAY) {
public atlas(key: string, textureURL: string, atlasURL?: string = null, atlasData? = null, format?:number = Loader.TEXTURE_ATLAS_JSON_ARRAY) {
if (this.checkKeyExists(key) === false)
{
@@ -222,7 +222,7 @@ module Phaser {
* @param key {string} Unique asset key of the audio file.
* @param url {string} URL of audio file.
*/
public addAudioFile(key: string, url: string) {
public audio(key: string, url: string) {
if (this.checkKeyExists(key) === false)
{
@@ -238,7 +238,7 @@ module Phaser {
* @param key {string} Unique asset key of the text file.
* @param url {string} URL of text file.
*/
public addTextFile(key: string, url: string) {
public text(key: string, url: string) {
if (this.checkKeyExists(key) === false)
{
@@ -273,7 +273,7 @@ module Phaser {
* @param onFileLoadCallback {function} Called when each file loaded successfully.
* @param onCompleteCallback {function} Called when all assets completely loaded.
*/
public load(onFileLoadCallback = null, onCompleteCallback = null) {
public start(onFileLoadCallback = null, onCompleteCallback = null) {
this.progress = 0;
this.hasLoaded = false;
+5
View File
@@ -19,6 +19,11 @@ module Phaser {
this._game = game;
if (window['PhaserGlobal'] && window['PhaserGlobal'].disableAudio == true)
{
return;
}
if (game.device.webaudio == true)
{
if (!!window['AudioContext'])
+2 -1
View File
@@ -45,7 +45,7 @@ TODO:
* Bug in AnimationManager set frame/frameName - the width/height are trimmed and wrong
* RenderOrderID won't work across cameras - but then neither do Pointers yet anyway
* Swap to using time based motion (like the tweens) rather than delta timer - it just doesn't work well on slow phones
* Bug in World drag
V1.0.0
@@ -90,6 +90,7 @@ V1.0.0
* Added support for minWidth and minHeight to game scale size, so it can never go below those values when scaling.
* Vastly improved orientation detection and response speed.
* Added custom callback support for all Touch and Mouse Events so you can easily hook events to custom APIs.
* Updated Game.loader and its methods. You now load images by: game.load.image() and also: game.load.atlas, game.load.audio, game.load.spritesheet, game.load.text. And you start it with game.load.start().
+28
View File
@@ -69,6 +69,34 @@
<TypeScriptCompile Include="particles\graphic emitter.ts" />
<TypeScriptCompile Include="input\over sprite 1.ts" />
<TypeScriptCompile Include="groups\create group 1.ts" />
<TypeScriptCompile Include="demoscene\ballmover.ts" />
<Content Include="demoscene\ballmover.js">
<DependentUpon>ballmover.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="demoscene\scroller1.ts" />
<TypeScriptCompile Include="demoscene\colorwhirl.ts" />
<Content Include="demoscene\colorwhirl.js">
<DependentUpon>colorwhirl.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="demoscene\fujiboink.ts" />
<TypeScriptCompile Include="demoscene\fruitfall.ts" />
<Content Include="demoscene\fruitfall.js">
<DependentUpon>fruitfall.ts</DependentUpon>
</Content>
<Content Include="demoscene\fujiboink.js">
<DependentUpon>fujiboink.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="demoscene\metalslug.ts" />
<Content Include="demoscene\metalslug.js">
<DependentUpon>metalslug.ts</DependentUpon>
</Content>
<Content Include="demoscene\scroller1.js">
<DependentUpon>scroller1.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="demoscene\starray.ts" />
<Content Include="demoscene\starray.js">
<DependentUpon>starray.ts</DependentUpon>
</Content>
<Content Include="groups\create group 1.js">
<DependentUpon>create group 1.ts</DependentUpon>
</Content>
+3 -3
View File
@@ -3,9 +3,9 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
game.world.setSize(1920, 1200, true);
game.loader.addImageFile('backdrop', 'assets/pics/remember-me.jpg');
game.loader.addImageFile('melon', 'assets/sprites/melon.png');
game.loader.load();
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
game.load.image('melon', 'assets/sprites/melon.png');
game.load.start();
}
function create() {
game.add.sprite(0, 0, 'backdrop');
+3 -3
View File
@@ -8,10 +8,10 @@
game.world.setSize(1920, 1200, true);
game.loader.addImageFile('backdrop', 'assets/pics/remember-me.jpg');
game.loader.addImageFile('melon', 'assets/sprites/melon.png');
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
game.load.image('melon', 'assets/sprites/melon.png');
game.loader.load();
game.load.start();
}
+3 -3
View File
@@ -3,9 +3,9 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
game.world.setSize(1920, 1200, true);
game.loader.addImageFile('backdrop', 'assets/pics/remember-me.jpg');
game.loader.addImageFile('ball', 'assets/sprites/shinyball.png');
game.loader.load();
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
game.load.image('ball', 'assets/sprites/shinyball.png');
game.load.start();
}
function create() {
game.add.sprite(0, 0, 'backdrop');
+3 -3
View File
@@ -8,10 +8,10 @@
game.world.setSize(1920, 1200, true);
game.loader.addImageFile('backdrop', 'assets/pics/remember-me.jpg');
game.loader.addImageFile('ball', 'assets/sprites/shinyball.png');
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
game.load.image('ball', 'assets/sprites/shinyball.png');
game.loader.load();
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
game.world.setSize(1600, 800, true);
game.loader.addImageFile('disk', 'assets/pics/devilstar_demo_download_disk.png');
game.loader.load();
game.load.image('disk', 'assets/pics/devilstar_demo_download_disk.png');
game.load.start();
}
function create() {
for(var i = 0; i < 10; i++) {
+2 -2
View File
@@ -8,9 +8,9 @@
game.world.setSize(1600, 800, true);
game.loader.addImageFile('disk', 'assets/pics/devilstar_demo_download_disk.png');
game.load.image('disk', 'assets/pics/devilstar_demo_download_disk.png');
game.loader.load();
game.load.start();
}
+18
View File
@@ -0,0 +1,18 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/gameobjects/ScrollZone.ts" />
(function () {
var game = new Phaser.Game(this, 'demo1', 320, 200, init, create, update);
function init() {
game.load.image('balls', '../assets/sprites/balls.png');
game.load.start();
}
var scroller;
function create() {
scroller = game.add.scrollZone('balls', 0, 0, 800, 612);
game.math.sinCosGenerator(256, 4, 4, 2);
}
function update() {
scroller.currentRegion.scrollSpeed.x = game.math.shiftSinTable();
scroller.currentRegion.scrollSpeed.y = game.math.shiftCosTable();
}
})();
+31
View File
@@ -0,0 +1,31 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/gameobjects/ScrollZone.ts" />
(function () {
var game = new Phaser.Game(this, 'demo1', 320, 200, init, create, update);
function init() {
game.load.image('balls', '../assets/sprites/balls.png');
game.load.start();
}
var scroller: Phaser.ScrollZone;
function create() {
scroller = game.add.scrollZone('balls', 0, 0, 800, 612);
game.math.sinCosGenerator(256, 4, 4, 2);
}
function update() {
scroller.currentRegion.scrollSpeed.x = game.math.shiftSinTable();
scroller.currentRegion.scrollSpeed.y = game.math.shiftCosTable();
}
})();
+22
View File
@@ -0,0 +1,22 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.load.image('swirl', '../assets/pics/color_wheel_swirl.png');
game.load.start();
}
var swirl;
function create() {
// Here we'll assign the new sprite to the local swirl variable
swirl = game.add.sprite(game.stage.centerX, game.stage.centerY, 'swirl');
// Increase the size of the sprite a little so it covers the edges of the stage
swirl.scale.setTo(1.4, 1.4);
// Set the origin to the middle of the Sprite to get the effect we need
swirl.origin.setTo(swirl.frameBounds.halfWidth, swirl.frameBounds.halfHeight);
// Create a tween that rotates a full 306 degrees and then repeats (loop set to true)
game.add.tween(swirl).to({
angle: 360
}, 2000, Phaser.Easing.Linear.None, true, 0, true);
}
})();
+33
View File
@@ -0,0 +1,33 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.load.image('swirl', '../assets/pics/color_wheel_swirl.png');
game.load.start();
}
var swirl: Phaser.Sprite;
function create() {
// Here we'll assign the new sprite to the local swirl variable
swirl = game.add.sprite(game.stage.centerX, game.stage.centerY, 'swirl');
// Increase the size of the sprite a little so it covers the edges of the stage
swirl.scale.setTo(1.4, 1.4);
// Set the origin to the middle of the Sprite to get the effect we need
swirl.origin.setTo(swirl.frameBounds.halfWidth, swirl.frameBounds.halfHeight);
// Create a tween that rotates a full 306 degrees and then repeats (loop set to true)
game.add.tween(swirl).to({ angle: 360 }, 2000, Phaser.Easing.Linear.None, true, 0, true);
}
})();
+44
View File
@@ -0,0 +1,44 @@
var __extends = this.__extends || function (d, b) {
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/gameobjects/Particle.ts" />
/// <reference path="../../Phaser/gameobjects/Emitter.ts" />
var fruitParticle = (function (_super) {
__extends(fruitParticle, _super);
function fruitParticle(game) {
_super.call(this, game);
var s = [
'carrot',
'melon',
'eggplant',
'mushroom',
'pineapple'
];
this.texture.loadImage(game.math.getRandom(s));
}
return fruitParticle;
})(Phaser.Particle);
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
var emitter;
function init() {
game.load.image('carrot', '../assets/sprites/carrot.png');
game.load.image('melon', '../assets/sprites/melon.png');
game.load.image('eggplant', '../assets/sprites/eggplant.png');
game.load.image('mushroom', '../assets/sprites/mushroom.png');
game.load.image('pineapple', '../assets/sprites/pineapple.png');
game.load.start();
}
function create() {
emitter = game.add.emitter(game.stage.centerX, 50);
emitter.gravity = 100;
// Here we tell the emitter to use our customParticle class
// The customParticle needs to extend Particle and must take game:Game as the first constructor parameter, otherwise it's free as a bird
emitter.particleClass = fruitParticle;
emitter.makeParticles(null, 50, false, 0);
emitter.start(false, 10, 0.05);
}
})();
+50
View File
@@ -0,0 +1,50 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/gameobjects/Particle.ts" />
/// <reference path="../../Phaser/gameobjects/Emitter.ts" />
class fruitParticle extends Phaser.Particle {
constructor(game:Phaser.Game) {
super(game);
var s = ['carrot', 'melon', 'eggplant', 'mushroom', 'pineapple'];
this.texture.loadImage(game.math.getRandom(s));
}
}
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
var emitter: Phaser.Emitter;
function init() {
game.load.image('carrot', '../assets/sprites/carrot.png');
game.load.image('melon', '../assets/sprites/melon.png');
game.load.image('eggplant', '../assets/sprites/eggplant.png');
game.load.image('mushroom', '../assets/sprites/mushroom.png');
game.load.image('pineapple', '../assets/sprites/pineapple.png');
game.load.start();
}
function create() {
emitter = game.add.emitter(game.stage.centerX, 50);
emitter.gravity = 100;
// Here we tell the emitter to use our customParticle class
// The customParticle needs to extend Particle and must take game:Game as the first constructor parameter, otherwise it's free as a bird
emitter.particleClass = fruitParticle;
emitter.makeParticles(null, 50, false, 0);
emitter.start(false, 10, 0.05);
}
})();
+42
View File
@@ -0,0 +1,42 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.load.image('fuji', '../assets/pics/atari_fujilogo.png');
game.load.start();
}
var fuji;
var tweenUp;
var tweenDown;
function create() {
game.stage.backgroundColor = 'rgb(0,0,100)';
// Here we'll assign the new sprite to the local fuji variable
fuji = game.add.sprite(game.stage.centerX, game.stage.centerY, 'fuji');
// The sprite is 320 x 200 pixels in size
// Here we set the origin to the center of the sprite again, so we can rotate and scale it at the same time
fuji.origin.setTo(160, 100);
game.add.tween(fuji).to({
angle: 360
}, 2000, Phaser.Easing.Linear.None, true, 0, true);
tweenUp = game.add.tween(fuji.scale);
tweenUp.onComplete.add(scaleDown, this);
tweenDown = game.add.tween(fuji.scale);
tweenDown.onComplete.add(scaleUp, this);
scaleUp();
}
function scaleUp() {
tweenUp.to({
x: 2,
y: 2
}, 1000, Phaser.Easing.Elastic.Out);
tweenUp.start();
}
function scaleDown() {
tweenDown.to({
x: 0.5,
y: 0.5
}, 1000, Phaser.Easing.Elastic.Out);
tweenDown.start();
}
})();
+56
View File
@@ -0,0 +1,56 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.load.image('fuji', '../assets/pics/atari_fujilogo.png');
game.load.start();
}
var fuji: Phaser.Sprite;
var tweenUp: Phaser.Tween;
var tweenDown: Phaser.Tween;
function create() {
game.stage.backgroundColor = 'rgb(0,0,100)';
// Here we'll assign the new sprite to the local fuji variable
fuji = game.add.sprite(game.stage.centerX, game.stage.centerY, 'fuji');
// The sprite is 320 x 200 pixels in size
// Here we set the origin to the center of the sprite again, so we can rotate and scale it at the same time
fuji.origin.setTo(160, 100);
game.add.tween(fuji).to({ angle: 360 }, 2000, Phaser.Easing.Linear.None, true, 0, true);
tweenUp = game.add.tween(fuji.scale);
tweenUp.onComplete.add(scaleDown, this);
tweenDown = game.add.tween(fuji.scale);
tweenDown.onComplete.add(scaleUp, this);
scaleUp();
}
function scaleUp() {
tweenUp.to({ x: 2, y: 2 }, 1000, Phaser.Easing.Elastic.Out);
tweenUp.start();
}
function scaleDown() {
tweenDown.to({ x: 0.5, y: 0.5 }, 1000, Phaser.Easing.Elastic.Out);
tweenDown.start();
}
})();
+32
View File
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0" />
<title>Phaser does DemoScene</title>
<style>
body {
padding: 0;
margin: 0;
}
canvas {
float: left;
}
</style>
<script>
var PhaserGlobal = { disableAudio: true }
</script>
<script src="../phaser.js"></script>
<script src="ballmover.js"></script>
<script src="scroller1.js"></script>
<script src="starray.js"></script>
<script src="colorwhirl.js"></script>
<script src="fujiboink.js"></script>
<script src="metalslug.js"></script>
<script src="fruitfall.js"></script>
</head>
<body>
</body>
</html>
+22
View File
@@ -0,0 +1,22 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.load.spritesheet('monster', '../assets/sprites/metalslug_monster39x40.png', 39, 40);
game.load.start();
}
var monster;
function create() {
game.stage.backgroundColor = 'rgb(50,10,10)';
// Notice the use of 'stage.centerX' - this places the sprite in the middle of the stage without needing to do any extra math
monster = game.add.sprite(100, 50, 'monster');
// For this animation we pass 'null' for the frames, because we're going to use them all
// And we set the frame rate (30) and loop status (true) when we add the animation
// If the frame rate and looping is never going to change then it's easier to do it here
monster.animations.add('walk', null, 30, true);
// Then you can just call 'play' on its own with no other values to start things going
monster.animations.play('walk');
monster.scale.setTo(3, 3);
}
})();
+36
View File
@@ -0,0 +1,36 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.load.spritesheet('monster', '../assets/sprites/metalslug_monster39x40.png', 39, 40);
game.load.start();
}
var monster: Phaser.Sprite;
function create() {
game.stage.backgroundColor = 'rgb(50,10,10)';
// Notice the use of 'stage.centerX' - this places the sprite in the middle of the stage without needing to do any extra math
monster = game.add.sprite(100, 50, 'monster');
// For this animation we pass 'null' for the frames, because we're going to use them all
// And we set the frame rate (30) and loop status (true) when we add the animation
// If the frame rate and looping is never going to change then it's easier to do it here
monster.animations.add('walk', null, 30, true);
// Then you can just call 'play' on its own with no other values to start things going
monster.animations.play('walk');
monster.scale.setTo(3, 3);
}
})();
+12
View File
@@ -0,0 +1,12 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/gameobjects/ScrollZone.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
game.load.image('crystal', '../assets/pics/jim_sachs_time_crystal.png');
game.load.start();
}
function create() {
game.add.scrollZone('crystal').setSpeed(4, 2);
}
})();
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/gameobjects/ScrollZone.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
game.load.image('crystal', '../assets/pics/jim_sachs_time_crystal.png');
game.load.start();
}
function create() {
game.add.scrollZone('crystal').setSpeed(4, 2);
}
})();
+31
View File
@@ -0,0 +1,31 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/gameobjects/ScrollZone.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
game.load.image('starray', '../assets/pics/auto_scroll_landscape.png');
game.load.start();
}
function create() {
var zone = game.add.scrollZone('starray');
// Hide the default region (the full image)
zone.currentRegion.visible = false;
var y = 0;
var speed = 16;
// The image consists of 10px high scrolling layers, this creates them quickly (top = fastest, getting slower as we move down)
for(var z = 0; z < 32; z++) {
zone.addRegion(0, y, 640, 10, speed);
if(z <= 15) {
speed -= 1;
} else {
speed += 1;
}
if(z == 15) {
y = 240;
speed += 1;
} else {
y += 10;
}
}
}
})();
+53
View File
@@ -0,0 +1,53 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/gameobjects/ScrollZone.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 320, 200, init, create);
function init() {
game.load.image('starray', '../assets/pics/auto_scroll_landscape.png');
game.load.start();
}
function create() {
var zone: Phaser.ScrollZone = game.add.scrollZone('starray');
// Hide the default region (the full image)
zone.currentRegion.visible = false;
var y:number = 0;
var speed:number = 16;
// The image consists of 10px high scrolling layers, this creates them quickly (top = fastest, getting slower as we move down)
for (var z:number = 0; z < 32; z++)
{
zone.addRegion(0, y, 640, 10, speed);
if (z <= 15)
{
speed -= 1;
}
else
{
speed += 1;
}
if (z == 15)
{
y = 240;
speed += 1;
}
else
{
y += 10;
}
}
}
})();
+2 -2
View File
@@ -3,8 +3,8 @@
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.loader.addImageFile('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.loader.load();
game.load.image('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.load.start();
}
var firstGroup;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.loader.load();
game.load.image('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.load.start();
}
+4 -4
View File
@@ -2,10 +2,10 @@
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
game.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
game.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
game.loader.addImageFile('card', 'assets/sprites/mana_card.png');
game.loader.load();
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('atari2', 'assets/sprites/atari800xl.png');
game.load.image('card', 'assets/sprites/mana_card.png');
game.load.start();
}
var items;
var card;
+4 -4
View File
@@ -6,11 +6,11 @@
function init() {
game.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
game.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
game.loader.addImageFile('card', 'assets/sprites/mana_card.png');
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('atari2', 'assets/sprites/atari800xl.png');
game.load.image('card', 'assets/sprites/mana_card.png');
game.loader.load();
game.load.start();
}
+3 -3
View File
@@ -2,9 +2,9 @@
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
game.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
game.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
game.loader.load();
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('atari2', 'assets/sprites/atari800xl.png');
game.load.start();
}
var atari1;
var atari2;
+3 -3
View File
@@ -6,10 +6,10 @@
function init() {
game.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
game.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('atari2', 'assets/sprites/atari800xl.png');
game.loader.load();
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, null, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/atari130xe.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/atari130xe.png');
game.load.start();
}
var sprite;
function create() {
+3 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/atari130xe.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/atari130xe.png');
game.load.start();
}
@@ -31,6 +31,7 @@
function render() {
game.input.renderDebugInfo(32, 32);
//game.input.mousePointer.renderDebug(32, 32);
sprite.input.renderDebugInfo(300, 32);
}
+2 -2
View File
@@ -3,8 +3,8 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, null, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/atari800.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/atari800.png');
game.load.start();
}
var sprite;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/atari800.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/atari800.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, null, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/darkwing_crazy.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/darkwing_crazy.png');
game.load.start();
}
var sprite;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/darkwing_crazy.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/darkwing_crazy.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, null, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/parsec.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/parsec.png');
game.load.start();
}
var sprite;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/parsec.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/parsec.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, null, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/atari130xe.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/atari130xe.png');
game.load.start();
}
var sprite;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/atari130xe.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/atari130xe.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, null, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/shinyball.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/shinyball.png');
game.load.start();
}
var sprite;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('sprite', 'assets/sprites/shinyball.png');
game.loader.load();
game.load.image('sprite', 'assets/sprites/shinyball.png');
game.load.start();
}
+4 -4
View File
@@ -3,10 +3,10 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, null, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
game.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
game.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
game.loader.load();
game.load.image('grid', 'assets/tests/debug-grid-1920x1920.png');
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('atari2', 'assets/sprites/atari800xl.png');
game.load.start();
}
var atari1;
var atari2;
+4 -4
View File
@@ -7,10 +7,10 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
game.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
game.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
game.loader.load();
game.load.image('grid', 'assets/tests/debug-grid-1920x1920.png');
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('atari2', 'assets/sprites/atari800xl.png');
game.load.start();
}
+4 -4
View File
@@ -3,10 +3,10 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, null, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
game.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
game.loader.addImageFile('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.loader.load();
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('atari2', 'assets/sprites/atari800xl.png');
game.load.image('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.load.start();
}
var atari1;
var atari2;
+4 -4
View File
@@ -7,10 +7,10 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
game.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
game.loader.addImageFile('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.loader.load();
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('atari2', 'assets/sprites/atari800xl.png');
game.load.image('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.load.start();
}
+3 -3
View File
@@ -3,9 +3,9 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
game.world.setSize(1920, 1200, true);
game.loader.addImageFile('backdrop', 'assets/pics/remember-me.jpg');
game.loader.addImageFile('melon', 'assets/sprites/melon.png');
game.loader.load();
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
game.load.image('melon', 'assets/sprites/melon.png');
game.load.start();
}
var test;
function create() {
+3 -3
View File
@@ -8,10 +8,10 @@
game.world.setSize(1920, 1200, true);
game.loader.addImageFile('backdrop', 'assets/pics/remember-me.jpg');
game.loader.addImageFile('melon', 'assets/sprites/melon.png');
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
game.load.image('melon', 'assets/sprites/melon.png');
game.loader.load();
game.load.start();
}
+4 -4
View File
@@ -3,10 +3,10 @@
var game = new Phaser.Game(this, 'game', 320, 400, init, create);
var emitter;
function init() {
game.loader.addImageFile('backdrop1', 'assets/pics/atari_fujilogo.png');
game.loader.addImageFile('backdrop2', 'assets/pics/acryl_bladerunner.png');
game.loader.addImageFile('jet', 'assets/sprites/carrot.png');
game.loader.load();
game.load.image('backdrop1', 'assets/pics/atari_fujilogo.png');
game.load.image('backdrop2', 'assets/pics/acryl_bladerunner.png');
game.load.image('jet', 'assets/sprites/carrot.png');
game.load.start();
// This can help a lot on crappy old Android phones :)
//game.framerate = 30;
game.stage.backgroundColor = 'rgb(0,0,0)';
+4 -4
View File
@@ -8,11 +8,11 @@
function init() {
game.loader.addImageFile('backdrop1', 'assets/pics/atari_fujilogo.png');
game.loader.addImageFile('backdrop2', 'assets/pics/acryl_bladerunner.png');
game.loader.addImageFile('jet', 'assets/sprites/carrot.png');
game.load.image('backdrop1', 'assets/pics/atari_fujilogo.png');
game.load.image('backdrop2', 'assets/pics/acryl_bladerunner.png');
game.load.image('jet', 'assets/sprites/carrot.png');
game.loader.load();
game.load.start();
// This can help a lot on crappy old Android phones :)
//game.framerate = 30;
+2 -2
View File
@@ -3,8 +3,8 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
var emitter;
function init() {
game.loader.addImageFile('jet', 'assets/sprites/jets.png');
game.loader.load();
game.load.image('jet', 'assets/sprites/jets.png');
game.load.start();
}
function create() {
emitter = game.add.emitter(game.stage.centerX, game.stage.centerY);
+2 -2
View File
@@ -8,9 +8,9 @@
function init() {
game.loader.addImageFile('jet', 'assets/sprites/jets.png');
game.load.image('jet', 'assets/sprites/jets.png');
game.loader.load();
game.load.start();
}
+3 -3
View File
@@ -3,9 +3,9 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, update);
var emitter;
function init() {
game.loader.addImageFile('jet', 'assets/sprites/particle1.png');
game.loader.addImageFile('starfield', 'assets/misc/starfield.jpg');
game.loader.load();
game.load.image('jet', 'assets/sprites/particle1.png');
game.load.image('starfield', 'assets/misc/starfield.jpg');
game.load.start();
}
var scroller;
var emitter;
+3 -3
View File
@@ -8,9 +8,9 @@
function init() {
game.loader.addImageFile('jet', 'assets/sprites/particle1.png');
game.loader.addImageFile('starfield', 'assets/misc/starfield.jpg');
game.loader.load();
game.load.image('jet', 'assets/sprites/particle1.png');
game.load.image('starfield', 'assets/misc/starfield.jpg');
game.load.start();
}
+7 -7
View File
@@ -8,13 +8,13 @@
var emitter5;
var emitter6;
function init() {
game.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
game.loader.addImageFile('ball2', 'assets/sprites/yellow_ball.png');
game.loader.addImageFile('ball3', 'assets/sprites/red_ball.png');
game.loader.addImageFile('ball4', 'assets/sprites/purple_ball.png');
game.loader.addImageFile('ball5', 'assets/sprites/blue_ball.png');
game.loader.addImageFile('ball6', 'assets/sprites/green_ball.png');
game.loader.load();
game.load.image('ball1', 'assets/sprites/aqua_ball.png');
game.load.image('ball2', 'assets/sprites/yellow_ball.png');
game.load.image('ball3', 'assets/sprites/red_ball.png');
game.load.image('ball4', 'assets/sprites/purple_ball.png');
game.load.image('ball5', 'assets/sprites/blue_ball.png');
game.load.image('ball6', 'assets/sprites/green_ball.png');
game.load.start();
}
function makeEmitter(emitter, x, y, graphic) {
emitter = game.add.emitter(x, y);
+7 -7
View File
@@ -13,14 +13,14 @@
function init() {
game.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
game.loader.addImageFile('ball2', 'assets/sprites/yellow_ball.png');
game.loader.addImageFile('ball3', 'assets/sprites/red_ball.png');
game.loader.addImageFile('ball4', 'assets/sprites/purple_ball.png');
game.loader.addImageFile('ball5', 'assets/sprites/blue_ball.png');
game.loader.addImageFile('ball6', 'assets/sprites/green_ball.png');
game.load.image('ball1', 'assets/sprites/aqua_ball.png');
game.load.image('ball2', 'assets/sprites/yellow_ball.png');
game.load.image('ball3', 'assets/sprites/red_ball.png');
game.load.image('ball4', 'assets/sprites/purple_ball.png');
game.load.image('ball5', 'assets/sprites/blue_ball.png');
game.load.image('ball6', 'assets/sprites/green_ball.png');
game.loader.load();
game.load.start();
}
+6 -6
View File
@@ -27,12 +27,12 @@ var customParticle = (function (_super) {
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
var emitter;
function init() {
game.loader.addImageFile('carrot', 'assets/sprites/carrot.png');
game.loader.addImageFile('melon', 'assets/sprites/melon.png');
game.loader.addImageFile('eggplant', 'assets/sprites/eggplant.png');
game.loader.addImageFile('mushroom', 'assets/sprites/mushroom.png');
game.loader.addImageFile('pineapple', 'assets/sprites/pineapple.png');
game.loader.load();
game.load.image('carrot', 'assets/sprites/carrot.png');
game.load.image('melon', 'assets/sprites/melon.png');
game.load.image('eggplant', 'assets/sprites/eggplant.png');
game.load.image('mushroom', 'assets/sprites/mushroom.png');
game.load.image('pineapple', 'assets/sprites/pineapple.png');
game.load.start();
}
function create() {
emitter = game.add.emitter(game.stage.centerX, 50);
+6 -6
View File
@@ -25,13 +25,13 @@ class customParticle extends Phaser.Particle {
function init() {
game.loader.addImageFile('carrot', 'assets/sprites/carrot.png');
game.loader.addImageFile('melon', 'assets/sprites/melon.png');
game.loader.addImageFile('eggplant', 'assets/sprites/eggplant.png');
game.loader.addImageFile('mushroom', 'assets/sprites/mushroom.png');
game.loader.addImageFile('pineapple', 'assets/sprites/pineapple.png');
game.load.image('carrot', 'assets/sprites/carrot.png');
game.load.image('melon', 'assets/sprites/melon.png');
game.load.image('eggplant', 'assets/sprites/eggplant.png');
game.load.image('mushroom', 'assets/sprites/mushroom.png');
game.load.image('pineapple', 'assets/sprites/pineapple.png');
game.loader.load();
game.load.start();
}
+3 -3
View File
@@ -4,9 +4,9 @@
var leftEmitter;
var rightEmitter;
function init() {
game.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
game.loader.addImageFile('ball2', 'assets/sprites/yellow_ball.png');
game.loader.load();
game.load.image('ball1', 'assets/sprites/aqua_ball.png');
game.load.image('ball2', 'assets/sprites/yellow_ball.png');
game.load.start();
}
function create() {
leftEmitter = game.add.emitter(0, game.stage.centerY - 200);
+3 -3
View File
@@ -9,10 +9,10 @@
function init() {
game.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
game.loader.addImageFile('ball2', 'assets/sprites/yellow_ball.png');
game.load.image('ball1', 'assets/sprites/aqua_ball.png');
game.load.image('ball2', 'assets/sprites/yellow_ball.png');
game.loader.load();
game.load.start();
}
+87 -158
View File
@@ -2337,7 +2337,7 @@ var Phaser;
enumerable: true,
configurable: true
});
Loader.prototype.addImageFile = /**
Loader.prototype.image = /**
* Add a new image asset loading request with key and url.
* @param key {string} Unique asset key of this image file.
* @param url {string} URL of image file.
@@ -2356,7 +2356,7 @@ var Phaser;
this._keys.push(key);
}
};
Loader.prototype.addSpriteSheet = /**
Loader.prototype.spritesheet = /**
* Add a new sprite sheet loading request.
* @param key {string} Unique asset key of the sheet file.
* @param url {string} URL of sheet file.
@@ -2382,7 +2382,7 @@ var Phaser;
this._keys.push(key);
}
};
Loader.prototype.addTextureAtlas = /**
Loader.prototype.atlas = /**
* Add a new texture atlas loading request.
* @param key {string} Unique asset key of the texture atlas file.
* @param textureURL {string} The url of the texture atlas image file.
@@ -2467,7 +2467,7 @@ var Phaser;
}
}
};
Loader.prototype.addAudioFile = /**
Loader.prototype.audio = /**
* Add a new audio file loading request.
* @param key {string} Unique asset key of the audio file.
* @param url {string} URL of audio file.
@@ -2487,7 +2487,7 @@ var Phaser;
this._keys.push(key);
}
};
Loader.prototype.addTextFile = /**
Loader.prototype.text = /**
* Add a new text file loading request.
* @param key {string} Unique asset key of the text file.
* @param url {string} URL of text file.
@@ -2520,7 +2520,7 @@ var Phaser;
this._fileList = {
};
};
Loader.prototype.load = /**
Loader.prototype.start = /**
* Load assets.
* @param onFileLoadCallback {function} Called when each file loaded successfully.
* @param onCompleteCallback {function} Called when all assets completely loaded.
@@ -6289,7 +6289,7 @@ var Phaser;
this._pointerData[pointer.id].y = pointer.scaledY - this._sprite.y;
return true;
} else {
this._pointOutHandler(pointer);
this._pointerOutHandler(pointer);
return false;
}
}
@@ -6308,7 +6308,7 @@ var Phaser;
this._sprite.events.onInputOver.dispatch(this._sprite, pointer);
}
};
Input.prototype._pointOutHandler = function (pointer) {
Input.prototype._pointerOutHandler = function (pointer) {
this._pointerData[pointer.id].isOver = false;
this._pointerData[pointer.id].isOut = true;
this._pointerData[pointer.id].timeOut = this.game.time.now;
@@ -6319,7 +6319,6 @@ var Phaser;
};
Input.prototype._touchedHandler = function (pointer) {
if(this._pointerData[pointer.id].isDown == false && this._pointerData[pointer.id].isOver == true) {
//console.log('touchDown on', this._sprite.texture.cacheKey,this._sprite.frameName, this._sprite.frameBounds.width,this._sprite.frameBounds.height);
this._pointerData[pointer.id].isDown = true;
this._pointerData[pointer.id].isUp = false;
this._pointerData[pointer.id].timeDown = this.game.time.now;
@@ -6492,8 +6491,8 @@ var Phaser;
} else {
this._dragPoint.setTo(this._sprite.x - pointer.x, this._sprite.y - pointer.y);
}
//pointer.draggedObject = this._sprite;
};
this.updateDrag(pointer);
};
Input.prototype.stopDrag = /**
* Called by Pointer when drag is stopped on this Sprite. Should not usually be called directly.
*/
@@ -6584,10 +6583,10 @@ var Phaser;
this._sprite.texture.context.font = '14px Courier';
this._sprite.texture.context.fillStyle = color;
this._sprite.texture.context.fillText('Sprite Input: (' + this._sprite.frameBounds.width + ' x ' + this._sprite.frameBounds.height + ')', x, y);
this._sprite.texture.context.fillText('x: ' + this.pointerX(1).toFixed(1) + ' y: ' + this.pointerY(1).toFixed(1), x, y + 14);
this._sprite.texture.context.fillText('over: ' + this.pointerOver(1) + ' duration: ' + this.overDuration(1).toFixed(0), x, y + 28);
this._sprite.texture.context.fillText('down: ' + this.pointerDown(1) + ' duration: ' + this.downDuration(1).toFixed(0), x, y + 42);
this._sprite.texture.context.fillText('just over: ' + this.justOver(1) + ' just out: ' + this.justOut(1), x, y + 56);
this._sprite.texture.context.fillText('x: ' + this.pointerX().toFixed(1) + ' y: ' + this.pointerY().toFixed(1), x, y + 14);
this._sprite.texture.context.fillText('over: ' + this.pointerOver() + ' duration: ' + this.overDuration().toFixed(0), x, y + 28);
this._sprite.texture.context.fillText('down: ' + this.pointerDown() + ' duration: ' + this.downDuration().toFixed(0), x, y + 42);
this._sprite.texture.context.fillText('just over: ' + this.justOver() + ' just out: ' + this.justOut(), x, y + 56);
};
return Input;
})();
@@ -10549,6 +10548,9 @@ var Phaser;
*/
this._context = null;
this._game = game;
if(window['PhaserGlobal'] && window['PhaserGlobal'].disableAudio == true) {
return;
}
if(game.device.webaudio == true) {
if(!!window['AudioContext']) {
this._context = new window['AudioContext']();
@@ -10740,6 +10742,8 @@ var Phaser;
this.orientation = 0;
}
}
this.scaleFactor = new Phaser.Vec2(1, 1);
this.aspectRatio = 0;
window.addEventListener('orientationchange', function (event) {
return _this.checkOrientation(event);
}, false);
@@ -10801,7 +10805,6 @@ var Phaser;
// Back to normal
this._game.paused = false;
this.incorrectOrientation = false;
this._game.input.reset();
this.refresh();
}
} else {
@@ -10809,7 +10812,6 @@ var Phaser;
// Show orientation screen
this._game.paused = true;
this.incorrectOrientation = true;
this._game.input.reset();
this.refresh();
}
}
@@ -10905,32 +10907,43 @@ var Phaser;
} else if(this._game.stage.scaleMode == StageScaleMode.SHOW_ALL) {
this.setShowAll();
}
this.setSize();
clearInterval(this._check);
this._check = null;
}
};
StageScaleMode.prototype.setMaximum = function () {
this.width = window.innerWidth;
this.height = window.innerHeight;
this._game.stage.canvas.style.width = this.width + 'px';
this._game.stage.canvas.style.height = this.height + 'px';
this._game.input.scaleX = this._game.stage.width / this.width;
this._game.input.scaleY = this._game.stage.height / this.height;
};
StageScaleMode.prototype.setShowAll = function () {
var multiplier = Math.min((window.innerHeight / this._game.stage.height), (window.innerWidth / this._game.stage.width));
this.width = Math.round(this._game.stage.width * multiplier);
this.height = Math.round(this._game.stage.height * multiplier);
StageScaleMode.prototype.setSize = function () {
if(this.maxWidth && this.width > this.maxWidth) {
this.width = this.maxWidth;
}
if(this.maxHeight && this.height > this.maxHeight) {
this.height = this.maxHeight;
}
if(this.minWidth && this.width < this.minWidth) {
this.width = this.minWidth;
}
if(this.minHeight && this.height < this.minHeight) {
this.height = this.minHeight;
}
this._game.stage.canvas.style.width = this.width + 'px';
this._game.stage.canvas.style.height = this.height + 'px';
this._game.input.scaleX = this._game.stage.width / this.width;
this._game.input.scaleY = this._game.stage.height / this.height;
this._game.stage.getOffset(this._game.stage.canvas);
this.aspectRatio = this.width / this.height;
this.scaleFactor.x = this._game.stage.width / this.width;
this.scaleFactor.y = this._game.stage.height / this.height;
//this.scaleFactor.x = this.width / this._game.stage.width;
//this.scaleFactor.y = this.height / this._game.stage.height;
};
StageScaleMode.prototype.setMaximum = function () {
this.width = window.innerWidth;
this.height = window.innerHeight;
};
StageScaleMode.prototype.setShowAll = function () {
var multiplier = Math.min((window.innerHeight / this._game.stage.height), (window.innerWidth / this._game.stage.width));
this.width = Math.round(this._game.stage.width * multiplier);
this.height = Math.round(this._game.stage.height * multiplier);
};
StageScaleMode.prototype.setExactFit = function () {
if(this.maxWidth && window.innerWidth > this.maxWidth) {
@@ -10943,10 +10956,6 @@ var Phaser;
} else {
this.height = window.innerHeight;
}
this._game.stage.canvas.style.width = this.width + 'px';
this._game.stage.canvas.style.height = this.height + 'px';
this._game.input.scaleX = this._game.stage.width / this.width;
this._game.input.scaleY = this._game.stage.height / this.height;
};
return StageScaleMode;
})();
@@ -11201,9 +11210,7 @@ var Phaser;
} else if(this._showOnPortrait) {
this.game.stage.context.drawImage(this.portraitImage, 0, 0, this.portraitImage.width, this.portraitImage.height, 0, 0, this.game.stage.width, this.game.stage.height);
}
//this.game.stage.context.font = '32px Arial';
//this.game.stage.context.fillText('w: ' + this.game.stage.width + ' h: ' + this.game.stage.height, 32, 32);
};
};
return OrientationScreen;
})();
Phaser.OrientationScreen = OrientationScreen;
@@ -11260,7 +11267,7 @@ var Phaser;
this.canvas = document.createElement('canvas');
this.canvas.width = width;
this.canvas.height = height;
if(document.getElementById(parent)) {
if((parent !== '' || parent !== null) && document.getElementById(parent)) {
document.getElementById(parent).appendChild(this.canvas);
document.getElementById(parent).style.overflow = 'hidden';
} else {
@@ -11275,11 +11282,11 @@ var Phaser;
event.preventDefault();
};
this.context = this.canvas.getContext('2d');
this.offset = this.getOffset(this.canvas);
this.bounds = new Phaser.Rectangle(this.offset.x, this.offset.y, width, height);
this.aspectRatio = width / height;
this.scaleMode = Phaser.StageScaleMode.NO_SCALE;
this.scale = new Phaser.StageScaleMode(this._game);
this.getOffset(this.canvas);
this.bounds = new Phaser.Rectangle(this.offset.x, this.offset.y, width, height);
this.aspectRatio = width / height;
document.addEventListener('visibilitychange', function (event) {
return _this.visibilityChange(event);
}, false);
@@ -11300,9 +11307,7 @@ var Phaser;
this.bootScreen = new Phaser.BootScreen(this._game);
this.pauseScreen = new Phaser.PauseScreen(this._game, this.width, this.height);
this.orientationScreen = new Phaser.OrientationScreen(this._game);
//this.scale.enterLandscape.add(this.orientationChange, this);
//this.scale.enterPortrait.add(this.orientationChange, this);
};
};
Stage.prototype.update = /**
* Update stage for rendering. This will handle scaling, clearing
* and PauseScreen/BootScreen updating and rendering.
@@ -11344,31 +11349,7 @@ var Phaser;
}
}
};
Stage.prototype.enableOrientationCheck = /**
* This method is called when the device orientation changes.
*/
/*
private orientationChange(format: number, landscape: bool, portrait: bool) {
if (this.scale.forceLandscape && portrait)
{
this._game.paused = true;
this.scale.incorrectOrientation = true;
}
else if (this.scale.forcePortrait && landscape)
{
this._game.paused = true;
this.scale.incorrectOrientation = true;
}
else if ((this.scale.forceLandscape && landscape) || (this.scale.forcePortrait && portrait))
{
this._game.paused = false;
this.scale.incorrectOrientation = false;
}
}
*/
function (forceLandscape, forcePortrait, imageKey) {
Stage.prototype.enableOrientationCheck = function (forceLandscape, forcePortrait, imageKey) {
if (typeof imageKey === "undefined") { imageKey = ''; }
this.scale.forceLandscape = forceLandscape;
this.scale.forcePortrait = forcePortrait;
@@ -11384,25 +11365,35 @@ var Phaser;
}
};
Stage.prototype.pauseGame = function () {
this.pauseScreen.onPaused();
if(this.disablePauseScreen == false && this.pauseScreen) {
this.pauseScreen.onPaused();
}
this.saveCanvasValues();
this._game.paused = true;
};
Stage.prototype.resumeGame = function () {
this.pauseScreen.onResume();
if(this.disablePauseScreen == false && this.pauseScreen) {
this.pauseScreen.onResume();
}
this.restoreCanvasValues();
this._game.paused = false;
};
Stage.prototype.getOffset = /**
* Get the DOM offset values of the given element
*/
function (element) {
function (element, populateOffset) {
if (typeof populateOffset === "undefined") { populateOffset = true; }
var box = element.getBoundingClientRect();
var clientTop = element.clientTop || document.body.clientTop || 0;
var clientLeft = element.clientLeft || document.body.clientLeft || 0;
var scrollTop = window.pageYOffset || element.scrollTop || document.body.scrollTop;
var scrollLeft = window.pageXOffset || element.scrollLeft || document.body.scrollLeft;
return new Phaser.Point(box.left + scrollLeft - clientLeft, box.top + scrollTop - clientTop);
if(populateOffset) {
this.offset = new Phaser.Point(box.left + scrollLeft - clientLeft, box.top + scrollTop - clientTop);
return this.offset;
} else {
return new Phaser.Point(box.left + scrollLeft - clientLeft, box.top + scrollTop - clientTop);
}
};
Stage.prototype.saveCanvasValues = /**
* Save current canvas properties (strokeStyle, lineWidth and fillStyle) for later using.
@@ -14220,7 +14211,7 @@ var Phaser;
this.button = event.button;
}
// Fix to stop rogue browser plugins from blocking the visibility state event
if(this.game.paused == true) {
if(this.game.paused == true && this.game.stage.scale.incorrectOrientation == false) {
this.game.stage.resumeGame();
return this;
}
@@ -14243,28 +14234,6 @@ var Phaser;
if(this.isMouse == false) {
this.game.input.currentPointers++;
}
// Build our temporary click stack
/*
var _highestPriority = 0;
var _highestRenderID = 0;
var _highestRenderObject: number = -1;
for (var i = 0; i < this.game.input.totalTrackedObjects; i++)
{
if (this.game.input.inputObjects[i].input.checkPointerOver(this) && this.game.input.inputObjects[i].renderOrderID > _highestRenderID)
{
_highestRenderID = this.game.input.inputObjects[i].renderOrderID;
_highestRenderObject = i;
}
}
if (_highestRenderObject !== -1 && this._stateReset == false)
{
this.targetObject = this.game.input.inputObjects[_highestRenderObject];
this.targetObject.input._touchedHandler(this);
//_highestRenderObject.input._touchedHandler(this);
}
*/
if(this.targetObject !== null) {
this.targetObject.input._touchedHandler(this);
}
@@ -14289,49 +14258,7 @@ var Phaser;
this._history.shift();
}
}
// Iterate through the tracked objects
// Build our temporary click stack
/*
var _highestPriority = 0;
var _highestRenderID = 0;
var _highestRenderObject = null;
for (var i = 0; i < this.game.input.totalTrackedObjects; i++)
{
if (this.game.input.inputObjects[i].input.enabled)
{
//if (this.game.input.inputObjects[i].input.update(this) && this.game.input.inputObjects[i].input.priorityID > _highestPriority)
if (this.game.input.inputObjects[i].input.update(this) && this.game.input.inputObjects[i].renderOrderID > _highestRenderID)
{
_highestRenderID = this.game.input.inputObjects[i].renderOrderID;
_highestRenderObject = this.game.input.inputObjects[i];
}
}
}
if (_highestRenderObject !== null)
{
_highestRenderObject.input._pointerOverHandler(this);
if (this.isDown && this._stateReset == false)
{
_highestRenderObject.input._touchedHandler(this);
}
// Now update all objects with the highest priority ID (can be more than 1)
//for (var i = 0; i < this.game.input.totalTrackedObjects; i++)
//{
// if (this.game.input.inputObjects[i].input.priorityID == _highestPriority)
// {
// if (this.game.input.inputObjects[i].input._touchedHandler(this) == false)
// {
// return;
// }
// }
//}
}
*/
}
}
};
Pointer.prototype.move = /**
* Called when the Pointer is moved on the touchscreen
@@ -14366,7 +14293,7 @@ var Phaser;
}
} else {
// Build our temporary click stack
var _highestRenderID = 0;
var _highestRenderID = -1;
var _highestRenderObject = -1;
for(var i = 0; i < this.game.input.totalTrackedObjects; i++) {
if(this.game.input.inputObjects[i].input.checkPointerOver(this) && this.game.input.inputObjects[i].renderOrderID > _highestRenderID) {
@@ -14374,7 +14301,6 @@ var Phaser;
_highestRenderObject = i;
}
}
//console.log('pointer move', _highestRenderID);
if(_highestRenderObject !== -1) {
//console.log('setting target');
this.targetObject = this.game.input.inputObjects[_highestRenderObject];
@@ -14482,6 +14408,9 @@ var Phaser;
this._holdSent = false;
this._history.length = 0;
this._stateReset = true;
if(this.targetObject) {
this.targetObject.input._releasedHandler(this);
}
this.targetObject = null;
};
Pointer.prototype.renderDebug = /**
@@ -15126,8 +15055,8 @@ var Phaser;
}
event.preventDefault();
for(var i = 0; i < event.changedTouches.length; i++) {
console.log('touch enter');
}
//console.log('touch enter');
}
};
Touch.prototype.onTouchLeave = /**
* For touch enter and leave its a list of the touch points that have entered or left the target
@@ -15141,8 +15070,8 @@ var Phaser;
}
event.preventDefault();
for(var i = 0; i < event.changedTouches.length; i++) {
console.log('touch leave');
}
//console.log('touch leave');
}
};
Touch.prototype.onTouchMove = /**
*
@@ -15534,12 +15463,7 @@ var Phaser;
this.pointer10.reset();
}
this.currentPointers = 0;
for(var i = 0; i < this.totalTrackedObjects; i++) {
this.inputObjects[i].input.reset();
}
this._game.stage.canvas.style.cursor = "default";
this.inputObjects.length = 0;
this.totalTrackedObjects = 0;
if(hard == true) {
this.onDown.dispose();
this.onUp.dispose();
@@ -15549,6 +15473,11 @@ var Phaser;
this.onUp = new Phaser.Signal();
this.onTap = new Phaser.Signal();
this.onHold = new Phaser.Signal();
for(var i = 0; i < this.totalTrackedObjects; i++) {
this.inputObjects[i].input.reset();
}
this.inputObjects.length = 0;
this.totalTrackedObjects = 0;
}
};
Object.defineProperty(Input.prototype, "totalInactivePointers", {
@@ -15777,7 +15706,7 @@ var Phaser;
*/
function (x, y, color) {
if (typeof color === "undefined") { color = 'rgb(255,255,255)'; }
this._game.stage.context.font = '24px Courier';
this._game.stage.context.font = '14px Courier';
this._game.stage.context.fillStyle = color;
this._game.stage.context.fillText('Input', x, y);
this._game.stage.context.fillText('Screen X: ' + this.x + ' Screen Y: ' + this.y, x, y + 14);
@@ -16241,7 +16170,7 @@ var Phaser;
*/
this._step = 0;
/**
* Whether loader complete loading or not.
* Whether load complete loading or not.
* @type {boolean}
*/
this._loadComplete = false;
@@ -16343,7 +16272,7 @@ var Phaser;
this.add = new Phaser.GameObjectFactory(this);
this.sound = new Phaser.SoundManager(this);
this.cache = new Phaser.Cache(this);
this.loader = new Phaser.Loader(this, this.loadComplete);
this.load = new Phaser.Loader(this, this.loadComplete);
this.time = new Phaser.Time(this);
this.tweens = new Phaser.TweenManager(this);
this.input = new Phaser.Input(this);
@@ -16387,7 +16316,7 @@ var Phaser;
}
};
Game.prototype.loadComplete = /**
* Called when the loader has finished after init was run.
* Called when the load has finished after init was run.
*/
function () {
this._loadComplete = true;
@@ -16440,10 +16369,10 @@ var Phaser;
*/
function () {
if(this.onInitCallback !== null) {
this.loader.reset();
this.load.reset();
this.onInitCallback.call(this.callbackContext);
// Is the loader empty?
if(this.loader.queueSize == 0) {
// Is the load empty?
if(this.load.queueSize == 0) {
if(this.onCreateCallback !== null) {
this.onCreateCallback.call(this.callbackContext);
}
@@ -16552,7 +16481,7 @@ var Phaser;
this.onDestroyCallback = null;
this.cache = null;
this.input = null;
this.loader = null;
this.load = null;
this.sound = null;
this.stage = null;
this.time = null;
@@ -17090,7 +17019,7 @@ var Phaser;
this.camera = game.camera;
this.cache = game.cache;
this.input = game.input;
this.loader = game.loader;
this.load = game.load;
this.math = game.math;
this.motion = game.motion;
this.sound = game.sound;
+2 -2
View File
@@ -3,8 +3,8 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('atari', 'assets/sprites/atari800xl.png');
game.loader.load();
game.load.image('atari', 'assets/sprites/atari800xl.png');
game.load.start();
}
var atari;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('atari', 'assets/sprites/atari800xl.png');
game.loader.load();
game.load.image('atari', 'assets/sprites/atari800xl.png');
game.load.start();
}
+3 -3
View File
@@ -3,9 +3,9 @@
var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('atari', 'assets/sprites/atari800xl.png');
game.loader.addImageFile('card', 'assets/sprites/mana_card.png');
game.loader.load();
game.load.image('atari', 'assets/sprites/atari800xl.png');
game.load.image('card', 'assets/sprites/mana_card.png');
game.load.start();
}
var atari;
var card;
+3 -3
View File
@@ -7,9 +7,9 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('atari', 'assets/sprites/atari800xl.png');
game.loader.addImageFile('card', 'assets/sprites/mana_card.png');
game.loader.load();
game.load.image('atari', 'assets/sprites/atari800xl.png');
game.load.image('card', 'assets/sprites/mana_card.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
game.loader.addImageFile('balls', 'assets/sprites/balls.png');
game.loader.load();
game.load.image('balls', 'assets/sprites/balls.png');
game.load.start();
}
var scroller;
function create() {
+2 -2
View File
@@ -7,9 +7,9 @@
function init() {
game.loader.addImageFile('balls', 'assets/sprites/balls.png');
game.load.image('balls', 'assets/sprites/balls.png');
game.loader.load();
game.load.start();
}
+5 -5
View File
@@ -3,11 +3,11 @@
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
game.loader.addImageFile('nashwan', 'assets/sprites/xenon2_ship.png');
game.loader.addImageFile('starfield', 'assets/misc/starfield.jpg');
game.loader.addImageFile('jet', 'assets/sprites/particle1.png');
game.loader.addImageFile('bullet', 'assets/misc/bullet1.png');
game.loader.load();
game.load.image('nashwan', 'assets/sprites/xenon2_ship.png');
game.load.image('starfield', 'assets/misc/starfield.jpg');
game.load.image('jet', 'assets/sprites/particle1.png');
game.load.image('bullet', 'assets/misc/bullet1.png');
game.load.start();
}
var scroller;
var emitter;
+5 -5
View File
@@ -7,12 +7,12 @@
function init() {
game.loader.addImageFile('nashwan', 'assets/sprites/xenon2_ship.png');
game.loader.addImageFile('starfield', 'assets/misc/starfield.jpg');
game.loader.addImageFile('jet', 'assets/sprites/particle1.png');
game.loader.addImageFile('bullet', 'assets/misc/bullet1.png');
game.load.image('nashwan', 'assets/sprites/xenon2_ship.png');
game.load.image('starfield', 'assets/misc/starfield.jpg');
game.load.image('jet', 'assets/sprites/particle1.png');
game.load.image('bullet', 'assets/misc/bullet1.png');
game.loader.load();
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
game.loader.addImageFile('starray', 'assets/pics/auto_scroll_landscape.png');
game.loader.load();
game.load.image('starray', 'assets/pics/auto_scroll_landscape.png');
game.load.start();
}
function create() {
var zone = game.add.scrollZone('starray');
+2 -2
View File
@@ -7,9 +7,9 @@
function init() {
game.loader.addImageFile('starray', 'assets/pics/auto_scroll_landscape.png');
game.load.image('starray', 'assets/pics/auto_scroll_landscape.png');
game.loader.load();
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
game.loader.addImageFile('angelDawn', 'assets/pics/game14_angel_dawn.png');
game.loader.load();
game.load.image('angelDawn', 'assets/pics/game14_angel_dawn.png');
game.load.start();
}
var scroller;
function create() {
+2 -2
View File
@@ -7,9 +7,9 @@
function init() {
game.loader.addImageFile('angelDawn', 'assets/pics/game14_angel_dawn.png');
game.load.image('angelDawn', 'assets/pics/game14_angel_dawn.png');
game.loader.load();
game.load.start();
}
+3 -3
View File
@@ -3,9 +3,9 @@
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
game.loader.addImageFile('dragonsun', 'assets/pics/cougar_dragonsun.png');
game.loader.addImageFile('overlay', 'assets/pics/scrollframe.png');
game.loader.load();
game.load.image('dragonsun', 'assets/pics/cougar_dragonsun.png');
game.load.image('overlay', 'assets/pics/scrollframe.png');
game.load.start();
}
var scroller;
function create() {
+3 -3
View File
@@ -7,10 +7,10 @@
function init() {
game.loader.addImageFile('dragonsun', 'assets/pics/cougar_dragonsun.png');
game.loader.addImageFile('overlay', 'assets/pics/scrollframe.png');
game.load.image('dragonsun', 'assets/pics/cougar_dragonsun.png');
game.load.image('overlay', 'assets/pics/scrollframe.png');
game.loader.load();
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
game.loader.addImageFile('crystal', 'assets/pics/jim_sachs_time_crystal.png');
game.loader.load();
game.load.image('crystal', 'assets/pics/jim_sachs_time_crystal.png');
game.load.start();
}
function create() {
// This creates our ScrollZone. It is positioned at x0 y0 (world coodinates) by default and uses
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
game.loader.addImageFile('crystal', 'assets/pics/jim_sachs_time_crystal.png');
game.loader.load();
game.load.image('crystal', 'assets/pics/jim_sachs_time_crystal.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
game.loader.addImageFile('balls', 'assets/sprites/balls.png');
game.loader.load();
game.load.image('balls', 'assets/sprites/balls.png');
game.load.start();
}
var leftFace;
var rightFace;
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
game.loader.addImageFile('balls', 'assets/sprites/balls.png');
game.loader.load();
game.load.image('balls', 'assets/sprites/balls.png');
game.load.start();
}
+2 -2
View File
@@ -5,8 +5,8 @@
// Using Phasers asset loader we load up a PNG from the assets folder
// The sprite sheet is a standard frame-by-frame sheet, and each frame is 37 x 45 pixels in size.
// The final parameter (18) is the number of frames there are. You can omit this if your frames fill the entire sheet.
game.loader.addSpriteSheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
game.loader.load();
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
game.load.start();
}
var mummy;
function create() {
+2 -2
View File
@@ -10,8 +10,8 @@
// The sprite sheet is a standard frame-by-frame sheet, and each frame is 37 x 45 pixels in size.
// The final parameter (18) is the number of frames there are. You can omit this if your frames fill the entire sheet.
game.loader.addSpriteSheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
game.loader.load();
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
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.loader.addSpriteSheet('monster', 'assets/sprites/metalslug_monster39x40.png', 39, 40);
game.loader.load();
game.load.spritesheet('monster', 'assets/sprites/metalslug_monster39x40.png', 39, 40);
game.load.start();
}
var monster;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addSpriteSheet('monster', 'assets/sprites/metalslug_monster39x40.png', 39, 40);
game.loader.load();
game.load.spritesheet('monster', 'assets/sprites/metalslug_monster39x40.png', 39, 40);
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
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.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}
function create() {
// This will create a Sprite positioned at the top-left of the game (0,0)
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
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.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}
var smallBunny;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
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.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}
var bigBunny;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
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.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}
var bunny;
function create() {
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}
+2 -2
View File
@@ -3,8 +3,8 @@
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.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}
var bunny;
var tweenUp;
+2 -2
View File
@@ -7,8 +7,8 @@
function init() {
// Using Phasers asset loader we load up a PNG from the assets folder
game.loader.addImageFile('bunny', 'assets/sprites/bunny.png');
game.loader.load();
game.load.image('bunny', 'assets/sprites/bunny.png');
game.load.start();
}

Some files were not shown because too many files have changed in this diff Show More