Skip to content

Commit 669570c

Browse files
committed
Tidying up the examples and more Tilemap work.
1 parent af5847e commit 669570c

115 files changed

Lines changed: 372 additions & 11768 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Updates:
5555
* Updated Pixi.js so that removing filters now works correctly without breaking the display list.
5656
* Phaser.Canvas.create updated to it can be given an ID as the 3rd parameter.
5757
* Updated display/fullscreen example to reflect new full screen change.
58+
* Loads of updates to the TypeScript definitions files - games fully compile now and lots of missing classes added :)
59+
* Removed 'null parent' check from Group constructor. Will parent to game.world only if parent value is undefined.
5860

5961

6062
Bug Fixes:
@@ -66,7 +68,7 @@ Bug Fixes:
6668
* Group.length now returns the number of children in the Group regardless of their exists/alive state, or 0 if the Group is has no children.
6769
* Switch Camera.setBoundsToWorld to match world.bounds instead of world (thanks cocoademon)
6870
* Fixed an issue where passing null as the Group parent wouldn't set it to game.world as it should have (thanks tito100)
69-
* Fixed Pixi bug (#425) incorrect width property for multi-line Bitmap (thanks jcd-as)
71+
* Fixed Pixi bug (#425) incorrect width property for multi-line BitmapText (thanks jcd-as)
7072

7173

7274
You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md
@@ -81,6 +83,16 @@ We also provide a Grunt script that will build Phaser from source along with all
8183

8284
Run `grunt` in the phaser folder for a list of command-line options.
8385

86+
87+
Bower
88+
-----
89+
90+
If you use bowser you can install phaser with:
91+
92+
`bower install phaser`
93+
94+
Nice and easy :)
95+
8496
![Tanks](http://www.photonstorm.com/wp-content/uploads/2013/10/phaser_tanks-640x480.png)
8597

8698

bower.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "phaser",
3+
"version": "1.1.3",
4+
"homepage": "http://phaser.io",
5+
"authors": [
6+
"photonstorm <rich@photonstorm.com>"
7+
],
8+
"description": "A fun, free and fast 2D game framework for making HTML5 games for desktop and mobile, supporting Canvas and WebGL.",
9+
"main": "build/phaser.min.js",
10+
"keywords": [
11+
"html5",
12+
"game",
13+
"games",
14+
"framework",
15+
"canvas",
16+
"WebGL",
17+
"tilemaps",
18+
"physics",
19+
"sprites",
20+
"fonts",
21+
"images",
22+
"audio",
23+
"Web",
24+
"Audio",
25+
"touch",
26+
"input",
27+
"mobile"
28+
],
29+
"license": "MIT",
30+
"ignore": [
31+
"**/.*",
32+
"node_modules",
33+
"bower_components",
34+
"test",
35+
"tests"
36+
]
37+
}

build/phaser.d.ts

Lines changed: 123 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ declare module Phaser {
260260
}
261261

262262
class Game {
263-
constructor(width: number, height: number, renderer: number, parent: string, state: Object, transparent: boolean, antialias: boolean);
263+
constructor(width: number, height: number, renderer: number, parent: string, state: Object, transparent?: boolean, antialias?: boolean);
264264
id: number;
265265
width: number;
266266
height: number;
@@ -655,7 +655,7 @@ declare module Phaser {
655655
onAnimationStart: Phaser.Signal;
656656
onAnimationComplete: Phaser.Signal;
657657
onAnimationLoop: Phaser.Signal;
658-
}
658+
}
659659

660660
class GameObjectFactory {
661661
constructor(game: Phaser.Game);
@@ -687,7 +687,7 @@ declare module Phaser {
687687
type: number;
688688
renderOrderID: number;
689689
lifespan: number;
690-
events: Phaser.Event[];
690+
events: Phaser.Events;
691691
animations: Phaser.AnimationManager;
692692
input: Phaser.InputHandler;
693693
key: string;
@@ -707,8 +707,6 @@ declare module Phaser {
707707
bottomLeft: Phaser.Point;
708708
bounds: Phaser.Rectangle;
709709
body: Phaser.Physics.Arcade.Body;
710-
velocity: number;
711-
acceleration: number;
712710
inWorld: boolean;
713711
inWorldThreshold: number;
714712
angle: number;
@@ -731,6 +729,24 @@ declare module Phaser {
731729
getBounds(rect: Phaser.Rectangle): Phaser.Rectangle;
732730
}
733731

732+
class Events {
733+
parent: Phaser.Sprite;
734+
onAddedToGroup: Phaser.Signal;
735+
onRemovedFromGroup: Phaser.Signal;
736+
onKilled: Phaser.Signal;
737+
onRevived: Phaser.Signal;
738+
onOutOfBounds: Phaser.Signal;
739+
onInputOver: Phaser.Signal;
740+
onInputOut: Phaser.Signal;
741+
onInputDown: Phaser.Signal;
742+
onInputUp: Phaser.Signal;
743+
onDragStart: Phaser.Signal;
744+
onDragStop: Phaser.Signal;
745+
onAnimationStart: Phaser.Signal;
746+
onAnimationComplete: Phaser.Signal;
747+
onAnimationLoop: Phaser.Signal;
748+
}
749+
734750
class TileSprite {
735751
constructor(game: Phaser.Game, x: number, y: number, width: number, height: number, key?: string, frame?: number);
736752
texture: Phaser.RenderTexture;
@@ -1166,60 +1182,68 @@ declare module Phaser {
11661182
update(time: number): boolean;
11671183
}
11681184

1169-
class Easing {
1170-
Linear: {
1171-
None: (k: number) => number;
1172-
};
1173-
Quadratic: {
1174-
In: (k: number) => number;
1175-
Out: (k: number) => number;
1176-
InOut: (k: number) => number;
1177-
};
1178-
Cubic: {
1179-
In: (k: number) => number;
1180-
Out: (k: number) => number;
1181-
InOut: (k: number) => number;
1182-
};
1183-
Quartic: {
1184-
In: (k: number) => number;
1185-
Out: (k: number) => number;
1186-
InOut: (k: number) => number;
1187-
};
1188-
Quintic: {
1189-
In: (k: number) => number;
1190-
Out: (k: number) => number;
1191-
InOut: (k: number) => number;
1192-
};
1193-
Sinusoidal: {
1194-
In: (k: number) => number;
1195-
Out: (k: number) => number;
1196-
InOut: (k: number) => number;
1197-
};
1198-
Exponential: {
1199-
In: (k: number) => number;
1200-
Out: (k: number) => number;
1201-
InOut: (k: number) => number;
1202-
};
1203-
Circular: {
1204-
In: (k: number) => number;
1205-
Out: (k: number) => number;
1206-
InOut: (k: number) => number;
1207-
};
1208-
Elastic: {
1209-
In: (k: number) => number;
1210-
Out: (k: number) => number;
1211-
InOut: (k: number) => number;
1212-
};
1213-
Back: {
1214-
In: (k: number) => number;
1215-
Out: (k: number) => number;
1216-
InOut: (k: number) => number;
1217-
};
1218-
Bounce: {
1219-
In: (k: number) => number;
1220-
Out: (k: number) => number;
1221-
InOut: (k: number) => number;
1222-
};
1185+
class Easing.Linear {
1186+
static None(k: number);
1187+
}
1188+
1189+
class Easing.Quadratic {
1190+
static In(k: number);
1191+
static Out(k: number);
1192+
static InOut(k: number);
1193+
}
1194+
1195+
class Easing.Cubic {
1196+
static In(k: number);
1197+
static Out(k: number);
1198+
static InOut(k: number);
1199+
}
1200+
1201+
class Easing.Quartic {
1202+
static In(k: number);
1203+
static Out(k: number);
1204+
static InOut(k: number);
1205+
}
1206+
1207+
class Easing.Quintic {
1208+
static In(k: number);
1209+
static Out(k: number);
1210+
static InOut(k: number);
1211+
}
1212+
1213+
class Easing.Sinusoidal {
1214+
static In(k: number);
1215+
static Out(k: number);
1216+
static InOut(k: number);
1217+
}
1218+
1219+
class Easing.Exponential {
1220+
static In(k: number);
1221+
static Out(k: number);
1222+
static InOut(k: number);
1223+
}
1224+
1225+
class Easing.Circular {
1226+
static In(k: number);
1227+
static Out(k: number);
1228+
static InOut(k: number);
1229+
}
1230+
1231+
class Easing.Elastic {
1232+
static In(k: number);
1233+
static Out(k: number);
1234+
static InOut(k: number);
1235+
}
1236+
1237+
class Easing.Back {
1238+
static In(k: number);
1239+
static Out(k: number);
1240+
static InOut(k: number);
1241+
}
1242+
1243+
class Easing.Bounce {
1244+
static In(k: number);
1245+
static Out(k: number);
1246+
static InOut(k: number);
12231247
}
12241248

12251249
class Time {
@@ -1286,48 +1310,46 @@ declare module Phaser {
12861310
onComplete(): void;
12871311
}
12881312

1289-
module Animation {
1290-
class Frame {
1291-
constructor(index: number, x: number, y: number, width: number, height: number, name: string, uuid: string);
1292-
index: number;
1293-
x: number;
1294-
y: number;
1295-
width: number;
1296-
height: number;
1297-
centerX: number;
1298-
centerY: number;
1299-
distance: number;
1300-
name: string;
1301-
uuid: string;
1302-
rotated: boolean;
1303-
rotationDirection: string;
1304-
trimmed: boolean;
1305-
sourceSizeW: number;
1306-
sourceSizeH: number;
1307-
spriteSourceSizeX: number;
1308-
spriteSourceSizeY: number;
1309-
spriteSourceSizeW: number;
1310-
spriteSourcesizeH: number;
1311-
setTrim(trimmed: boolean, actualWidth: number, actualHeight: number, destX: number, destY: number, destWidth: number, destHeight: number): void;
1312-
}
1313+
class Frame {
1314+
constructor(index: number, x: number, y: number, width: number, height: number, name: string, uuid: string);
1315+
index: number;
1316+
x: number;
1317+
y: number;
1318+
width: number;
1319+
height: number;
1320+
centerX: number;
1321+
centerY: number;
1322+
distance: number;
1323+
name: string;
1324+
uuid: string;
1325+
rotated: boolean;
1326+
rotationDirection: string;
1327+
trimmed: boolean;
1328+
sourceSizeW: number;
1329+
sourceSizeH: number;
1330+
spriteSourceSizeX: number;
1331+
spriteSourceSizeY: number;
1332+
spriteSourceSizeW: number;
1333+
spriteSourcesizeH: number;
1334+
setTrim(trimmed: boolean, actualWidth: number, actualHeight: number, destX: number, destY: number, destWidth: number, destHeight: number): void;
1335+
}
13131336

1314-
class FrameData {
1315-
addFrame(frame: Frame): Frame;
1316-
getFrame(index: number): Frame;
1317-
getFrameByName(name: string): Frame;
1318-
checkFrame(name: string): boolean;
1319-
getFrameRange(start: number, end: number, output: Array<Frame>): Array<Frame>;
1320-
getFrames(frames: Array<number>, useNumericIndex?: boolean, output?: Array<Frame>): Array<Frame>;
1321-
getFrameIndexes(frames: Array<number>, useNumericIndex?: boolean, output?: Array<number>): Array<number>;
1322-
total: number;
1323-
}
1337+
class FrameData {
1338+
addFrame(frame: Frame): Frame;
1339+
getFrame(index: number): Frame;
1340+
getFrameByName(name: string): Frame;
1341+
checkFrame(name: string): boolean;
1342+
getFrameRange(start: number, end: number, output: Array<Frame>): Array<Frame>;
1343+
getFrames(frames: Array<number>, useNumericIndex?: boolean, output?: Array<Frame>): Array<Frame>;
1344+
getFrameIndexes(frames: Array<number>, useNumericIndex?: boolean, output?: Array<number>): Array<number>;
1345+
total: number;
1346+
}
13241347

1325-
class Parser {
1326-
spriteSheet(game: Phaser.Game, key: string, frameWidth: number, frameHeight: number, frameMax?: number): Phaser.Animation.FrameData;
1327-
JSONData(game: Phaser.Game, json: Object, cacheKey: string): Phaser.Animation.FrameData;
1328-
JSONDataHash(game: Phaser.Game, json: Object, cacheKey: string): Phaser.Animation.FrameData;
1329-
XMLData(game: Phaser.Game, xml: Object, cacheKey: string): Phaser.Animation.FrameData;
1330-
}
1348+
class AnimationParser {
1349+
spriteSheet(game: Phaser.Game, key: string, frameWidth: number, frameHeight: number, frameMax?: number): Phaser.Animation.FrameData;
1350+
JSONData(game: Phaser.Game, json: Object, cacheKey: string): Phaser.Animation.FrameData;
1351+
JSONDataHash(game: Phaser.Game, json: Object, cacheKey: string): Phaser.Animation.FrameData;
1352+
XMLData(game: Phaser.Game, xml: Object, cacheKey: string): Phaser.Animation.FrameData;
13311353
}
13321354

13331355
class Cache {
@@ -1420,10 +1442,8 @@ declare module Phaser {
14201442
nextFile(previousKey: string, success: boolean): void;
14211443
}
14221444

1423-
module Loader {
1424-
class Parser {
1425-
bitmapFont(game: Phaser.Game, xml: Object, cacheKey: Phaser.Animation.FrameData): void;
1426-
}
1445+
class LoaderParser {
1446+
bitmapFont(game: Phaser.Game, xml: Object, cacheKey: Phaser.Animation.FrameData): void;
14271447
}
14281448

14291449
class Sound {
126 KB
Loading

examples/display/bitmapdata wobble.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var waveDataCounter;
1717
function create() {
1818

1919
// Create our BitmapData object at a size of 32x64
20-
bmd = game.add.bitmapData('ball', 32, 64);
20+
bmd = game.add.bitmapData(32, 64);
2121

2222
// And apply it to 100 randomly positioned sprites
2323
for (var i = 0; i < 100; i++)
@@ -62,7 +62,7 @@ function updateWobblyBall()
6262

6363
// Now all the pixel data has been redrawn we render it to the BitmapData object.
6464
// In CANVAS mode this doesn't do anything, but on WebGL it pushes the new texture to the GPU.
65-
// If your game is exclusively running under Canvas you ca safely ignore this step.
65+
// If your game is exclusively running under Canvas you can safely ignore this step.
6666
bmd.render();
6767

6868
// Cycle through the wave data - this is what causes the image to "undulate"

examples/wip/bmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var bmd;
1414

1515
function create() {
1616

17-
bmd = game.add.bitmapData('ball', 32, 64);
17+
bmd = game.add.bitmapData(32, 64);
1818

1919
console.log(bmd);
2020

0 commit comments

Comments
 (0)