Preparing for new release

This commit is contained in:
Richard Davey
2013-04-18 14:16:18 +01:00
parent 72a4809dd8
commit 6bb4c5e3fc
165 changed files with 37278 additions and 29038 deletions
+36
View File
@@ -96,12 +96,48 @@
<TypeScriptCompile Include="sprites\dynamic texture 1.ts" />
</ItemGroup>
<ItemGroup>
<Content Include="tweens\bounce.js">
<DependentUpon>bounce.ts</DependentUpon>
</Content>
<Content Include="tweens\elastic.js">
<DependentUpon>elastic.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\elastic.ts" />
<TypeScriptCompile Include="tweens\bounce.ts" />
<TypeScriptCompile Include="sprites\animate by framename.ts" />
<TypeScriptCompile Include="geometry\rectangle.ts" />
<TypeScriptCompile Include="geometry\rect vs rect.ts" />
<TypeScriptCompile Include="geometry\circle.ts" />
<Content Include="geometry\circle.js">
<DependentUpon>circle.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geometry\point.ts" />
<TypeScriptCompile Include="geometry\line.ts" />
<Content Include="geometry\line.js">
<DependentUpon>line.ts</DependentUpon>
</Content>
<Content Include="geometry\point.js">
<DependentUpon>point.ts</DependentUpon>
</Content>
<Content Include="geometry\rect vs rect.js">
<DependentUpon>rect vs rect.ts</DependentUpon>
</Content>
<Content Include="geometry\rectangle.js">
<DependentUpon>rectangle.ts</DependentUpon>
</Content>
<Content Include="sprites\animate by framename.js">
<DependentUpon>animate by framename.ts</DependentUpon>
</Content>
<Content Include="sprites\dynamic texture 1.js">
<DependentUpon>dynamic texture 1.ts</DependentUpon>
</Content>
<Content Include="sprites\dynamic texture 2.js">
<DependentUpon>dynamic texture 2.ts</DependentUpon>
</Content>
<Content Include="sprites\rotation.js">
<DependentUpon>rotation.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="sprites\rotation.ts" />
<TypeScriptCompile Include="sprites\dynamic texture 2.ts" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" />
+11 -11
View File
@@ -1,7 +1,7 @@
{"frames": [
{
"filename": "running bot.swf/0000",
"filename": "run00",
"frame": {"x":34,"y":128,"w":56,"h":60},
"rotated": false,
"trimmed": true,
@@ -9,7 +9,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0001",
"filename": "run01",
"frame": {"x":54,"y":0,"w":56,"h":58},
"rotated": false,
"trimmed": true,
@@ -17,7 +17,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0002",
"filename": "run02",
"frame": {"x":54,"y":58,"w":56,"h":58},
"rotated": false,
"trimmed": true,
@@ -25,7 +25,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0003",
"filename": "run03",
"frame": {"x":0,"y":192,"w":34,"h":64},
"rotated": false,
"trimmed": true,
@@ -33,7 +33,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0004",
"filename": "run04",
"frame": {"x":0,"y":64,"w":54,"h":64},
"rotated": false,
"trimmed": true,
@@ -41,7 +41,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0005",
"filename": "run05",
"frame": {"x":196,"y":0,"w":56,"h":58},
"rotated": false,
"trimmed": true,
@@ -49,7 +49,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0006",
"filename": "run06",
"frame": {"x":0,"y":0,"w":54,"h":64},
"rotated": false,
"trimmed": true,
@@ -57,7 +57,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0007",
"filename": "run07",
"frame": {"x":140,"y":0,"w":56,"h":58},
"rotated": false,
"trimmed": true,
@@ -65,7 +65,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0008",
"filename": "run08",
"frame": {"x":34,"y":188,"w":50,"h":60},
"rotated": false,
"trimmed": true,
@@ -73,7 +73,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0009",
"filename": "run09",
"frame": {"x":0,"y":128,"w":34,"h":64},
"rotated": false,
"trimmed": true,
@@ -81,7 +81,7 @@
"sourceSize": {"w":56,"h":64}
},
{
"filename": "running bot.swf/0010",
"filename": "run10",
"frame": {"x":84,"y":188,"w":56,"h":58},
"rotated": false,
"trimmed": true,
+8 -8
View File
@@ -1,6 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(2240, 2240);
myGame.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
@@ -12,10 +12,10 @@
function create() {
myGame.createSprite(0, 0, 'grid');
car = myGame.createSprite(400, 300, 'car');
myGame.camera.follow(car, Camera.STYLE_TOPDOWN);
myGame.camera.follow(car, Phaser.Camera.STYLE_TOPDOWN);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam = myGame.createCamera(0, 0, 300, 300);
miniCam.follow(car, Camera.STYLE_TOPDOWN_TIGHT);
miniCam.follow(car, Phaser.Camera.STYLE_TOPDOWN_TIGHT);
miniCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam.showBorder = true;
miniCam.alpha = 0.7;
@@ -25,13 +25,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
+10 -10
View File
@@ -1,8 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -15,8 +15,8 @@
}
var car: Sprite;
var miniCam: Camera;
var car: Phaser.Sprite;
var miniCam: Phaser.Camera;
function create() {
@@ -24,11 +24,11 @@
car = myGame.createSprite(400, 300, 'car');
myGame.camera.follow(car, Camera.STYLE_TOPDOWN);
myGame.camera.follow(car, Phaser.Camera.STYLE_TOPDOWN);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam = myGame.createCamera(0, 0, 300, 300);
miniCam.follow(car, Camera.STYLE_TOPDOWN_TIGHT);
miniCam.follow(car, Phaser.Camera.STYLE_TOPDOWN_TIGHT);
miniCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam.showBorder = true;
miniCam.alpha = 0.7;
@@ -42,18 +42,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(1920, 1200);
myGame.camera.setBounds(0, 0, 1920, 1200);
@@ -17,14 +16,14 @@
}
function update() {
myGame.camera.renderDebugInfo(32, 32);
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
} else if(myGame.input.keyboard.isDown(Keyboard.DOWN)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
}
}
+6 -7
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -32,20 +31,20 @@
myGame.camera.renderDebugInfo(32, 32);
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
}
else if (myGame.input.keyboard.isDown(Keyboard.DOWN))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
}
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(3000, 3000);
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
@@ -23,17 +22,17 @@
function update() {
myGame.camera.renderDebugInfo(16, 16);
cam2.renderDebugInfo(200, 16);
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.x -= 4;
cam2.x -= 2;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.x += 4;
cam2.x += 2;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.y -= 4;
cam2.y -= 2;
} else if(myGame.input.keyboard.isDown(Keyboard.DOWN)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.y += 4;
cam2.y += 2;
}
+7 -8
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -15,7 +14,7 @@
}
var cam2: Camera;
var cam2: Phaser.Camera;
function create() {
@@ -40,23 +39,23 @@
myGame.camera.renderDebugInfo(16, 16);
cam2.renderDebugInfo(200, 16);
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.x -= 4;
cam2.x -= 2;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.x += 4;
cam2.x += 2;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.y -= 4;
cam2.y -= 2;
}
else if (myGame.input.keyboard.isDown(Keyboard.DOWN))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.y += 4;
cam2.y += 2;
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(3000, 3000);
myGame.loader.addImageFile('car', 'assets/sprites/car.png');
@@ -21,14 +20,14 @@
}
function update() {
myGame.camera.renderDebugInfo(600, 32);
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.rotation -= 2;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.rotation += 2;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
} else if(myGame.input.keyboard.isDown(Keyboard.DOWN)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
}
}
+6 -7
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -39,20 +38,20 @@
myGame.camera.renderDebugInfo(600, 32);
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.rotation -= 2;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.rotation += 2;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
}
else if (myGame.input.keyboard.isDown(Keyboard.DOWN))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
}
+9 -10
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(2240, 2240);
myGame.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
@@ -15,15 +14,15 @@
myGame.createSprite(0, 0, 'grid');
car = myGame.createSprite(400, 300, 'car');
myGame.camera.follow(car);
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam = myGame.createCamera(600, 32, 200, 200);
miniCam.follow(car, Camera.STYLE_LOCKON);
miniCam.follow(car, Phaser.Camera.STYLE_LOCKON);
miniCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam.showBorder = true;
miniCam.scale.setTo(0.5, 0.5);
bigCam = myGame.createCamera(32, 32, 200, 200);
bigCam.follow(car, Camera.STYLE_LOCKON);
bigCam.follow(car, Phaser.Camera.STYLE_LOCKON);
bigCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
bigCam.showBorder = true;
bigCam.scale.setTo(2, 2);
@@ -33,13 +32,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
+12 -13
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -16,9 +15,9 @@
}
var car: Sprite;
var miniCam: Camera;
var bigCam: Camera;
var car: Phaser.Sprite;
var miniCam: Phaser.Camera;
var bigCam: Phaser.Camera;
function create() {
@@ -27,17 +26,17 @@
car = myGame.createSprite(400, 300, 'car');
myGame.camera.follow(car);
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam = myGame.createCamera(600, 32, 200, 200);
miniCam.follow(car, Camera.STYLE_LOCKON);
miniCam.follow(car, Phaser.Camera.STYLE_LOCKON);
miniCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam.showBorder = true;
miniCam.scale.setTo(0.5, 0.5);
bigCam = myGame.createCamera(32, 32, 200, 200);
bigCam.follow(car, Camera.STYLE_LOCKON);
bigCam.follow(car, Phaser.Camera.STYLE_LOCKON);
bigCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
bigCam.showBorder = true;
bigCam.scale.setTo(2, 2);
@@ -51,18 +50,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+9 -10
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(2240, 2240);
myGame.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
@@ -15,16 +14,16 @@
myGame.createSprite(0, 0, 'grid');
car = myGame.createSprite(400, 300, 'car');
myGame.camera.follow(car);
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam = myGame.createCamera(600, 32, 200, 200);
miniCam.follow(car, Camera.STYLE_LOCKON);
miniCam.follow(car, Phaser.Camera.STYLE_LOCKON);
miniCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam.showBorder = true;
miniCam.scale.setTo(0.5, 0.5);
miniCam.showShadow = true;
bigCam = myGame.createCamera(32, 32, 200, 200);
bigCam.follow(car, Camera.STYLE_LOCKON);
bigCam.follow(car, Phaser.Camera.STYLE_LOCKON);
bigCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
bigCam.showBorder = true;
bigCam.scale.setTo(2, 2);
@@ -35,13 +34,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
+12 -13
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -16,9 +15,9 @@
}
var car: Sprite;
var miniCam: Camera;
var bigCam: Camera;
var car: Phaser.Sprite;
var miniCam: Phaser.Camera;
var bigCam: Phaser.Camera;
function create() {
@@ -27,18 +26,18 @@
car = myGame.createSprite(400, 300, 'car');
myGame.camera.follow(car);
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam = myGame.createCamera(600, 32, 200, 200);
miniCam.follow(car, Camera.STYLE_LOCKON);
miniCam.follow(car, Phaser.Camera.STYLE_LOCKON);
miniCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam.showBorder = true;
miniCam.scale.setTo(0.5, 0.5);
miniCam.showShadow = true;
bigCam = myGame.createCamera(32, 32, 200, 200);
bigCam.follow(car, Camera.STYLE_LOCKON);
bigCam.follow(car, Phaser.Camera.STYLE_LOCKON);
bigCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
bigCam.showBorder = true;
bigCam.scale.setTo(2, 2);
@@ -53,18 +52,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+7 -8
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(2240, 2240);
myGame.loader.addImageFile('balls', 'assets/sprites/balls.png');
@@ -16,7 +15,7 @@
car = myGame.createSprite(400, 300, 'car');
myGame.camera.setTexture('balls');
myGame.camera.follow(car);
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
//miniCam = myGame.createCamera(600, 32, 200, 200);
//miniCam.follow(car, Camera.STYLE_LOCKON);
@@ -34,13 +33,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
+10 -11
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -16,9 +15,9 @@
}
var car: Sprite;
var miniCam: Camera;
var bigCam: Camera;
var car: Phaser.Sprite;
var miniCam: Phaser.Camera;
var bigCam: Phaser.Camera;
function create() {
@@ -28,7 +27,7 @@
myGame.camera.setTexture('balls');
myGame.camera.follow(car);
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
//miniCam = myGame.createCamera(600, 32, 200, 200);
@@ -52,18 +51,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('background', 'assets/pics/large-color-wheel.png');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
@@ -18,13 +17,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
// Fade when the car hits the edges, a different colour per edge
+7 -8
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -14,7 +13,7 @@
}
var car: Sprite;
var car: Phaser.Sprite;
function create() {
@@ -33,18 +32,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('background', 'assets/pics/large-color-wheel.png');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
@@ -18,13 +17,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
// Flash when the car hits the edges, a different colour per edge
+7 -8
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -14,7 +13,7 @@
}
var car: Sprite;
var car: Phaser.Sprite;
function create() {
@@ -33,18 +32,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(1920, 1920);
myGame.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
@@ -24,13 +23,13 @@
function update() {
myGame.camera.renderDebugInfo(32, 32);
melon.renderDebugInfo(200, 32);
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.focusOnXY(640, 640);
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.focusOnXY(1234, 800);
} else if(myGame.input.keyboard.isDown(Keyboard.UP)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.focusOnXY(50, 200);
} else if(myGame.input.keyboard.isDown(Keyboard.DOWN)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.focusOnXY(1700, 1700);
}
}
+7 -8
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -17,7 +16,7 @@
}
var melon: Sprite;
var melon: Phaser.Sprite;
function create() {
@@ -41,19 +40,19 @@
myGame.camera.renderDebugInfo(32, 32);
melon.renderDebugInfo(200, 32);
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.focusOnXY(640, 640);
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.focusOnXY(1234, 800);
}
else if (myGame.input.keyboard.isDown(Keyboard.UP))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.focusOnXY(50, 200);
}
else if (myGame.input.keyboard.isDown(Keyboard.DOWN))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.focusOnXY(1700, 1700);
}
+7 -8
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(2240, 2240);
myGame.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
@@ -14,7 +13,7 @@
car = myGame.createSprite(400, 300, 'car');
myGame.camera.follow(car);
// Here we'll set our own custom deadzone which is 64px smaller than the stage size on all sides
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
}
function update() {
@@ -24,13 +23,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
+8 -9
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -16,7 +15,7 @@
}
var car: Sprite;
var car: Phaser.Sprite;
function create() {
@@ -26,7 +25,7 @@
myGame.camera.follow(car);
// Here we'll set our own custom deadzone which is 64px smaller than the stage size on all sides
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
}
@@ -41,18 +40,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(1920, 1920);
myGame.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
@@ -21,13 +20,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
+6 -7
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -38,18 +37,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+7 -8
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(2240, 2240);
myGame.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
@@ -12,7 +11,7 @@
function create() {
myGame.createSprite(0, 0, 'grid');
car = myGame.createSprite(400, 300, 'car');
myGame.camera.follow(car, Camera.STYLE_TOPDOWN);
myGame.camera.follow(car, Phaser.Camera.STYLE_TOPDOWN);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
}
function update() {
@@ -22,13 +21,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
+8 -9
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -16,7 +15,7 @@
}
var car: Sprite;
var car: Phaser.Sprite;
function create() {
@@ -24,7 +23,7 @@
car = myGame.createSprite(400, 300, 'car');
myGame.camera.follow(car, Camera.STYLE_TOPDOWN);
myGame.camera.follow(car, Phaser.Camera.STYLE_TOPDOWN);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
}
@@ -39,18 +38,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(3000, 3000);
myGame.loader.addImageFile('car', 'assets/sprites/car.png');
@@ -27,17 +26,17 @@
function update() {
myGame.camera.renderDebugInfo(16, 16);
cam2.renderDebugInfo(200, 16);
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
cam2.scroll.x -= 2;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
cam2.scroll.x += 2;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
cam2.scroll.y -= 2;
} else if(myGame.input.keyboard.isDown(Keyboard.DOWN)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
cam2.scroll.y += 2;
}
+7 -8
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -17,7 +16,7 @@
}
var cam2: Camera;
var cam2: Phaser.Camera;
function create() {
@@ -44,23 +43,23 @@
myGame.camera.renderDebugInfo(16, 16);
cam2.renderDebugInfo(200, 16);
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
cam2.scroll.x -= 2;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
cam2.scroll.x += 2;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
cam2.scroll.y -= 2;
}
else if (myGame.input.keyboard.isDown(Keyboard.DOWN))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
cam2.scroll.y += 2;
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(1920, 1200);
myGame.loader.addImageFile('backdrop', 'assets/pics/remember-me.jpg');
@@ -24,14 +23,14 @@
function update() {
myGame.camera.renderDebugInfo(32, 32);
melon.renderDebugInfo(200, 32);
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 1;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 1;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 1;
} else if(myGame.input.keyboard.isDown(Keyboard.DOWN)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 1;
}
}
+7 -8
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -17,7 +16,7 @@
}
var melon: Sprite;
var melon: Phaser.Sprite;
function create() {
@@ -41,20 +40,20 @@
myGame.camera.renderDebugInfo(32, 32);
melon.renderDebugInfo(200, 32);
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 1;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 1;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 1;
}
else if (myGame.input.keyboard.isDown(Keyboard.DOWN))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 1;
}
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('background', 'assets/pics/remember-me.jpg');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
@@ -18,13 +17,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
// Shake the camera when the car hits the edges, a different intensity per edge
+7 -8
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -14,7 +13,7 @@
}
var car: Sprite;
var car: Phaser.Sprite;
function create() {
@@ -33,18 +32,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
@@ -20,13 +19,13 @@
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
car.velocity.copyFrom(myGame.math.velocityFromAngle(car.angle, 200));
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 200));
}
myGame.collide(car, melon, collides);
}
+8 -9
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -14,8 +13,8 @@
}
var car: Sprite;
var melon: Sprite;
var car: Phaser.Sprite;
var melon: Phaser.Sprite;
function create() {
@@ -35,18 +34,18 @@
car.velocity.y = 0;
car.angularVelocity = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.math.velocityFromAngle(car.angle, 200));
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 200));
}
myGame.collide(car, melon, collides);
+5 -6
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('ball0', 'assets/sprites/yellow_ball.png');
myGame.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
@@ -19,7 +18,7 @@
atari.immovable = true;
balls = myGame.createGroup();
for(var i = 0; i < 100; i++) {
var tempBall = new Sprite(myGame, Math.random() * myGame.stage.width, -32, 'ball' + Math.round(Math.random() * 5));
var tempBall = new Phaser.Sprite(myGame, Math.random() * myGame.stage.width, -32, 'ball' + Math.round(Math.random() * 5));
tempBall.velocity.y = 100 + Math.random() * 150;
tempBall.elasticity = 0.9;
balls.add(tempBall);
@@ -27,9 +26,9 @@
}
function update() {
atari.velocity.x = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
atari.velocity.x = -400;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
atari.velocity.x = 400;
}
balls.forEach(checkOffScreen, false);
+8 -9
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -19,8 +18,8 @@
}
var atari: Sprite;
var balls: Group;
var atari: Phaser.Sprite;
var balls: Phaser.Group;
function create() {
@@ -31,7 +30,7 @@
for (var i = 0; i < 100; i++)
{
var tempBall: Sprite = new Sprite(myGame, Math.random() * myGame.stage.width, -32, 'ball' + Math.round(Math.random() * 5));
var tempBall: Phaser.Sprite = new Phaser.Sprite(myGame, Math.random() * myGame.stage.width, -32, 'ball' + Math.round(Math.random() * 5));
tempBall.velocity.y = 100 + Math.random() * 150;
tempBall.elasticity = 0.9;
balls.add(tempBall);
@@ -43,11 +42,11 @@
atari.velocity.x = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
atari.velocity.x = -400;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
atari.velocity.x = 400;
}
@@ -58,7 +57,7 @@
}
function checkOffScreen(ball:Sprite) {
function checkOffScreen(ball:Phaser.Sprite) {
if (ball.y < -32 || ball.y > myGame.stage.height || ball.x < 0 || ball.x > myGame.stage.width)
{
+19
View File
@@ -0,0 +1,19 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var circle;
var floor;
function create() {
circle = myGame.createGeomSprite(200, 0);
circle.createCircle(64);
circle.acceleration.y = 100;
circle.elasticity = 0.8;
// A simple floor
floor = myGame.createGeomSprite(0, 550);
floor.createRectangle(800, 50);
floor.immovable = true;
}
function update() {
myGame.collide(circle, floor);
}
})();
+30
View File
@@ -0,0 +1,30 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var circle: Phaser.GeomSprite;
var floor: Phaser.GeomSprite;
function create() {
circle = myGame.createGeomSprite(200, 0);
circle.createCircle(64);
circle.acceleration.y = 100;
circle.elasticity = 0.8;
// A simple floor
floor = myGame.createGeomSprite(0, 550);
floor.createRectangle(800, 50);
floor.immovable = true;
}
function update() {
myGame.collide(circle, floor);
}
})();
+27
View File
@@ -0,0 +1,27 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var line;
function create() {
line = myGame.createGeomSprite(200, 200);
line.createLine(400, 400);
}
function update() {
//box.velocity.x = 0;
//box.velocity.y = 0;
//box.angularVelocity = 0;
//box.angularAcceleration = 0;
//if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
//{
// box.angularVelocity = -200;
//}
//else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
//{
// box.angularVelocity = 200;
//}
//if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
//{
// box.velocity.copyFrom(myGame.motion.velocityFromAngle(box.angle, 200));
//}
}
})();
+40
View File
@@ -0,0 +1,40 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var line: Phaser.GeomSprite;
function create() {
line = myGame.createGeomSprite(200, 200);
line.createLine(400, 400);
}
function update() {
//box.velocity.x = 0;
//box.velocity.y = 0;
//box.angularVelocity = 0;
//box.angularAcceleration = 0;
//if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
//{
// box.angularVelocity = -200;
//}
//else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
//{
// box.angularVelocity = 200;
//}
//if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
//{
// box.velocity.copyFrom(myGame.motion.velocityFromAngle(box.angle, 200));
//}
}
})();
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var floor;
function create() {
for(var i = 0; i < 100; i++) {
var p = myGame.createGeomSprite(myGame.stage.randomX, Math.random() * 100);
p.createPoint();
p.fillColor = 'rgb(255,255,255)';
p.acceleration.y = 100 + Math.random() * 100;
p.elasticity = 0.8;
}
// A simple floor
floor = myGame.createGeomSprite(0, 550);
floor.createRectangle(800, 50);
floor.immovable = true;
}
function update() {
myGame.collide(myGame.world.group, floor);
}
})();
+33
View File
@@ -0,0 +1,33 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var floor: Phaser.GeomSprite;
function create() {
for (var i = 0; i < 100; i++)
{
var p:Phaser.GeomSprite = myGame.createGeomSprite(myGame.stage.randomX, Math.random() * 100);
p.createPoint();
p.fillColor = 'rgb(255,255,255)';
p.acceleration.y = 100 + Math.random() * 100;
p.elasticity = 0.8;
}
// A simple floor
floor = myGame.createGeomSprite(0, 550);
floor.createRectangle(800, 50);
floor.immovable = true;
}
function update() {
myGame.collide(myGame.world.group, floor);
}
})();
+18
View File
@@ -0,0 +1,18 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var box1;
var box2;
function create() {
box2 = myGame.createGeomSprite(300, 300).createRectangle(128, 128);
box1 = myGame.createGeomSprite(320, 100).createRectangle(64, 64);
box1.velocity.y = 50;
}
function update() {
if(box1.collide(box2) == true) {
box1.fillColor = 'rgb(255,0,0)';
} else {
box1.fillColor = 'rgb(0,255,0)';
}
}
})();
+32
View File
@@ -0,0 +1,32 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var box1: Phaser.GeomSprite;
var box2: Phaser.GeomSprite;
function create() {
box2 = myGame.createGeomSprite(300, 300).createRectangle(128, 128);
box1 = myGame.createGeomSprite(320, 100).createRectangle(64, 64);
box1.velocity.y = 50;
}
function update() {
if (box1.collide(box2) == true)
{
box1.fillColor = 'rgb(255,0,0)';
}
else
{
box1.fillColor = 'rgb(0,255,0)';
}
}
})();
+23
View File
@@ -0,0 +1,23 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var box;
function create() {
box = myGame.createGeomSprite(200, 200);
box.createRectangle(64, 64);
}
function update() {
box.velocity.x = 0;
box.velocity.y = 0;
box.angularVelocity = 0;
box.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
box.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
box.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
box.velocity.copyFrom(myGame.motion.velocityFromAngle(box.angle, 200));
}
}
})();
+40
View File
@@ -0,0 +1,40 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var box: Phaser.GeomSprite;
function create() {
box = myGame.createGeomSprite(200, 200);
box.createRectangle(64, 64);
}
function update() {
box.velocity.x = 0;
box.velocity.y = 0;
box.angularVelocity = 0;
box.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
box.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
box.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
box.velocity.copyFrom(myGame.motion.velocityFromAngle(box.angle, 200));
}
}
})();
+6 -8
View File
@@ -1,8 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Group.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(1920, 1920);
myGame.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
@@ -28,13 +26,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
+8 -10
View File
@@ -1,10 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Group.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -18,8 +16,8 @@
}
var car: Sprite;
var melons: Group;
var car: Phaser.Sprite;
var melons: Phaser.Group;
function create() {
@@ -47,18 +45,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+7 -8
View File
@@ -1,14 +1,13 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
// Here we create a quite tiny game (320x240 in size)
var myGame = new Game(this, 'game', 320, 240, init, create, update);
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update);
function init() {
// This sets a limit on the up-scale
myGame.stage.maxScaleX = 640;
myGame.stage.maxScaleY = 480;
// Then we tell Phaser that we want it to scale up to whatever the browser can handle, but to do it proportionally
myGame.stage.scaleMode = StageScaleMode.SHOW_ALL;
myGame.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
@@ -20,14 +19,14 @@
myGame.onRenderCallback = render;
}
function update() {
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
} else if(myGame.input.keyboard.isDown(Keyboard.DOWN)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
}
}
+7 -8
View File
@@ -1,10 +1,9 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
// Here we create a quite tiny game (320x240 in size)
var myGame = new Game(this, 'game', 320, 240, init, create, update);
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update);
function init() {
@@ -12,7 +11,7 @@
myGame.stage.maxScaleX = 640;
myGame.stage.maxScaleY = 480;
// Then we tell Phaser that we want it to scale up to whatever the browser can handle, but to do it proportionally
myGame.stage.scaleMode = StageScaleMode.SHOW_ALL;
myGame.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
@@ -35,20 +34,20 @@
function update() {
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
}
else if (myGame.input.keyboard.isDown(Keyboard.DOWN))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
}
+8 -9
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 840, 400, init, create, update);
var myGame = new Phaser.Game(this, 'game', 840, 400, init, create, update);
function init() {
myGame.loader.addImageFile('track', 'assets/games/f1/track.png');
myGame.loader.addImageFile('car', 'assets/games/f1/car1.png');
@@ -16,22 +15,22 @@
car.rotation = 180;
car.maxVelocity.setTo(150, 150);
bigCam = myGame.createCamera(640, 0, 100, 200);
bigCam.follow(car, Camera.STYLE_LOCKON);
bigCam.follow(car, Phaser.Camera.STYLE_LOCKON);
bigCam.setBounds(0, 0, myGame.stage.width, myGame.stage.height);
bigCam.showBorder = true;
bigCam.borderColor = 'rgb(0,0,0)';
bigCam.scale.setTo(2, 2);
}
function update() {
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.rotation -= 4;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.rotation += 4;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
car.velocity.copyFrom(myGame.math.velocityFromAngle(car.angle, 150));
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 150));
} else {
car.velocity.copyFrom(myGame.math.velocityFromAngle(car.angle, 60));
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 60));
}
}
})();
+10 -11
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 840, 400, init, create, update);
var myGame = new Phaser.Game(this, 'game', 840, 400, init, create, update);
function init() {
@@ -14,8 +13,8 @@
}
var car: Sprite;
var bigCam: Camera;
var car: Phaser.Sprite;
var bigCam: Phaser.Camera;
function create() {
@@ -27,7 +26,7 @@
car.maxVelocity.setTo(150, 150);
bigCam = myGame.createCamera(640, 0, 100, 200);
bigCam.follow(car, Camera.STYLE_LOCKON);
bigCam.follow(car, Phaser.Camera.STYLE_LOCKON);
bigCam.setBounds(0, 0, myGame.stage.width, myGame.stage.height);
bigCam.showBorder = true;
bigCam.borderColor = 'rgb(0,0,0)';
@@ -37,22 +36,22 @@
function update() {
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.rotation -= 4;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.rotation += 4;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.math.velocityFromAngle(car.angle, 150));
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 150));
}
else
{
car.velocity.copyFrom(myGame.math.velocityFromAngle(car.angle, 60));
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 60));
}
}
+11 -12
View File
@@ -1,10 +1,9 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
// Let's test having 2 totally separate games embedded on the same page
var myGame = new Game(this, 'game', 400, 400, init, create, update);
var myGame = new Phaser.Game(this, 'game', 400, 400, init, create, update);
// They can share the same parent div, they'll just butt-up next to each other
var myGame2 = new Game(this, 'game', 400, 400, init2, create2, update2);
var myGame2 = new Phaser.Game(this, 'game', 400, 400, init2, create2, update2);
function init() {
myGame.world.setSize(3000, 3000);
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
@@ -17,14 +16,14 @@
}
}
function update() {
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y += 4;
} else if(myGame.input.keyboard.isDown(Keyboard.DOWN)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y -= 4;
}
}
@@ -47,13 +46,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame2.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame2.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame2.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame2.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame2.input.keyboard.isDown(Keyboard.UP)) {
car.velocity.copyFrom(myGame2.math.velocityFromAngle(car.angle, 300));
if(myGame2.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
}
})();
+11 -12
View File
@@ -1,13 +1,12 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
// Let's test having 2 totally separate games embedded on the same page
var myGame = new Game(this, 'game', 400, 400, init, create, update);
var myGame = new Phaser.Game(this, 'game', 400, 400, init, create, update);
// They can share the same parent div, they'll just butt-up next to each other
var myGame2 = new Game(this, 'game', 400, 400, init2, create2, update2);
var myGame2 = new Phaser.Game(this, 'game', 400, 400, init2, create2, update2);
function init() {
@@ -32,20 +31,20 @@
function update() {
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y += 4;
}
else if (myGame.input.keyboard.isDown(Keyboard.DOWN))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y -= 4;
}
@@ -86,18 +85,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame2.input.keyboard.isDown(Keyboard.LEFT))
if (myGame2.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame2.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame2.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame2.input.keyboard.isDown(Keyboard.UP))
if (myGame2.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame2.math.velocityFromAngle(car.angle, 300));
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
}
+2 -4
View File
@@ -1,8 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, null, create);
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create);
var emitter;
function create() {
// Creates a basic emitter, bursting out 50 default sprites (i.e. 16x16 white boxes)
+3 -5
View File
@@ -1,12 +1,10 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, null, create);
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create);
var emitter: Emitter;
var emitter: Phaser.Emitter;
function create() {
+2 -4
View File
@@ -1,8 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
var emitter;
function init() {
myGame.loader.addImageFile('jet', 'assets/sprites/jets.png');
+3 -5
View File
@@ -1,12 +1,10 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
var emitter: Emitter;
var emitter: Phaser.Emitter;
function init() {
+2 -4
View File
@@ -1,8 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
var emitter1;
var emitter2;
var emitter3;
+8 -10
View File
@@ -1,17 +1,15 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
var emitter1: Emitter;
var emitter2: Emitter;
var emitter3: Emitter;
var emitter4: Emitter;
var emitter5: Emitter;
var emitter6: Emitter;
var emitter1: Phaser.Emitter;
var emitter2: Phaser.Emitter;
var emitter3: Phaser.Emitter;
var emitter4: Phaser.Emitter;
var emitter5: Phaser.Emitter;
var emitter6: Phaser.Emitter;
function init() {
+4 -4
View File
@@ -4,8 +4,8 @@ var __extends = this.__extends || function (d, b) {
d.prototype = new __();
};
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/gameobjects/Particle.ts" />
/// <reference path="../../Phaser/gameobjects/Emitter.ts" />
// Actually we could achieve the same result as this by using a sprite sheet and basic Particle
// but it still shows you how to use it properly from TypeScript, so it was worth making
var customParticle = (function (_super) {
@@ -22,9 +22,9 @@ var customParticle = (function (_super) {
this.loadGraphic(game.math.getRandom(s));
}
return customParticle;
})(Particle);
})(Phaser.Particle);
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
var emitter;
function init() {
myGame.loader.addImageFile('carrot', 'assets/sprites/carrot.png');
+6 -6
View File
@@ -1,12 +1,12 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/gameobjects/Particle.ts" />
/// <reference path="../../Phaser/gameobjects/Emitter.ts" />
// Actually we could achieve the same result as this by using a sprite sheet and basic Particle
// but it still shows you how to use it properly from TypeScript, so it was worth making
class customParticle extends Particle {
class customParticle extends Phaser.Particle {
constructor(game:Game) {
constructor(game:Phaser.Game) {
super(game);
@@ -19,9 +19,9 @@ class customParticle extends Particle {
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
var emitter: Emitter;
var emitter: Phaser.Emitter;
function init() {
+2 -4
View File
@@ -1,8 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
var leftEmitter;
var rightEmitter;
function init() {
+4 -6
View File
@@ -1,13 +1,11 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Emitter.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
var leftEmitter: Emitter;
var rightEmitter: Emitter;
var leftEmitter: Phaser.Emitter;
var rightEmitter: Phaser.Emitter;
function init() {
+11113 -8752
View File
File diff suppressed because it is too large Load Diff
+34
View File
@@ -0,0 +1,34 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addTextureAtlas('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
myGame.loader.load();
}
var bot;
function create() {
bot = myGame.createSprite(myGame.stage.width, 300, 'bot');
// If you are using a Texture Atlas and want to specify the frames of an animation by their name rather than frame index
// then you can use this format:
bot.animations.add('run', [
'run00',
'run01',
'run02',
'run03',
'run04',
'run05',
'run06',
'run07',
'run08',
'run09',
'run10'
], 10, true, false);
bot.animations.play('run');
bot.velocity.x = -100;
}
function update() {
if(bot.x < -bot.width) {
bot.x = myGame.stage.width;
}
}
})();
+40
View File
@@ -0,0 +1,40 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addTextureAtlas('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
myGame.loader.load();
}
var bot: Phaser.Sprite;
function create() {
bot = myGame.createSprite(myGame.stage.width, 300, 'bot');
// If you are using a Texture Atlas and want to specify the frames of an animation by their name rather than frame index
// then you can use this format:
bot.animations.add('run', ['run00', 'run01', 'run02', 'run03', 'run04', 'run05', 'run06', 'run07', 'run08', 'run09', 'run10'], 10, true, false);
bot.animations.play('run');
bot.velocity.x = -100;
}
function update() {
if (bot.x < -bot.width)
{
bot.x = myGame.stage.width;
}
}
})();
+6 -7
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addSpriteSheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
//myGame.loader.addSpriteSheet('coin', 'assets/sprites/coin.png', 32, 32);
@@ -21,13 +20,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
car.velocity.copyFrom(myGame.math.velocityFromAngle(car.angle, 200));
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 200));
}
}
})();
+7 -8
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -15,7 +14,7 @@
}
var car: Sprite;
var car: Phaser.Sprite;
function create() {
@@ -37,18 +36,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.math.velocityFromAngle(car.angle, 200));
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 200));
}
}
+2 -4
View File
@@ -1,8 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/DynamicTexture.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('ball', 'assets/sprites/shinyball.png');
myGame.loader.load();
+3 -5
View File
@@ -1,10 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/DynamicTexture.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -14,7 +12,7 @@
}
var wobblyBall: DynamicTexture;
var wobblyBall: Phaser.DynamicTexture;
function create() {
+7 -8
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('slime', 'assets/sprites/slime.png');
myGame.loader.addImageFile('eyes', 'assets/sprites/slimeeyes.png');
@@ -31,16 +30,16 @@
eyes.velocity.x = 0;
eyes.velocity.y = 0;
eyes.angularVelocity = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
slime.angularVelocity = -200;
eyes.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
slime.angularVelocity = 200;
eyes.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
slime.velocity.copyFrom(myGame.math.velocityFromAngle(slime.angle, 200));
eyes.velocity.copyFrom(myGame.math.velocityFromAngle(slime.angle, 200));
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
slime.velocity.copyFrom(myGame.motion.velocityFromAngle(slime.angle, 200));
eyes.velocity.copyFrom(myGame.motion.velocityFromAngle(slime.angle, 200));
}
}
// This creates a simple sine-wave effect running through our DynamicTexture.
+10 -11
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -14,9 +13,9 @@
}
var slime: Sprite;
var eyes: Sprite;
var wobble: DynamicTexture;
var slime: Phaser.Sprite;
var eyes: Phaser.Sprite;
var wobble: Phaser.DynamicTexture;
function create() {
@@ -50,21 +49,21 @@
eyes.velocity.y = 0;
eyes.angularVelocity = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
slime.angularVelocity = -200;
eyes.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
slime.angularVelocity = 200;
eyes.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
slime.velocity.copyFrom(myGame.math.velocityFromAngle(slime.angle, 200));
eyes.velocity.copyFrom(myGame.math.velocityFromAngle(slime.angle, 200));
slime.velocity.copyFrom(myGame.motion.velocityFromAngle(slime.angle, 200));
eyes.velocity.copyFrom(myGame.motion.velocityFromAngle(slime.angle, 200));
}
}
+3 -5
View File
@@ -1,8 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Group.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('bunny', 'assets/sprites/wabbit.png');
myGame.loader.load();
@@ -35,7 +33,7 @@
function update() {
fps.textContent = 'Press Up to add more\n\nBunnies: ' + myGame.world.group.length + '\nFPS: ' + myGame.time.fps + ' (' + myGame.time.fpsMin + '-' + myGame.time.fpsMax + ')';
myGame.world.group.forEach(checkWalls);
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
addBunnies(10);
}
}
+4 -6
View File
@@ -1,10 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Group.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -56,14 +54,14 @@
myGame.world.group.forEach(checkWalls);
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
addBunnies(10);
}
}
function checkWalls(bunny:Sprite) {
function checkWalls(bunny:Phaser.Sprite) {
if (bunny.x > maxX)
{
+24
View File
@@ -0,0 +1,24 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('teddy', 'assets/pics/profil-sad_plush.png');
myGame.loader.load();
}
var teddy;
function create() {
teddy = myGame.createSprite(0, 0, 'teddy');
teddy.x = myGame.stage.centerX - teddy.width / 2;
teddy.y = myGame.stage.centerY - teddy.height / 2;
teddy.origin.setTo(-100, -100);
}
function update() {
teddy.angularVelocity = 0;
//car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
teddy.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
teddy.angularVelocity = 200;
}
}
})();
+43
View File
@@ -0,0 +1,43 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('teddy', 'assets/pics/profil-sad_plush.png');
myGame.loader.load();
}
var teddy: Phaser.Sprite;
function create() {
teddy = myGame.createSprite(0, 0, 'teddy');
teddy.x = myGame.stage.centerX - teddy.width / 2;
teddy.y = myGame.stage.centerY - teddy.height / 2;
teddy.origin.setTo(-100, -100);
}
function update() {
teddy.angularVelocity = 0;
//car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
teddy.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
teddy.angularVelocity = 200;
}
}
})();
+2 -3
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
// Texture Atlas Method 2
//
+3 -4
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -17,7 +16,7 @@
}
var bot: Sprite;
var bot: Phaser.Sprite;
function create() {
+2 -3
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
// Texture Atlas Method 3
//
+3 -4
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -16,7 +15,7 @@
}
var bot: Sprite;
var bot: Phaser.Sprite;
function create() {
+2 -3
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
// Texture Atlas Method 4
//
+7 -8
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
@@ -16,11 +15,11 @@
}
var chick: Sprite;
var car: Sprite;
var mech: Sprite;
var robot: Sprite;
var cop: Sprite;
var chick: Phaser.Sprite;
var car: Phaser.Sprite;
var mech: Phaser.Sprite;
var robot: Phaser.Sprite;
var cop: Phaser.Sprite;
function create() {
+2 -3
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
// Texture Atlas Method 1
//
+3 -4
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -17,7 +16,7 @@
}
var bot: Sprite;
var bot: Phaser.Sprite;
function create() {
+7 -8
View File
@@ -1,7 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('car', 'assets/sprites/asteroids_ship.png');
myGame.loader.load();
@@ -16,18 +15,18 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 200);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 200);
// instant
car.velocity.copyFrom(motion);
// acceleration
//car.acceleration.copyFrom(motion);
} else if(myGame.input.keyboard.isDown(Keyboard.DOWN)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
//car.velocity.y = 200;
}
}
+8 -9
View File
@@ -1,9 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -13,7 +12,7 @@
}
var car: Sprite;
var car: Phaser.Sprite;
function create() {
@@ -30,18 +29,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 200);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 200);
// instant
car.velocity.copyFrom(motion);
@@ -49,7 +48,7 @@
// acceleration
//car.acceleration.copyFrom(motion);
}
else if (myGame.input.keyboard.isDown(Keyboard.DOWN))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
//car.velocity.y = 200;
}
+9 -11
View File
@@ -1,8 +1,6 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Tilemap.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
// Tiled JSON Test
myGame.loader.addTextFile('jsontest', 'assets/maps/test.json');
@@ -17,12 +15,12 @@
var map;
var bigCam;
function create() {
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
bigCam = myGame.createCamera(30, 30, 200, 200);
bigCam.showBorder = true;
bigCam.scale.setTo(1.5, 1.5);
//map = myGame.createTilemap('jsontiles', 'jsontest', Tilemap.FORMAT_TILED_JSON);
map = myGame.createTilemap('csvtiles', 'csvtest', Tilemap.FORMAT_CSV, 16, 16);
map = myGame.createTilemap('csvtiles', 'csvtest', Phaser.Tilemap.FORMAT_CSV, 16, 16);
// for now like this, but change to auto soon
myGame.world.setSize(map.widthInPixels, map.heightInPixels);
console.log('world size', map.widthInPixels, map.heightInPixels);
@@ -30,7 +28,7 @@
bigCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
car = myGame.createSprite(300, 100, 'car');
myGame.camera.follow(car);
bigCam.follow(car, Camera.STYLE_LOCKON);
bigCam.follow(car, Phaser.Camera.STYLE_LOCKON);
myGame.onRenderCallback = render;
}
function update() {
@@ -39,13 +37,13 @@
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Keyboard.LEFT)) {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Keyboard.RIGHT)) {
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Keyboard.UP)) {
var motion = myGame.math.velocityFromAngle(car.angle, 300);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
+12 -14
View File
@@ -1,10 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../Phaser/Sprite.ts" />
/// <reference path="../../Phaser/Tilemap.ts" />
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
@@ -22,20 +20,20 @@
}
var car: Sprite;
var map: Tilemap;
var bigCam: Camera;
var car: Phaser.Sprite;
var map: Phaser.Tilemap;
var bigCam: Phaser.Camera;
function create() {
myGame.camera.deadzone = new Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
myGame.camera.deadzone = new Phaser.Rectangle(64, 64, myGame.stage.width - 128, myGame.stage.height - 128);
bigCam = myGame.createCamera(30, 30, 200, 200);
bigCam.showBorder = true;
bigCam.scale.setTo(1.5, 1.5);
//map = myGame.createTilemap('jsontiles', 'jsontest', Tilemap.FORMAT_TILED_JSON);
map = myGame.createTilemap('csvtiles', 'csvtest', Tilemap.FORMAT_CSV, 16, 16);
map = myGame.createTilemap('csvtiles', 'csvtest', Phaser.Tilemap.FORMAT_CSV, 16, 16);
// for now like this, but change to auto soon
myGame.world.setSize(map.widthInPixels, map.heightInPixels);
@@ -47,7 +45,7 @@
car = myGame.createSprite(300, 100, 'car');
myGame.camera.follow(car);
bigCam.follow(car, Camera.STYLE_LOCKON);
bigCam.follow(car, Phaser.Camera.STYLE_LOCKON);
myGame.onRenderCallback = render;
@@ -62,18 +60,18 @@
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Keyboard.LEFT))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Keyboard.RIGHT))
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Keyboard.UP))
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Point = myGame.math.velocityFromAngle(car.angle, 300);
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
+22
View File
@@ -0,0 +1,22 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
myGame.loader.load();
}
var atari;
function create() {
atari = myGame.createSprite(300, 0, 'atari');
startBounceTween();
}
function startBounceTween() {
atari.y = 0;
var bounce = myGame.createTween(atari);
bounce.to({
y: 500
}, 1000 + Math.random() * 3000, Phaser.Easing.Bounce.Out);
bounce.onComplete.add(startBounceTween, this);
bounce.start();
}
})();
+36
View File
@@ -0,0 +1,36 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
myGame.loader.load();
}
var atari: Phaser.Sprite;
function create() {
atari = myGame.createSprite(300, 0, 'atari');
startBounceTween();
}
function startBounceTween() {
atari.y = 0;
var bounce: Phaser.Tween = myGame.createTween(atari);
bounce.to({ y: 500 }, 1000 + Math.random() * 3000, Phaser.Easing.Bounce.Out);
bounce.onComplete.add(startBounceTween, this);
bounce.start();
}
})();
+15
View File
@@ -0,0 +1,15 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
myGame.loader.load();
}
function create() {
var atari = myGame.createSprite(300, 0, 'atari');
// Here is the short-hand way of creating a tween, by chaining the call to it:
myGame.createTween(atari).to({
y: 400
}, 5000, Phaser.Easing.Elastic.Out, true);
}
})();
+24
View File
@@ -0,0 +1,24 @@
/// <reference path="../../Phaser/Phaser.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
function init() {
myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
myGame.loader.load();
}
function create() {
var atari = myGame.createSprite(300, 0, 'atari');
// Here is the short-hand way of creating a tween, by chaining the call to it:
myGame.createTween(atari).to({ y: 400 }, 5000, Phaser.Easing.Elastic.Out, true);
}
})();