Skip to content

Commit 364492d

Browse files
committed
Added grunt file and npm package for OSX debs
1 parent 1217bf4 commit 364492d

7 files changed

Lines changed: 5751 additions & 13388 deletions

File tree

GruntFile.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = function (grunt) {
2+
grunt.loadNpmTasks('grunt-typescript');
3+
grunt.loadNpmTasks('grunt-contrib-watch');
4+
grunt.loadNpmTasks('grunt-contrib-copy');
5+
6+
grunt.initConfig({
7+
pkg: grunt.file.readJSON('package.json'),
8+
typescript: {
9+
base: {
10+
src: ['Phaser/**/*.ts'],
11+
dest: 'build/phaser.js',
12+
options: {
13+
target: 'ES5'
14+
}
15+
}
16+
},
17+
copy: {
18+
main: {
19+
files: [
20+
{src: 'build/phaser.js', dest: 'Tests/phaser.js'}
21+
]}
22+
},
23+
watch: {
24+
files: '**/*.ts',
25+
tasks: ['typescript', 'copy']
26+
}
27+
});
28+
29+
grunt.registerTask('default', ['watch']);
30+
31+
}

Phaser/gameobjects/GameObject.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,14 @@ module Phaser {
520520
this._angle = this._game.math.wrap(value, 360, 0);
521521
}
522522

523+
public set width(value:number) {
524+
this.bounds.width = value;
525+
}
526+
527+
public set height(value:number) {
528+
this.bounds.height = value;
529+
}
530+
523531
public get width(): number {
524532
return this.bounds.width;
525533
}

Phaser/gameobjects/Sprite.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// <reference path="../Game.ts" />
22
/// <reference path="../AnimationManager.ts" />
33
/// <reference path="GameObject.ts" />
4+
/// <reference path="../system/Camera.ts" />
45

56
/**
67
* Phaser - Sprite
@@ -125,15 +126,15 @@ module Phaser {
125126

126127
}
127128

128-
public set frame(value?: number) {
129+
public set frame(value: number) {
129130
this.animations.frame = value;
130131
}
131132

132133
public get frame(): number {
133134
return this.animations.frame;
134135
}
135136

136-
public set frameName(value?: string) {
137+
public set frameName(value: string) {
137138
this.animations.frameName = value;
138139
}
139140

@@ -228,7 +229,7 @@ module Phaser {
228229
this._dy -= (camera.worldView.y * this.scrollFactor.y);
229230
}
230231

231-
// Rotation
232+
// Rotation - needs to be set from origin
232233
if (this.angle !== 0)
233234
{
234235
this._game.stage.context.save();
@@ -287,7 +288,7 @@ module Phaser {
287288

288289
if (this.renderDebug)
289290
{
290-
this.renderBounds();
291+
this.renderBounds(camera, cameraOffsetX, cameraOffsetY);
291292
}
292293

293294
//if (this.flip === true || this.rotation !== 0)
@@ -306,7 +307,11 @@ module Phaser {
306307

307308
}
308309

309-
private renderBounds() {
310+
// Renders the bounding box around this Sprite and the contact points. Useful for visually debugging.
311+
private renderBounds(camera:Camera, cameraOffsetX:number, cameraOffsetY:number) {
312+
313+
this._dx = cameraOffsetX + (this.bounds.topLeft.x - camera.worldView.x);
314+
this._dy = cameraOffsetY + (this.bounds.topLeft.y - camera.worldView.y);
310315

311316
this._game.stage.context.fillStyle = this.renderDebugColor;
312317
this._game.stage.context.fillRect(this._dx, this._dy, this._dw, this._dh);

Phaser/phaser.js

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
/**
2-
* Phaser
3-
*
4-
* v0.9.1 - April 19th 2013
5-
*
6-
* A small and feature-packed 2D canvas game framework born from the firey pits of Flixel and Kiwi.
7-
*
8-
* Richard Davey (@photonstorm)
9-
*
10-
* Many thanks to Adam Saltsman (@ADAMATOMIC) for the original Flixel AS3 code on which Phaser is based.
11-
*
12-
* "If you want your children to be intelligent, read them fairy tales."
13-
* "If you want them to be more intelligent, read them more fairy tales."
14-
* -- Albert Einstein
15-
*/
16-
var Phaser;
17-
(function (Phaser) {
18-
Phaser.VERSION = 'Phaser version 0.9.1';
19-
})(Phaser || (Phaser = {}));
1+
var Phaser;
2+
(function (Phaser) {
3+
Phaser.VERSION = 'Phaser version 0.9.1';
4+
})(Phaser || (Phaser = {}));

0 commit comments

Comments
 (0)