Preparing new tests

This commit is contained in:
Richard Davey
2013-05-29 02:58:56 +01:00
parent 3c0c349089
commit 09f57fa346
237 changed files with 13385 additions and 34447 deletions
+24 -265
View File
@@ -53,279 +53,38 @@
<TypeScriptSourceMap>false</TypeScriptSourceMap>
</PropertyGroup>
<ItemGroup>
<TypeScriptCompile Include="camera fx\flash.ts" />
<TypeScriptCompile Include="cameras\camera alpha.ts" />
<TypeScriptCompile Include="cameras\camera bounds.ts" />
<TypeScriptCompile Include="cameras\camera position.ts" />
<TypeScriptCompile Include="cameras\camera rotation.ts" />
<TypeScriptCompile Include="cameras\camera scale.ts" />
<TypeScriptCompile Include="cameras\camera shadow.ts" />
<TypeScriptCompile Include="cameras\camera texture.ts" />
<TypeScriptCompile Include="cameras\focus on.ts" />
<TypeScriptCompile Include="cameras\follow deadzone.ts" />
<TypeScriptCompile Include="cameras\follow sprite.ts" />
<TypeScriptCompile Include="cameras\follow topdown.ts" />
<TypeScriptCompile Include="cameras\multicam1.ts" />
<TypeScriptCompile Include="cameras\scroll factor.ts" />
<TypeScriptCompile Include="collision\collide sprites.ts" />
<TypeScriptCompile Include="collision\falling balls.ts" />
<TypeScriptCompile Include="groups\basic group.ts" />
<TypeScriptCompile Include="input\mouse scale.ts" />
<TypeScriptCompile Include="mini games\formula 1.ts" />
<TypeScriptCompile Include="misc\multi game.ts" />
<TypeScriptCompile Include="particles\basic emitter.ts" />
<TypeScriptCompile Include="particles\graphic emitter.ts" />
<TypeScriptCompile Include="particles\multiple streams.ts" />
<TypeScriptCompile Include="particles\sprite emitter.ts" />
<TypeScriptCompile Include="particles\when particles collide.ts" />
<TypeScriptCompile Include="sprites\animation 1.ts" />
<TypeScriptCompile Include="sprites\mark of the bunny.ts" />
<TypeScriptCompile Include="sprites\texture atlas 2.ts" />
<TypeScriptCompile Include="sprites\texture atlas 3.ts" />
<TypeScriptCompile Include="sprites\texture atlas 4.ts" />
<TypeScriptCompile Include="sprites\texture atlas.ts" />
<TypeScriptCompile Include="sprites\velocity.ts" />
<TypeScriptCompile Include="tilemap\basic tilemap.ts" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<TypeScriptCompile Include="sprites\dynamic texture 1.ts" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="sprites\align.ts" />
<TypeScriptCompile Include="scrollzones\simple scrollzone.ts" />
<TypeScriptCompile Include="scrollzones\ballscroller.ts" />
<TypeScriptCompile Include="misc\bootscreen.ts" />
<TypeScriptCompile Include="camera fx\fade.ts" />
<Content Include="camera fx\fade.js">
<DependentUpon>fade.ts</DependentUpon>
<Content Include="sprites\create sprite 1.js">
<DependentUpon>create sprite 1.ts</DependentUpon>
</Content>
<Content Include="camera fx\flash.js">
<DependentUpon>flash.ts</DependentUpon>
<TypeScriptCompile Include="sprites\scale origin 1.ts" />
<Content Include="sprites\scale origin 1.js">
<DependentUpon>scale origin 1.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="camera fx\shake.ts" />
<TypeScriptCompile Include="camera fx\scanlines.ts" />
<TypeScriptCompile Include="camera fx\mirror.ts" />
<Content Include="camera fx\mirror.js">
<DependentUpon>mirror.ts</DependentUpon>
<Content Include="sprites\scale sprite 1.js">
<DependentUpon>scale sprite 1.ts</DependentUpon>
</Content>
<Content Include="camera fx\scanlines.js">
<DependentUpon>scanlines.ts</DependentUpon>
<Content Include="sprites\scale sprite 2.js">
<DependentUpon>scale sprite 2.ts</DependentUpon>
</Content>
<Content Include="camera fx\shake.js">
<DependentUpon>shake.ts</DependentUpon>
<Content Include="sprites\scale sprite 3.js">
<DependentUpon>scale sprite 3.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="input\multitouch.ts" />
<TypeScriptCompile Include="groups\display order.ts" />
<TypeScriptCompile Include="collision\mask test 1.ts" />
<TypeScriptCompile Include="collision\mask animation 1.ts" />
<Content Include="collision\mask animation 1.js">
<DependentUpon>mask animation 1.ts</DependentUpon>
<Content Include="sprites\scale sprite 4.js">
<DependentUpon>scale sprite 4.ts</DependentUpon>
</Content>
<Content Include="collision\mask test 1.js">
<DependentUpon>mask test 1.ts</DependentUpon>
<Content Include="sprites\scale sprite 5.js">
<DependentUpon>scale sprite 5.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="collision\mask test 2.ts" />
<Content Include="collision\mask test 2.js">
<DependentUpon>mask test 2.ts</DependentUpon>
<TypeScriptCompile Include="sprites\scale sprite 5.ts" />
<TypeScriptCompile Include="sprites\scale sprite 4.ts" />
<TypeScriptCompile Include="sprites\scale sprite 3.ts" />
<TypeScriptCompile Include="sprites\scale sprite 2.ts" />
<TypeScriptCompile Include="sprites\scale sprite 1.ts" />
<TypeScriptCompile Include="sprites\create sprite 1.ts" />
<TypeScriptCompile Include="misc\boot screen.ts" />
<Content Include="misc\boot screen.js">
<DependentUpon>boot screen.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geometry\multi rotate.ts" />
<Content Include="geometry\multi rotate.js">
<DependentUpon>multi rotate.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geometry\rotate point 2.ts" />
<TypeScriptCompile Include="geometry\rotate point 1.ts" />
<TypeScriptCompile Include="geometry\rope bridge.ts" />
<Content Include="geometry\rope bridge.js">
<DependentUpon>rope bridge.ts</DependentUpon>
</Content>
<Content Include="geometry\rotate point 1.js">
<DependentUpon>rotate point 1.ts</DependentUpon>
</Content>
<Content Include="geometry\rotate point 2.js">
<DependentUpon>rotate point 2.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geometry\rotate point 3.ts" />
<Content Include="geometry\rotate point 3.js">
<DependentUpon>rotate point 3.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geometry\verlet 1.ts" />
<TypeScriptCompile Include="geometry\rotate point 4.ts" />
<Content Include="geometry\rotate point 4.js">
<DependentUpon>rotate point 4.ts</DependentUpon>
</Content>
<Content Include="geometry\verlet 1.js">
<DependentUpon>verlet 1.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geometry\verlet sprites.ts" />
<Content Include="geometry\verlet sprites.js">
<DependentUpon>verlet sprites.ts</DependentUpon>
</Content>
<Content Include="groups\display order.js">
<DependentUpon>display order.ts</DependentUpon>
</Content>
<Content Include="input\multitouch.js">
<DependentUpon>multitouch.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="input\single touch.ts" />
<TypeScriptCompile Include="input\single tap.ts" />
<Content Include="input\single tap.js">
<DependentUpon>single tap.ts</DependentUpon>
</Content>
<Content Include="input\single touch.js">
<DependentUpon>single touch.ts</DependentUpon>
</Content>
<Content Include="misc\bootscreen.js">
<DependentUpon>bootscreen.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="mobile\sprite test 1.ts" />
<TypeScriptCompile Include="mobile\bunny mobile.ts" />
<TypeScriptCompile Include="misc\time.ts" />
<TypeScriptCompile Include="misc\starfield.ts" />
<Content Include="misc\starfield.js">
<DependentUpon>starfield.ts</DependentUpon>
</Content>
<Content Include="misc\time.js">
<DependentUpon>time.ts</DependentUpon>
</Content>
<Content Include="mobile\bunny mobile.js">
<DependentUpon>bunny mobile.ts</DependentUpon>
</Content>
<Content Include="mobile\sprite test 1.js">
<DependentUpon>sprite test 1.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\mousetrail.ts" />
<Content Include="particles\mousetrail.js">
<DependentUpon>mousetrail.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="physics\temp1.ts" />
<Content Include="physics\temp1.js">
<DependentUpon>temp1.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="physics\temp2.ts" />
<Content Include="physics\temp2.js">
<DependentUpon>temp2.ts</DependentUpon>
</Content>
<Content Include="scrollzones\ballscroller.js">
<DependentUpon>ballscroller.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="scrollzones\parallax.ts" />
<TypeScriptCompile Include="scrollzones\blasteroids.ts" />
<Content Include="scrollzones\blasteroids.js">
<DependentUpon>blasteroids.ts</DependentUpon>
</Content>
<Content Include="scrollzones\parallax.js">
<DependentUpon>parallax.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="scrollzones\scroll window.ts" />
<TypeScriptCompile Include="scrollzones\region demo.ts" />
<Content Include="scrollzones\region demo.js">
<DependentUpon>region demo.ts</DependentUpon>
</Content>
<Content Include="scrollzones\scroll window.js">
<DependentUpon>scroll window.ts</DependentUpon>
</Content>
<Content Include="scrollzones\simple scrollzone.js">
<DependentUpon>simple scrollzone.ts</DependentUpon>
</Content>
<Content Include="sprites\align.js">
<DependentUpon>align.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="sprites\flipped.ts" />
<Content Include="sprites\flipped.js">
<DependentUpon>flipped.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tilemap\small map.ts" />
<TypeScriptCompile Include="tilemap\get tile.ts" />
<TypeScriptCompile Include="tilemap\collision.ts" />
<TypeScriptCompile Include="tilemap\collide with tile.ts" />
<TypeScriptCompile Include="sprites\starling texture atlas 1.ts" />
<Content Include="sprites\starling texture atlas 1.js">
<DependentUpon>starling texture atlas 1.ts</DependentUpon>
</Content>
<Content Include="tilemap\collide with tile.js">
<DependentUpon>collide with tile.ts</DependentUpon>
</Content>
<Content Include="tilemap\collision.js">
<DependentUpon>collision.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tilemap\fill tiles.ts" />
<Content Include="tilemap\fill tiles.js">
<DependentUpon>fill tiles.ts</DependentUpon>
</Content>
<Content Include="tilemap\get tile.js">
<DependentUpon>get tile.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tilemap\put tile.ts" />
<TypeScriptCompile Include="tilemap\map draw.ts" />
<Content Include="tilemap\map draw.js">
<DependentUpon>map draw.ts</DependentUpon>
</Content>
<Content Include="tilemap\put tile.js">
<DependentUpon>put tile.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tilemap\replace tiles.ts" />
<TypeScriptCompile Include="tilemap\random tiles.ts" />
<Content Include="tilemap\random tiles.js">
<DependentUpon>random tiles.ts</DependentUpon>
</Content>
<Content Include="tilemap\replace tiles.js">
<DependentUpon>replace tiles.ts</DependentUpon>
</Content>
<Content Include="tilemap\small map.js">
<DependentUpon>small map.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tilemap\swap tiles.ts" />
<TypeScriptCompile Include="tilemap\sprite draw tiles.ts" />
<Content Include="tilemap\sprite draw tiles.js">
<DependentUpon>sprite draw tiles.ts</DependentUpon>
</Content>
<Content Include="tilemap\swap tiles.js">
<DependentUpon>swap tiles.ts</DependentUpon>
</Content>
<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" />
</Project>
-46
View File
@@ -1,46 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
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');
myGame.loader.load();
}
var car;
var fade;
function create() {
myGame.add.sprite(0, 0, 'background');
car = myGame.add.sprite(400, 300, 'car');
// Add our effect to the camera
fade = myGame.camera.fx.add(Phaser.FX.Camera.Fade);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
// Fade when the car hits the edges, a different colour per edge
if(car.x < 0) {
fade.start(0x330066, 3);
car.x = 0;
} else if(car.x > myGame.world.width) {
fade.start(0x000066, 3);
car.x = myGame.world.width - car.width;
}
if(car.y < 0) {
fade.start(0xffffff, 4);
car.y = 0;
} else if(car.y > myGame.world.height) {
fade.start(0x000000, 3);
car.y = myGame.world.height - car.height;
}
}
})();
-77
View File
@@ -1,77 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
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');
myGame.loader.load();
}
var car: Phaser.Sprite;
var fade: Phaser.FX.Camera.Fade;
function create() {
myGame.add.sprite(0, 0, 'background');
car = myGame.add.sprite(400, 300, 'car');
// Add our effect to the camera
fade = <Phaser.FX.Camera.Fade> myGame.camera.fx.add(Phaser.FX.Camera.Fade);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
// Fade when the car hits the edges, a different colour per edge
if (car.x < 0)
{
fade.start(0x330066, 3);
car.x = 0;
}
else if (car.x > myGame.world.width)
{
fade.start(0x000066, 3);
car.x = myGame.world.width - car.width;
}
if (car.y < 0)
{
fade.start(0xffffff, 4);
car.y = 0;
}
else if (car.y > myGame.world.height)
{
fade.start(0x000000, 3);
car.y = myGame.world.height - car.height;
}
}
})();
-46
View File
@@ -1,46 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
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');
myGame.loader.load();
}
var car;
var flash;
function create() {
myGame.add.sprite(0, 0, 'background');
car = myGame.add.sprite(400, 300, 'car');
// Add our effect to the camera
flash = myGame.camera.fx.add(Phaser.FX.Camera.Flash);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
// Flash when the car hits the edges, a different colour per edge
if(car.x < 0) {
flash.start(0xffffff, 1);
car.x = 0;
} else if(car.x > myGame.world.width) {
flash.start(0xff0000, 2);
car.x = myGame.world.width - car.width;
}
if(car.y < 0) {
flash.start(0xffff00, 2);
car.y = 0;
} else if(car.y > myGame.world.height) {
flash.start(0xff00ff, 3);
car.y = myGame.world.height - car.height;
}
}
})();
-77
View File
@@ -1,77 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
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');
myGame.loader.load();
}
var car: Phaser.Sprite;
var flash: Phaser.FX.Camera.Flash;
function create() {
myGame.add.sprite(0, 0, 'background');
car = myGame.add.sprite(400, 300, 'car');
// Add our effect to the camera
flash = <Phaser.FX.Camera.Flash> myGame.camera.fx.add(Phaser.FX.Camera.Flash);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
// Flash when the car hits the edges, a different colour per edge
if (car.x < 0)
{
flash.start(0xffffff, 1);
car.x = 0;
}
else if (car.x > myGame.world.width)
{
flash.start(0xff0000, 2);
car.x = myGame.world.width - car.width;
}
if (car.y < 0)
{
flash.start(0xffff00, 2);
car.y = 0;
}
else if (car.y > myGame.world.height)
{
flash.start(0xff00ff, 3);
car.y = myGame.world.height - car.height;
}
}
})();
-41
View File
@@ -1,41 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
// Just set the world to be the size of the image we're loading in
myGame.world.setSize(1216, 896);
myGame.loader.addImageFile('backdrop', 'assets/pics/ninja-masters2.png');
myGame.loader.load();
}
var mirror;
function create() {
// What we need is a camera 800x400 pixels in size as the mirror effect will be 200px tall and sit below it.
// So we resize our default camera to 400px
myGame.camera.height = 400;
// Because it's our default camera we need to tell it to disable clipping, otherwise we'll never see the mirror effect render.
myGame.camera.disableClipping = true;
// Add our effect to the camera
mirror = myGame.camera.fx.add(Phaser.FX.Camera.Mirror);
// The first 2 parameters are the x and y coordinates of where to display the effect. They are in STAGE coordinates, not World.
// The next is a Quad making up the rectangular region of the Camera that we'll create the effect from (in this case the whole camera).
// Finally we set the fill color that is put over the top of the mirror effect.
mirror.start(0, 400, new Phaser.Quad(0, 0, 800, 400), 'rgba(0, 0, 100, 0.7)');
// Experiment with variations on these to see the different mirror effects that can be achieved.
//mirror.flipX = true;
//mirror.flipY = true;
myGame.add.sprite(0, 0, 'backdrop');
}
function update() {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
}
}
})();
-68
View File
@@ -1,68 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
// Just set the world to be the size of the image we're loading in
myGame.world.setSize(1216, 896);
myGame.loader.addImageFile('backdrop', 'assets/pics/ninja-masters2.png');
myGame.loader.load();
}
var mirror: Phaser.FX.Camera.Mirror;
function create() {
// What we need is a camera 800x400 pixels in size as the mirror effect will be 200px tall and sit below it.
// So we resize our default camera to 400px
myGame.camera.height = 400;
// Because it's our default camera we need to tell it to disable clipping, otherwise we'll never see the mirror effect render.
myGame.camera.disableClipping = true;
// Add our effect to the camera
mirror = <Phaser.FX.Camera.Mirror> myGame.camera.fx.add(Phaser.FX.Camera.Mirror);
// The first 2 parameters are the x and y coordinates of where to display the effect. They are in STAGE coordinates, not World.
// The next is a Quad making up the rectangular region of the Camera that we'll create the effect from (in this case the whole camera).
// Finally we set the fill color that is put over the top of the mirror effect.
mirror.start(0, 400, new Phaser.Quad(0, 0, 800, 400), 'rgba(0, 0, 100, 0.7)');
// Experiment with variations on these to see the different mirror effects that can be achieved.
//mirror.flipX = true;
//mirror.flipY = true;
myGame.add.sprite(0, 0, 'backdrop');
}
function update() {
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
}
}
})();
-32
View File
@@ -1,32 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(1216, 896);
myGame.loader.addImageFile('backdrop', 'assets/pics/ninja-masters2.png');
myGame.loader.load();
}
var scanlines;
function create() {
// Add our effect to the camera
scanlines = myGame.camera.fx.add(Phaser.FX.Camera.Scanlines);
// We'll have the scanlines spaced out every 2 pixels
scanlines.spacing = 2;
// This is the color the lines will be drawn in
scanlines.color = 'rgba(0, 0, 0, 0.8)';
myGame.add.sprite(0, 0, 'backdrop');
}
function update() {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
}
}
})();
-57
View File
@@ -1,57 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.world.setSize(1216, 896);
myGame.loader.addImageFile('backdrop', 'assets/pics/ninja-masters2.png');
myGame.loader.load();
}
var scanlines: Phaser.FX.Camera.Scanlines;
function create() {
// Add our effect to the camera
scanlines = <Phaser.FX.Camera.Scanlines> myGame.camera.fx.add(Phaser.FX.Camera.Scanlines);
// We'll have the scanlines spaced out every 2 pixels
scanlines.spacing = 2;
// This is the color the lines will be drawn in
scanlines.color = 'rgba(0, 0, 0, 0.8)';
myGame.add.sprite(0, 0, 'backdrop');
}
function update() {
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
}
}
})();
-50
View File
@@ -1,50 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
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');
myGame.loader.load();
}
var car;
var shake;
function create() {
myGame.add.sprite(0, 0, 'background');
car = myGame.add.sprite(400, 300, 'car');
// Add our effect to the camera
shake = myGame.camera.fx.add(Phaser.FX.Camera.Shake);
myGame.onRenderCallback = render;
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
// Shake the camera when the car hits the edges, a different intensity per edge
if(car.x < 0) {
shake.start();
car.x = 0;
} else if(car.x > myGame.world.width) {
shake.start(0.02);
car.x = myGame.world.width - car.width;
}
if(car.y < 0) {
shake.start(0.07, 1);
car.y = 0;
} else if(car.y > myGame.world.height) {
shake.start(0.1);
car.y = myGame.world.height - car.height;
}
}
function render() {
myGame.camera.renderDebugInfo(32, 32);
}
})();
-85
View File
@@ -1,85 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
/// <reference path="../../build/phaser-fx.d.ts" />
(function () {
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');
myGame.loader.load();
}
var car: Phaser.Sprite;
var shake: Phaser.FX.Camera.Shake;
function create() {
myGame.add.sprite(0, 0, 'background');
car = myGame.add.sprite(400, 300, 'car');
// Add our effect to the camera
shake = <Phaser.FX.Camera.Shake> myGame.camera.fx.add(Phaser.FX.Camera.Shake);
myGame.onRenderCallback = render;
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
// Shake the camera when the car hits the edges, a different intensity per edge
if (car.x < 0)
{
shake.start();
car.x = 0;
}
else if (car.x > myGame.world.width)
{
shake.start(0.02);
car.x = myGame.world.width - car.width;
}
if (car.y < 0)
{
shake.start(0.07, 1);
car.y = 0;
}
else if (car.y > myGame.world.height)
{
shake.start(0.1);
car.y = myGame.world.height - car.height;
}
}
function render() {
myGame.camera.renderDebugInfo(32, 32);
}
})();
-38
View File
@@ -1,38 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car;
var miniCam;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car, Phaser.Camera.STYLE_TOPDOWN);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam = myGame.add.camera(0, 0, 300, 300);
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;
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-63
View File
@@ -1,63 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car: Phaser.Sprite;
var miniCam: Phaser.Camera;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car, Phaser.Camera.STYLE_TOPDOWN);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
miniCam = myGame.add.camera(0, 0, 300, 300);
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;
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-33
View File
@@ -1,33 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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);
myGame.loader.addImageFile('backdrop', 'assets/pics/remember-me.jpg');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
function create() {
myGame.add.sprite(0, 0, 'backdrop');
for(var i = 0; i < 100; i++) {
myGame.add.sprite(Math.random() * myGame.world.width, Math.random() * myGame.world.height, 'melon');
}
myGame.onRenderCallback = render;
}
function update() {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
}
}
function render() {
myGame.camera.renderDebugInfo(32, 32);
}
})();
-60
View File
@@ -1,60 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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);
myGame.loader.addImageFile('backdrop', 'assets/pics/remember-me.jpg');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
function create() {
myGame.add.sprite(0, 0, 'backdrop');
for (var i = 0; i < 100; i++)
{
myGame.add.sprite(Math.random() * myGame.world.width, Math.random() * myGame.world.height, 'melon');
}
myGame.onRenderCallback = render;
}
function update() {
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
}
}
function render() {
myGame.camera.renderDebugInfo(32, 32);
}
})();
-40
View File
@@ -1,40 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.load();
}
var cam2;
function create() {
for(var i = 0; i < 1000; i++) {
myGame.add.sprite(Math.random() * 3000, Math.random() * 3000, 'melon');
}
myGame.camera.setPosition(16, 80);
myGame.camera.setSize(320, 320);
myGame.camera.showBorder = true;
myGame.camera.borderColor = 'rgb(255,0,0)';
cam2 = myGame.add.camera(380, 100, 400, 400);
cam2.showBorder = true;
cam2.borderColor = 'rgb(255,255,0)';
}
function update() {
myGame.camera.renderDebugInfo(16, 16);
cam2.renderDebugInfo(200, 16);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.x -= 4;
cam2.x -= 2;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.x += 4;
cam2.x += 2;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.y -= 4;
cam2.y -= 2;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.y += 4;
cam2.y += 2;
}
}
})();
-66
View File
@@ -1,66 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.load();
}
var cam2: Phaser.Camera;
function create() {
for (var i = 0; i < 1000; i++)
{
myGame.add.sprite(Math.random() * 3000, Math.random() * 3000, 'melon');
}
myGame.camera.setPosition(16, 80);
myGame.camera.setSize(320, 320);
myGame.camera.showBorder = true;
myGame.camera.borderColor = 'rgb(255,0,0)';
cam2 = myGame.add.camera(380, 100, 400, 400);
cam2.showBorder = true;
cam2.borderColor = 'rgb(255,255,0)';
}
function update() {
myGame.camera.renderDebugInfo(16, 16);
cam2.renderDebugInfo(200, 16);
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.x -= 4;
cam2.x -= 2;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.x += 4;
cam2.x += 2;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.y -= 4;
cam2.y -= 2;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.y += 4;
cam2.y += 2;
}
}
})();
-34
View File
@@ -1,34 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
function create() {
for(var i = 0; i < 1000; i++) {
if(Math.random() > 0.5) {
myGame.add.sprite(Math.random() * 3000, Math.random() * 3000, 'car');
} else {
myGame.add.sprite(Math.random() * 3000, Math.random() * 3000, 'melon');
}
}
myGame.camera.setPosition(100, 100);
myGame.camera.setSize(320, 320);
}
function update() {
myGame.camera.renderDebugInfo(600, 32);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.rotation -= 2;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.rotation += 2;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
}
}
})();
-61
View File
@@ -1,61 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
function create() {
for (var i = 0; i < 1000; i++)
{
if (Math.random() > 0.5)
{
myGame.add.sprite(Math.random() * 3000, Math.random() * 3000, 'car');
}
else
{
myGame.add.sprite(Math.random() * 3000, Math.random() * 3000, 'melon');
}
}
myGame.camera.setPosition(100, 100);
myGame.camera.setSize(320, 320);
}
function update() {
myGame.camera.renderDebugInfo(600, 32);
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.rotation -= 2;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.rotation += 2;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
}
}
})();
-45
View File
@@ -1,45 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car;
var miniCam;
var bigCam;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car);
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.add.camera(600, 32, 200, 200);
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.add.camera(32, 32, 200, 200);
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);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-71
View File
@@ -1,71 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car: Phaser.Sprite;
var miniCam: Phaser.Camera;
var bigCam: Phaser.Camera;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car);
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.add.camera(600, 32, 200, 200);
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.add.camera(32, 32, 200, 200);
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);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-47
View File
@@ -1,47 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car;
var miniCam;
var bigCam;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car);
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.add.camera(600, 32, 200, 200);
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.add.camera(32, 32, 200, 200);
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);
bigCam.showShadow = true;
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-73
View File
@@ -1,73 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car: Phaser.Sprite;
var miniCam: Phaser.Camera;
var bigCam: Phaser.Camera;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car);
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.add.camera(600, 32, 200, 200);
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.add.camera(32, 32, 200, 200);
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);
bigCam.showShadow = true;
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-46
View File
@@ -1,46 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car;
var miniCam;
var bigCam;
function create() {
//myGame.add.sprite('grid', 0, 0);
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.setTexture('balls');
myGame.camera.follow(car);
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.add.camera(600, 32, 200, 200);
//miniCam.follow(car, 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.add.camera(32, 32, 200, 200);
//bigCam.follow(car, Camera.STYLE_LOCKON);
//bigCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
//bigCam.showBorder = true;
//bigCam.scale.setTo(2, 2);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-72
View File
@@ -1,72 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car: Phaser.Sprite;
var miniCam: Phaser.Camera;
var bigCam: Phaser.Camera;
function create() {
//myGame.add.sprite('grid', 0, 0);
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.setTexture('balls');
myGame.camera.follow(car);
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.add.camera(600, 32, 200, 200);
//miniCam.follow(car, 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.add.camera(32, 32, 200, 200);
//bigCam.follow(car, Camera.STYLE_LOCKON);
//bigCam.setBounds(0, 0, myGame.world.width, myGame.world.height);
//bigCam.showBorder = true;
//bigCam.scale.setTo(2, 2);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-36
View File
@@ -1,36 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.addImageFile('carrot', 'assets/sprites/carrot.png');
myGame.loader.load();
}
var melon;
function create() {
// locked to the camera
myGame.add.sprite(0, 0, 'grid');
melon = myGame.add.sprite(600, 650, 'melon');
melon.scrollFactor.setTo(1.5, 1.5);
// scrolls x2 camera speed
for(var i = 0; i < 100; i++) {
var tempSprite = myGame.add.sprite(Math.random() * myGame.world.width, Math.random() * myGame.world.height, 'carrot');
tempSprite.scrollFactor.setTo(2, 2);
}
}
function update() {
myGame.camera.renderDebugInfo(32, 32);
melon.renderDebugInfo(200, 32);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.focusOnXY(640, 640);
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.focusOnXY(1234, 800);
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.focusOnXY(50, 200);
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.focusOnXY(1700, 1700);
}
}
})();
-62
View File
@@ -1,62 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.addImageFile('carrot', 'assets/sprites/carrot.png');
myGame.loader.load();
}
var melon: Phaser.Sprite;
function create() {
// locked to the camera
myGame.add.sprite(0, 0, 'grid');
melon = myGame.add.sprite(600, 650, 'melon');
melon.scrollFactor.setTo(1.5, 1.5);
// scrolls x2 camera speed
for (var i = 0; i < 100; i++)
{
var tempSprite = myGame.add.sprite(Math.random() * myGame.world.width, Math.random() * myGame.world.height, 'carrot');
tempSprite.scrollFactor.setTo(2, 2);
}
}
function update() {
myGame.camera.renderDebugInfo(32, 32);
melon.renderDebugInfo(200, 32);
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.focusOnXY(640, 640);
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.focusOnXY(1234, 800);
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.focusOnXY(50, 200);
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.focusOnXY(1700, 1700);
}
}
})();
-36
View File
@@ -1,36 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(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 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() {
myGame.camera.renderDebugInfo(32, 32);
car.renderDebugInfo(200, 32);
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-61
View File
@@ -1,61 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car: Phaser.Sprite;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(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 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() {
myGame.camera.renderDebugInfo(32, 32);
car.renderDebugInfo(200, 32);
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-34
View File
@@ -1,34 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car);
myGame.onRenderCallback = render;
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
}
function render() {
myGame.camera.renderDebugInfo(32, 32);
car.renderDebugInfo(200, 32);
}
})();
-62
View File
@@ -1,62 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car);
myGame.onRenderCallback = render;
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
}
function render() {
myGame.camera.renderDebugInfo(32, 32);
car.renderDebugInfo(200, 32);
}
})();
-34
View File
@@ -1,34 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car, Phaser.Camera.STYLE_TOPDOWN);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
}
function update() {
myGame.camera.renderDebugInfo(32, 32);
car.renderDebugInfo(200, 32);
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-59
View File
@@ -1,59 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.load();
}
var car: Phaser.Sprite;
function create() {
myGame.add.sprite(0, 0, 'grid');
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car, Phaser.Camera.STYLE_TOPDOWN);
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
}
function update() {
myGame.camera.renderDebugInfo(32, 32);
car.renderDebugInfo(200, 32);
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-44
View File
@@ -1,44 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('coin', 'assets/sprites/coin.png');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
var cam2;
function create() {
for(var i = 0; i < 1000; i++) {
myGame.add.sprite(Math.random() * 3000, Math.random() * 3000, 'melon');
}
myGame.camera.setPosition(16, 80);
myGame.camera.setSize(320, 320);
myGame.camera.showBorder = true;
myGame.camera.borderColor = 'rgb(255,0,0)';
cam2 = myGame.add.camera(380, 100, 400, 400);
//cam2.transparent = false;
//cam2.backgroundColor = 'rgb(20,20,20)';
cam2.showBorder = true;
cam2.borderColor = 'rgb(255,255,0)';
}
function update() {
myGame.camera.renderDebugInfo(16, 16);
cam2.renderDebugInfo(200, 16);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
cam2.scroll.x -= 2;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
cam2.scroll.x += 2;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
cam2.scroll.y -= 2;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
cam2.scroll.y += 2;
}
}
})();
-70
View File
@@ -1,70 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('coin', 'assets/sprites/coin.png');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
var cam2: Phaser.Camera;
function create() {
for (var i = 0; i < 1000; i++)
{
myGame.add.sprite(Math.random() * 3000, Math.random() * 3000, 'melon');
}
myGame.camera.setPosition(16, 80);
myGame.camera.setSize(320, 320);
myGame.camera.showBorder = true;
myGame.camera.borderColor = 'rgb(255,0,0)';
cam2 = myGame.add.camera(380, 100, 400, 400);
//cam2.transparent = false;
//cam2.backgroundColor = 'rgb(20,20,20)';
cam2.showBorder = true;
cam2.borderColor = 'rgb(255,255,0)';
}
function update() {
myGame.camera.renderDebugInfo(16, 16);
cam2.renderDebugInfo(200, 16);
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
cam2.scroll.x -= 2;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
cam2.scroll.x += 2;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
cam2.scroll.y -= 2;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
cam2.scroll.y += 2;
}
}
})();
-37
View File
@@ -1,37 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.addImageFile('carrot', 'assets/sprites/carrot.png');
myGame.loader.load();
}
var melon;
function create() {
// scrolls in time with the camera
myGame.add.sprite(0, 0, 'backdrop');
melon = myGame.add.sprite(600, 650, 'melon');
melon.scrollFactor.setTo(1.5, 1.5);
// scrolls x2 camera speed
for(var i = 0; i < 100; i++) {
var tempSprite = myGame.add.sprite(Math.random() * myGame.world.width, Math.random() * myGame.world.height, 'carrot');
tempSprite.scrollFactor.setTo(2, 2);
}
}
function update() {
myGame.camera.renderDebugInfo(32, 32);
melon.renderDebugInfo(200, 32);
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 1;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 1;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 1;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 1;
}
}
})();
-63
View File
@@ -1,63 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.addImageFile('carrot', 'assets/sprites/carrot.png');
myGame.loader.load();
}
var melon: Phaser.Sprite;
function create() {
// scrolls in time with the camera
myGame.add.sprite(0, 0, 'backdrop');
melon = myGame.add.sprite(600, 650, 'melon');
melon.scrollFactor.setTo(1.5, 1.5);
// scrolls x2 camera speed
for (var i = 0; i < 100; i++)
{
var tempSprite = myGame.add.sprite(Math.random() * myGame.world.width, Math.random() * myGame.world.height, 'carrot');
tempSprite.scrollFactor.setTo(2, 2);
}
}
function update() {
myGame.camera.renderDebugInfo(32, 32);
melon.renderDebugInfo(200, 32);
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 1;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 1;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 1;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 1;
}
}
})();
-35
View File
@@ -1,35 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.load();
}
var car;
var melon;
function create() {
car = myGame.add.sprite(100, 300, 'car');
melon = myGame.add.sprite(200, 310, 'melon');
car.name = 'car';
melon.name = 'melon';
}
function update() {
car.renderDebugInfo(16, 16);
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 200));
}
myGame.collide(car, melon, collides);
}
function collides(a, b) {
console.log('Collision!!!!!');
}
})();
-61
View File
@@ -1,61 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.load();
}
var car: Phaser.Sprite;
var melon: Phaser.Sprite;
function create() {
car = myGame.add.sprite(100, 300, 'car');
melon = myGame.add.sprite(200, 310, 'melon');
car.name = 'car';
melon.name = 'melon';
}
function update() {
car.renderDebugInfo(16, 16);
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 200));
}
myGame.collide(car, melon, collides);
}
function collides(a, b) {
console.log('Collision!!!!!');
}
})();
-45
View File
@@ -1,45 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('ball2', 'assets/sprites/blue_ball.png');
myGame.loader.addImageFile('ball3', 'assets/sprites/green_ball.png');
myGame.loader.addImageFile('ball4', 'assets/sprites/red_ball.png');
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
myGame.loader.load();
}
var atari;
var balls;
function create() {
atari = myGame.add.sprite(300, 450, 'atari');
atari.immovable = true;
balls = myGame.add.group();
for(var i = 0; i < 100; i++) {
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);
}
}
function update() {
atari.velocity.x = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
atari.velocity.x = -400;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
atari.velocity.x = 400;
}
balls.forEach(checkOffScreen, false);
myGame.collide(atari, balls);
}
function checkOffScreen(ball) {
if(ball.y < -32 || ball.y > myGame.stage.height || ball.x < 0 || ball.x > myGame.stage.width) {
ball.x = Math.random() * myGame.stage.width;
ball.y = -32;
ball.velocity.x = 0;
ball.velocity.y = 100 + Math.random() * 150;
}
}
})();
-72
View File
@@ -1,72 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('ball2', 'assets/sprites/blue_ball.png');
myGame.loader.addImageFile('ball3', 'assets/sprites/green_ball.png');
myGame.loader.addImageFile('ball4', 'assets/sprites/red_ball.png');
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
myGame.loader.load();
}
var atari: Phaser.Sprite;
var balls: Phaser.Group;
function create() {
atari = myGame.add.sprite(300, 450, 'atari');
atari.immovable = true;
balls = myGame.add.group();
for (var i = 0; i < 100; i++)
{
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);
}
}
function update() {
atari.velocity.x = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
atari.velocity.x = -400;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
atari.velocity.x = 400;
}
balls.forEach(checkOffScreen, false);
myGame.collide(atari, balls);
}
function checkOffScreen(ball:Phaser.Sprite) {
if (ball.y < -32 || ball.y > myGame.stage.height || ball.x < 0 || ball.x > myGame.stage.width)
{
ball.x = Math.random() * myGame.stage.width;
ball.y = -32;
ball.velocity.x = 0;
ball.velocity.y = 100 + Math.random() * 150;
}
}
})();
-31
View File
@@ -1,31 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('card', 'assets/sprites/mana_card.png');
myGame.loader.addTextureAtlas('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
myGame.loader.load();
}
var card;
var bot;
function create() {
card = myGame.add.sprite(200, 220, 'card');
bot = myGame.add.sprite(myGame.stage.width - 100, 300, 'bot');
// The collision mask is much thinner than the animated sprite
bot.collisionMask.offset.x = 16;
bot.collisionMask.width = 32;
bot.renderDebug = true;
bot.animations.add('run');
bot.animations.play('run', 10, true);
bot.velocity.x = -150;
}
function update() {
if(bot.x < -bot.width) {
bot.x = myGame.stage.width;
bot.velocity.x = -150;
card.x = 200;
card.velocity.x = 0;
}
myGame.collide(card, bot);
}
})();
-50
View File
@@ -1,50 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('card', 'assets/sprites/mana_card.png');
myGame.loader.addTextureAtlas('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
myGame.loader.load();
}
var card: Phaser.Sprite;
var bot: Phaser.Sprite;
function create() {
card = myGame.add.sprite(200, 220, 'card');
bot = myGame.add.sprite(myGame.stage.width - 100, 300, 'bot');
// The collision mask is much thinner than the animated sprite
bot.collisionMask.offset.x = 16;
bot.collisionMask.width = 32;
bot.renderDebug = true;
bot.animations.add('run');
bot.animations.play('run', 10, true);
bot.velocity.x = -150;
}
function update() {
if (bot.x < -bot.width)
{
bot.x = myGame.stage.width;
bot.velocity.x = -150;
card.x = 200;
card.velocity.x = 0;
}
myGame.collide(card, bot);
}
})();
-38
View File
@@ -1,38 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
myGame.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
myGame.loader.load();
}
var atari1;
var atari2;
var atari3;
function create() {
atari1 = myGame.add.sprite(270, 100, 'atari1');
atari2 = myGame.add.sprite(400, 400, 'atari2');
atari3 = myGame.add.sprite(0, 440, 'atari1');
atari1.collisionMask.height = 16;
atari3.collisionMask.width = 16;
atari1.elasticity = 0.5;
atari3.elasticity = 0.5;
atari2.immovable = true;
atari1.renderDebug = true;
atari2.renderDebug = true;
atari3.renderDebug = true;
myGame.input.onTap.addOnce(startDrop, this);
}
function startDrop() {
atari1.velocity.y = 100;
atari3.velocity.x = 100;
}
function update() {
myGame.collide(myGame.world.group);
}
function collides(a, b) {
console.log('Collision!!!!!');
}
function render() {
}
})();
-64
View File
@@ -1,64 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
myGame.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
myGame.loader.load();
}
var atari1: Phaser.Sprite;
var atari2: Phaser.Sprite;
var atari3: Phaser.Sprite;
function create() {
atari1 = myGame.add.sprite(270, 100, 'atari1');
atari2 = myGame.add.sprite(400, 400, 'atari2');
atari3 = myGame.add.sprite(0, 440, 'atari1');
atari1.collisionMask.height = 16;
atari3.collisionMask.width = 16;
atari1.elasticity = 0.5;
atari3.elasticity = 0.5;
atari2.immovable = true;
atari1.renderDebug = true;
atari2.renderDebug = true;
atari3.renderDebug = true;
myGame.input.onTap.addOnce(startDrop, this);
}
function startDrop() {
atari1.velocity.y = 100;
atari3.velocity.x = 100;
}
function update() {
myGame.collide(myGame.world.group);
}
function collides(a, b) {
console.log('Collision!!!!!');
}
function render() {
}
})();
-35
View File
@@ -1,35 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
myGame.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
myGame.loader.load();
}
var atari1;
var atari2;
function create() {
atari1 = myGame.add.sprite(400, 100, 'atari1');
atari2 = myGame.add.sprite(400, 400, 'atari2');
//atari1.collisionMask.createCircle(64);
//atari1.rotation = 45;
atari1.elasticity = 0.5;
//atari2.collisionMask.createCircle(64);
atari2.immovable = true;
atari1.renderDebug = true;
atari2.renderDebug = true;
myGame.input.onTap.addOnce(startDrop, this);
}
function startDrop() {
atari1.velocity.y = 100;
}
function update() {
myGame.collide(myGame.world.group);
}
function collides(a, b) {
console.log('Collision!!!!!');
}
function render() {
//atari1.ren
}
})();
-62
View File
@@ -1,62 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
myGame.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
myGame.loader.load();
}
var atari1: Phaser.Sprite;
var atari2: Phaser.Sprite;
function create() {
atari1 = myGame.add.sprite(400, 100, 'atari1');
atari2 = myGame.add.sprite(400, 400, 'atari2');
//atari1.collisionMask.createCircle(64);
//atari1.rotation = 45;
atari1.elasticity = 0.5;
//atari2.collisionMask.createCircle(64);
atari2.immovable = true;
atari1.renderDebug = true;
atari2.renderDebug = true;
myGame.input.onTap.addOnce(startDrop, this);
}
function startDrop() {
atari1.velocity.y = 100;
}
function update() {
myGame.collide(myGame.world.group);
}
function collides(a, b) {
console.log('Collision!!!!!');
}
function render() {
//atari1.ren
}
})();
-19
View File
@@ -1,19 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var circle;
var floor;
function create() {
circle = myGame.add.geomSprite(200, 0);
circle.createCircle(64);
circle.acceleration.y = 100;
circle.elasticity = 0.8;
// A simple floor
floor = myGame.add.geomSprite(0, 550);
floor.createRectangle(800, 50);
floor.immovable = true;
}
function update() {
myGame.collide(circle, floor);
}
})();
-30
View File
@@ -1,30 +0,0 @@
/// <reference path="../../Phaser/Game.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.add.geomSprite(200, 0);
circle.createCircle(64);
circle.acceleration.y = 100;
circle.elasticity = 0.8;
// A simple floor
floor = myGame.add.geomSprite(0, 550);
floor.createRectangle(800, 50);
floor.immovable = true;
}
function update() {
myGame.collide(circle, floor);
}
})();
-27
View File
@@ -1,27 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var line;
function create() {
line = myGame.add.geomSprite(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
@@ -1,40 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var line: Phaser.GeomSprite;
function create() {
line = myGame.add.geomSprite(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));
//}
}
})();
-31
View File
@@ -1,31 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var p1;
var p2;
var p3;
var p4;
var d = 0;
function create() {
p1 = new Phaser.Point(myGame.stage.centerX, myGame.stage.centerY);
p2 = new Phaser.Point(p1.x - 50, p1.y - 50);
p3 = new Phaser.Point(p1.x - 100, p1.y - 100);
p4 = new Phaser.Point(p1.x - 150, p1.y - 150);
}
function update() {
p2.rotate(p1.x, p1.y, myGame.math.wrapAngle(d), true);
p3.rotate(p1.x, p1.y, myGame.math.wrapAngle(d), true);
p4.rotate(p1.x, p1.y, myGame.math.wrapAngle(d), true);
d++;
}
function render() {
myGame.stage.context.fillStyle = 'rgb(255,255,0)';
myGame.stage.context.fillRect(p1.x, p1.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.fillRect(p2.x, p2.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(0,255,0)';
myGame.stage.context.fillRect(p3.x, p3.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,255)';
myGame.stage.context.fillRect(p4.x, p4.y, 4, 4);
}
})();
-49
View File
@@ -1,49 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var p1:Phaser.Point;
var p2:Phaser.Point;
var p3:Phaser.Point;
var p4:Phaser.Point;
var d: number = 0;
function create() {
p1 = new Phaser.Point(myGame.stage.centerX, myGame.stage.centerY);
p2 = new Phaser.Point(p1.x - 50, p1.y - 50);
p3 = new Phaser.Point(p1.x - 100, p1.y - 100);
p4 = new Phaser.Point(p1.x - 150, p1.y - 150);
}
function update() {
p2.rotate(p1.x, p1.y, myGame.math.wrapAngle(d), true);
p3.rotate(p1.x, p1.y, myGame.math.wrapAngle(d), true);
p4.rotate(p1.x, p1.y, myGame.math.wrapAngle(d), true);
d++;
}
function render() {
myGame.stage.context.fillStyle = 'rgb(255,255,0)';
myGame.stage.context.fillRect(p1.x, p1.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.fillRect(p2.x, p2.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(0,255,0)';
myGame.stage.context.fillRect(p3.x, p3.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,255)';
myGame.stage.context.fillRect(p4.x, p4.y, 4, 4);
}
})();
-21
View File
@@ -1,21 +0,0 @@
/// <reference path="../../Phaser/Game.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.add.geomSprite(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.add.geomSprite(0, 550);
floor.createRectangle(800, 50);
floor.immovable = true;
}
function update() {
myGame.collide(myGame.world.group, floor);
}
})();
-33
View File
@@ -1,33 +0,0 @@
/// <reference path="../../Phaser/Game.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.add.geomSprite(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.add.geomSprite(0, 550);
floor.createRectangle(800, 50);
floor.immovable = true;
}
function update() {
myGame.collide(myGame.world.group, floor);
}
})();
-22
View File
@@ -1,22 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var box1;
var box2;
function create() {
box2 = myGame.add.geomSprite(300, 300).createRectangle(128, 128);
box1 = myGame.add.geomSprite(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)';
}
}
function checkPoints() {
if(box2.rect.containsPoint(box1.rect.topLeft)) {
}
}
})();
-41
View File
@@ -1,41 +0,0 @@
/// <reference path="../../Phaser/Game.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.add.geomSprite(300, 300).createRectangle(128, 128);
box1 = myGame.add.geomSprite(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)';
}
}
function checkPoints() {
if (box2.rect.containsPoint(box1.rect.topLeft))
{
}
}
})();
-24
View File
@@ -1,24 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
var box;
function create() {
box = myGame.add.geomSprite(0, 0);
box.createRectangle(64, 64);
box.renderOutline = false;
}
function update() {
box.velocity.x = 0;
box.velocity.y = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
box.velocity.x = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
box.velocity.x = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
box.velocity.y = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
box.velocity.y = 200;
}
}
})();
-43
View File
@@ -1,43 +0,0 @@
/// <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.add.geomSprite(0, 0);
box.createRectangle(64, 64);
box.renderOutline = false;
}
function update() {
box.velocity.x = 0;
box.velocity.y = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
box.velocity.x = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
box.velocity.x = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
box.velocity.y = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
box.velocity.y = 200;
}
}
})();
-34
View File
@@ -1,34 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
myGame.loader.load();
}
var segment;
function create() {
myGame.verlet.friction = 1;
myGame.verlet.hideNearestEntityCircle = true;
var points = [];
var startX = 100;
var startY = 200;
var spacing = 20;
for(var i = 0; i < 30; i++) {
points.push(new Phaser.Vector2(startX + (i * spacing), startY));
}
segment = myGame.verlet.createLineSegments(points, 0.5);
segment.loadGraphic('ball5');
segment.hideConstraints = false;
segment.pin(0);
segment.pin(points.length - 1);
}
function update() {
}
function render() {
myGame.verlet.render();
//myGame.stage.context.fillStyle = 'rgb(255,255,0)';
//myGame.stage.context.fillRect(p1.x, p1.y, 4, 4);
//myGame.stage.context.fillStyle = 'rgb(255,0,0)';
//myGame.stage.context.fillRect(p2.x, p2.y, 4, 4);
}
})();
-55
View File
@@ -1,55 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
myGame.loader.load();
}
var segment: Phaser.Verlet.Composite;
function create() {
myGame.verlet.friction = 1;
myGame.verlet.hideNearestEntityCircle = true;
var points: Phaser.Vector2[] = [];
var startX: number = 100;
var startY: number = 200;
var spacing: number = 20;
for (var i = 0; i < 30; i++)
{
points.push(new Phaser.Vector2(startX + (i * spacing), startY));
}
segment = myGame.verlet.createLineSegments(points, 0.5);
segment.loadGraphic('ball5');
segment.hideConstraints = false;
segment.pin(0);
segment.pin(points.length - 1);
}
function update() {
}
function render() {
myGame.verlet.render();
//myGame.stage.context.fillStyle = 'rgb(255,255,0)';
//myGame.stage.context.fillRect(p1.x, p1.y, 4, 4);
//myGame.stage.context.fillStyle = 'rgb(255,0,0)';
//myGame.stage.context.fillRect(p2.x, p2.y, 4, 4);
}
})();
-21
View File
@@ -1,21 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var p1;
var p2;
var d = 0;
function create() {
p1 = new Phaser.Point(200, 300);
p2 = new Phaser.Point(300, 300);
}
function update() {
p1.rotate(p2.x, p2.y, myGame.math.wrapAngle(d), true);
d++;
}
function render() {
myGame.stage.context.fillStyle = 'rgb(255,255,0)';
myGame.stage.context.fillRect(p1.x, p1.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.fillRect(p2.x, p2.y, 4, 4);
}
})();
-36
View File
@@ -1,36 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var p1:Phaser.Point;
var p2:Phaser.Point;
var d: number = 0;
function create() {
p1 = new Phaser.Point(200, 300);
p2 = new Phaser.Point(300, 300);
}
function update() {
p1.rotate(p2.x, p2.y, myGame.math.wrapAngle(d), true);
d++;
}
function render() {
myGame.stage.context.fillStyle = 'rgb(255,255,0)';
myGame.stage.context.fillRect(p1.x, p1.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.fillRect(p2.x, p2.y, 4, 4);
}
})();
-43
View File
@@ -1,43 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var p1;
var p2;
var p3;
var p4;
var d2 = 0;
var d3 = 0;
var d4 = 0;
function create() {
p1 = new Phaser.Point(myGame.stage.centerX, myGame.stage.centerY);
p2 = new Phaser.Point(p1.x - 50, p1.y - 50);
p3 = new Phaser.Point(p2.x - 50, p2.y - 50);
p4 = new Phaser.Point(p3.x - 50, p3.y - 50);
}
function update() {
p2.rotate(p1.x, p1.y, myGame.math.wrapAngle(d2), true, 150);
p3.rotate(p2.x, p2.y, myGame.math.wrapAngle(d3), true, 50);
p4.rotate(p3.x, p3.y, myGame.math.wrapAngle(d4), true, 100);
d2 += 1;
d3 += 4;
d4 += 6;
}
function render() {
myGame.stage.context.strokeStyle = 'rgb(0,255,255)';
myGame.stage.context.beginPath();
myGame.stage.context.moveTo(p1.x, p1.y);
myGame.stage.context.lineTo(p2.x, p2.y);
myGame.stage.context.lineTo(p3.x, p3.y);
myGame.stage.context.lineTo(p4.x, p4.y);
myGame.stage.context.stroke();
myGame.stage.context.closePath();
myGame.stage.context.fillStyle = 'rgb(255,255,0)';
myGame.stage.context.fillRect(p1.x, p1.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.fillRect(p2.x, p2.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(0,255,0)';
myGame.stage.context.fillRect(p3.x, p3.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,255)';
myGame.stage.context.fillRect(p4.x, p4.y, 4, 4);
}
})();
-62
View File
@@ -1,62 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var p1:Phaser.Point;
var p2:Phaser.Point;
var p3:Phaser.Point;
var p4:Phaser.Point;
var d2: number = 0;
var d3: number = 0;
var d4: number = 0;
function create() {
p1 = new Phaser.Point(myGame.stage.centerX, myGame.stage.centerY);
p2 = new Phaser.Point(p1.x - 50, p1.y - 50);
p3 = new Phaser.Point(p2.x - 50, p2.y - 50);
p4 = new Phaser.Point(p3.x - 50, p3.y - 50);
}
function update() {
p2.rotate(p1.x, p1.y, myGame.math.wrapAngle(d2), true, 150);
p3.rotate(p2.x, p2.y, myGame.math.wrapAngle(d3), true, 50);
p4.rotate(p3.x, p3.y, myGame.math.wrapAngle(d4), true, 100);
d2 += 1;
d3 += 4;
d4 += 6;
}
function render() {
myGame.stage.context.strokeStyle = 'rgb(0,255,255)';
myGame.stage.context.beginPath();
myGame.stage.context.moveTo(p1.x, p1.y);
myGame.stage.context.lineTo(p2.x, p2.y);
myGame.stage.context.lineTo(p3.x, p3.y);
myGame.stage.context.lineTo(p4.x, p4.y);
myGame.stage.context.stroke();
myGame.stage.context.closePath();
myGame.stage.context.fillStyle = 'rgb(255,255,0)';
myGame.stage.context.fillRect(p1.x, p1.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.fillRect(p2.x, p2.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(0,255,0)';
myGame.stage.context.fillRect(p3.x, p3.y, 4, 4);
myGame.stage.context.fillStyle = 'rgb(255,0,255)';
myGame.stage.context.fillRect(p4.x, p4.y, 4, 4);
}
})();
-71
View File
@@ -1,71 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var origin;
var p1;
var p2;
var p3;
var p4;
var d = 0;
function create() {
// This creates a box made up of 4 edge-points and rotates it around the origin
origin = new Phaser.Point(400, 300);
p1 = new Phaser.Point()// top left
;
p2 = new Phaser.Point()// top right
;
p3 = new Phaser.Point()// bottom right
;
p4 = new Phaser.Point()// bottom left
;
}
function update() {
// top left (red)
p1.rotate(origin.x, origin.y, myGame.math.wrapAngle(d), true, 200);
// top right (yellow)
p2.rotate(origin.x, origin.y, myGame.math.wrapAngle(d + 90), true, 200);
// bottom right (aqua)
p3.rotate(origin.x, origin.y, myGame.math.wrapAngle(d + 180), true, 200);
// bottom left (blue)
p4.rotate(origin.x, origin.y, myGame.math.wrapAngle(d + 270), true, 200);
d++;
}
function render() {
// Render the shape
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgba(0,255,0,0.2)';
myGame.stage.context.strokeStyle = 'rgb(0,255,0)';
myGame.stage.context.lineWidth = 1;
myGame.stage.context.moveTo(p1.x, p1.y);
myGame.stage.context.lineTo(p2.x, p2.y);
myGame.stage.context.lineTo(p3.x, p3.y);
myGame.stage.context.lineTo(p4.x, p4.y);
myGame.stage.context.lineTo(p1.x, p1.y);
myGame.stage.context.fill();
myGame.stage.context.stroke();
myGame.stage.context.closePath();
// Render the points
myGame.stage.context.fillStyle = 'rgb(255,255,255)';
myGame.stage.context.fillRect(origin.x, origin.y, 4, 4);
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.arc(p1.x, p1.y, 4, 0, Math.PI * 2);
myGame.stage.context.fill();
myGame.stage.context.closePath();
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgb(255,255,0)';
myGame.stage.context.arc(p2.x, p2.y, 4, 0, Math.PI * 2);
myGame.stage.context.fill();
myGame.stage.context.closePath();
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgb(0,255,255)';
myGame.stage.context.arc(p3.x, p3.y, 4, 0, Math.PI * 2);
myGame.stage.context.fill();
myGame.stage.context.closePath();
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgb(0,0,255)';
myGame.stage.context.arc(p4.x, p4.y, 4, 0, Math.PI * 2);
myGame.stage.context.fill();
myGame.stage.context.closePath();
}
})();
-95
View File
@@ -1,95 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var origin:Phaser.Point;
var p1:Phaser.Point;
var p2:Phaser.Point;
var p3:Phaser.Point;
var p4:Phaser.Point;
var d: number = 0;
function create() {
// This creates a box made up of 4 edge-points and rotates it around the origin
origin = new Phaser.Point(400, 300);
p1 = new Phaser.Point(); // top left
p2 = new Phaser.Point(); // top right
p3 = new Phaser.Point(); // bottom right
p4 = new Phaser.Point(); // bottom left
}
function update() {
// top left (red)
p1.rotate(origin.x, origin.y, myGame.math.wrapAngle(d), true, 200);
// top right (yellow)
p2.rotate(origin.x, origin.y, myGame.math.wrapAngle(d + 90), true, 200);
// bottom right (aqua)
p3.rotate(origin.x, origin.y, myGame.math.wrapAngle(d + 180), true, 200);
// bottom left (blue)
p4.rotate(origin.x, origin.y, myGame.math.wrapAngle(d + 270), true, 200);
d++;
}
function render() {
// Render the shape
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgba(0,255,0,0.2)';
myGame.stage.context.strokeStyle = 'rgb(0,255,0)';
myGame.stage.context.lineWidth = 1;
myGame.stage.context.moveTo(p1.x, p1.y);
myGame.stage.context.lineTo(p2.x, p2.y);
myGame.stage.context.lineTo(p3.x, p3.y);
myGame.stage.context.lineTo(p4.x, p4.y);
myGame.stage.context.lineTo(p1.x, p1.y);
myGame.stage.context.fill();
myGame.stage.context.stroke();
myGame.stage.context.closePath();
// Render the points
myGame.stage.context.fillStyle = 'rgb(255,255,255)';
myGame.stage.context.fillRect(origin.x, origin.y, 4, 4);
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.arc(p1.x, p1.y, 4, 0, Math.PI * 2);
myGame.stage.context.fill();
myGame.stage.context.closePath();
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgb(255,255,0)';
myGame.stage.context.arc(p2.x, p2.y, 4, 0, Math.PI * 2);
myGame.stage.context.fill();
myGame.stage.context.closePath();
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgb(0,255,255)';
myGame.stage.context.arc(p3.x, p3.y, 4, 0, Math.PI * 2);
myGame.stage.context.fill();
myGame.stage.context.closePath();
myGame.stage.context.beginPath();
myGame.stage.context.fillStyle = 'rgb(0,0,255)';
myGame.stage.context.arc(p4.x, p4.y, 4, 0, Math.PI * 2);
myGame.stage.context.fill();
myGame.stage.context.closePath();
}
})();
-54
View File
@@ -1,54 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var origin;
var origin2;
var points = [];
var points2 = [];
var d = 0;
var d2 = 0;
var m = 64;
function create() {
// Let's have some fun :)
origin = new Phaser.Point(300, 200);
origin2 = new Phaser.Point(600, 350);
for(var i = 0; i < m; i++) {
points.push(new Phaser.Point());
points2.push(new Phaser.Point());
}
}
function update() {
for(var i = 0; i < m; i++) {
points[i].rotate(origin.x, origin.y, myGame.math.wrapAngle(d + (i * (360 / m))), true, i * 5);
//points2[i].rotate(origin2.x, origin2.y, myGame.math.wrapAngle(d2 + (i * (360/m))), true, i * 10);
//points[i].rotate(origin.x, origin.y, myGame.math.wrapAngle(d + (i * (360/m))), true, 200);
points2[i].rotate(origin2.x, origin2.y, myGame.math.wrapAngle(d2 + (i * (360 / m))), true, 200);
}
d -= 2;
d2 += 2;
}
function render() {
// Render the shape
myGame.stage.context.save();
//myGame.stage.context.globalCompositeOperation = 'xor';
myGame.stage.context.globalCompositeOperation = 'lighter';
myGame.stage.context.lineWidth = 20;
for(var i = 0; i < m; i++) {
myGame.stage.context.beginPath();
myGame.stage.context.strokeStyle = 'rgba(255,' + Math.round(i * (255 / m)).toString() + ',0,1)';
myGame.stage.context.moveTo(origin.x, origin.y);
myGame.stage.context.lineTo(points[i].x, points[i].y);
myGame.stage.context.stroke();
myGame.stage.context.closePath();
}
for(var i = 0; i < m; i++) {
myGame.stage.context.beginPath();
myGame.stage.context.strokeStyle = 'rgba(0,' + Math.round(i * (255 / m)).toString() + ',255,1)';
myGame.stage.context.moveTo(origin2.x, origin2.y);
myGame.stage.context.lineTo(points2[i].x, points2[i].y);
myGame.stage.context.stroke();
myGame.stage.context.closePath();
}
myGame.stage.context.restore();
}
})();
-82
View File
@@ -1,82 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var origin:Phaser.Point;
var origin2:Phaser.Point;
var points:Phaser.Point[] = [];
var points2:Phaser.Point[] = [];
var d: number = 0;
var d2: number = 0;
var m: number = 64;
function create() {
// Let's have some fun :)
origin = new Phaser.Point(300, 200);
origin2 = new Phaser.Point(600, 350);
for (var i = 0; i < m; i++)
{
points.push(new Phaser.Point());
points2.push(new Phaser.Point());
}
}
function update() {
for (var i = 0; i < m; i++)
{
points[i].rotate(origin.x, origin.y, myGame.math.wrapAngle(d + (i * (360/m))), true, i * 5);
//points2[i].rotate(origin2.x, origin2.y, myGame.math.wrapAngle(d2 + (i * (360/m))), true, i * 10);
//points[i].rotate(origin.x, origin.y, myGame.math.wrapAngle(d + (i * (360/m))), true, 200);
points2[i].rotate(origin2.x, origin2.y, myGame.math.wrapAngle(d2 + (i * (360/m))), true, 200);
}
d -= 2;
d2 += 2;
}
function render() {
// Render the shape
myGame.stage.context.save();
//myGame.stage.context.globalCompositeOperation = 'xor';
myGame.stage.context.globalCompositeOperation = 'lighter';
myGame.stage.context.lineWidth = 20;
for (var i = 0; i < m; i++)
{
myGame.stage.context.beginPath();
myGame.stage.context.strokeStyle = 'rgba(255,' + Math.round(i * (255/m)).toString() + ',0,1)';
myGame.stage.context.moveTo(origin.x, origin.y);
myGame.stage.context.lineTo(points[i].x, points[i].y);
myGame.stage.context.stroke();
myGame.stage.context.closePath();
}
for (var i = 0; i < m; i++)
{
myGame.stage.context.beginPath();
myGame.stage.context.strokeStyle = 'rgba(0,' + Math.round(i * (255/m)).toString() + ',255,1)';
myGame.stage.context.moveTo(origin2.x, origin2.y);
myGame.stage.context.lineTo(points2[i].x, points2[i].y);
myGame.stage.context.stroke();
myGame.stage.context.closePath();
}
myGame.stage.context.restore();
}
})();
-26
View File
@@ -1,26 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var segment;
function create() {
myGame.verlet.friction = 1;
segment = myGame.verlet.createLineSegments([
new Phaser.Vector2(20, 10),
new Phaser.Vector2(40, 10),
new Phaser.Vector2(60, 10),
new Phaser.Vector2(80, 10),
new Phaser.Vector2(100, 10)
], 0.02);
segment.pin(0);
segment.pin(4);
var wheel = myGame.verlet.createTire(new Phaser.Vector2(200, 50), 100, 30, 0.3, 0.9);
var tire2 = myGame.verlet.createTire(new Phaser.Vector2(400, 50), 70, 7, 0.1, 0.2);
var cube = myGame.verlet.createTire(new Phaser.Vector2(600, 50), 70, 4, 1, 1);
var tri = myGame.verlet.createTire(new Phaser.Vector2(700, 50), 100, 3, 1, 1);
}
function update() {
}
function render() {
myGame.verlet.render();
}
})();
-33
View File
@@ -1,33 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var segment: Phaser.Verlet.Composite;
function create() {
myGame.verlet.friction = 1;
segment = myGame.verlet.createLineSegments([new Phaser.Vector2(20, 10), new Phaser.Vector2(40, 10), new Phaser.Vector2(60, 10), new Phaser.Vector2(80, 10), new Phaser.Vector2(100, 10)], 0.02);
segment.pin(0);
segment.pin(4);
var wheel = myGame.verlet.createTire(new Phaser.Vector2(200,50), 100, 30, 0.3, 0.9);
var tire2 = myGame.verlet.createTire(new Phaser.Vector2(400,50), 70, 7, 0.1, 0.2);
var cube = myGame.verlet.createTire(new Phaser.Vector2(600,50), 70, 4, 1, 1);
var tri = myGame.verlet.createTire(new Phaser.Vector2(700,50), 100, 3, 1, 1);
}
function update() {
}
function render() {
myGame.verlet.render();
}
})();
-34
View File
@@ -1,34 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
myGame.loader.addImageFile('ball0', 'assets/sprites/yellow_ball.png');
myGame.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
myGame.loader.addImageFile('ball2', 'assets/sprites/blue_ball.png');
myGame.loader.addImageFile('ball3', 'assets/sprites/green_ball.png');
myGame.loader.addImageFile('ball4', 'assets/sprites/red_ball.png');
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
myGame.loader.load();
}
var wheel;
var diamond;
var triangle;
var cube;
function create() {
myGame.verlet.friction = 1;
myGame.verlet.step = 32;
wheel = myGame.verlet.createTire(new Phaser.Vector2(200, 50), 100, 30, 0.3, 0.9);
wheel.loadGraphic('ball0');
diamond = myGame.verlet.createTire(new Phaser.Vector2(400, 50), 70, 7, 0.1, 0.2);
diamond.loadGraphic('ball1');
triangle = myGame.verlet.createTire(new Phaser.Vector2(600, 50), 100, 3, 1, 1);
triangle.loadGraphic('ball2');
cube = myGame.verlet.createTire(new Phaser.Vector2(300, 50), 100, 4, 0.3, 0.9);
cube.loadGraphic('ball3');
}
function update() {
}
function render() {
myGame.verlet.render();
}
})();
-53
View File
@@ -1,53 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
myGame.loader.addImageFile('ball0', 'assets/sprites/yellow_ball.png');
myGame.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
myGame.loader.addImageFile('ball2', 'assets/sprites/blue_ball.png');
myGame.loader.addImageFile('ball3', 'assets/sprites/green_ball.png');
myGame.loader.addImageFile('ball4', 'assets/sprites/red_ball.png');
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
myGame.loader.load();
}
var wheel: Phaser.Verlet.Composite;
var diamond: Phaser.Verlet.Composite;
var triangle: Phaser.Verlet.Composite;
var cube: Phaser.Verlet.Composite;
function create() {
myGame.verlet.friction = 1;
myGame.verlet.step = 32;
wheel = myGame.verlet.createTire(new Phaser.Vector2(200,50), 100, 30, 0.3, 0.9);
wheel.loadGraphic('ball0');
diamond = myGame.verlet.createTire(new Phaser.Vector2(400,50), 70, 7, 0.1, 0.2);
diamond.loadGraphic('ball1');
triangle = myGame.verlet.createTire(new Phaser.Vector2(600,50), 100, 3, 1, 1);
triangle.loadGraphic('ball2');
cube = myGame.verlet.createTire(new Phaser.Vector2(300, 50), 100, 4, 0.3, 0.9);
cube.loadGraphic('ball3');
}
function update() {
}
function render() {
myGame.verlet.render();
}
})();
-39
View File
@@ -1,39 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
var car;
var melons;
function create() {
myGame.add.sprite(0, 0, 'grid');
melons = myGame.add.group();
for(var i = 0; i < 100; i++) {
var tempSprite = myGame.add.sprite(Math.random() * myGame.world.width, Math.random() * myGame.world.height, 'melon');
tempSprite.scrollFactor.setTo(1.2, 1.2);
melons.add(tempSprite);
}
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-66
View File
@@ -1,66 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
var car: Phaser.Sprite;
var melons: Phaser.Group;
function create() {
myGame.add.sprite(0, 0, 'grid');
melons = myGame.add.group();
for (var i = 0; i < 100; i++)
{
var tempSprite = myGame.add.sprite(Math.random() * myGame.world.width, Math.random() * myGame.world.height, 'melon');
tempSprite.scrollFactor.setTo(1.2, 1.2);
melons.add(tempSprite);
}
car = myGame.add.sprite(400, 300, 'car');
myGame.camera.follow(car);
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 300);
car.velocity.copyFrom(motion);
}
}
})();
-32
View File
@@ -1,32 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
myGame.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
myGame.loader.addImageFile('card', 'assets/sprites/mana_card.png');
myGame.loader.load();
}
var items;
var card;
function create() {
items = myGame.add.group();
// Items are rendered in the depth order in which they are added to the Group
items.add(myGame.add.sprite(64, 100, 'atari1'));
card = items.add(myGame.add.sprite(240, 80, 'card'));
items.add(myGame.add.sprite(280, 100, 'atari2'));
myGame.input.onTap.addOnce(removeCard, this);
}
function removeCard() {
// Now let's kill the card sprite
card.kill();
myGame.input.onTap.addOnce(replaceCard, this);
}
function replaceCard() {
// And bring it back to life again - I assume it will render in the same place as before?
var bob = items.getFirstDead();
bob.revive();
}
function update() {
}
})();
-56
View File
@@ -1,56 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addImageFile('atari1', 'assets/sprites/atari130xe.png');
myGame.loader.addImageFile('atari2', 'assets/sprites/atari800xl.png');
myGame.loader.addImageFile('card', 'assets/sprites/mana_card.png');
myGame.loader.load();
}
var items: Phaser.Group;
var card: Phaser.Sprite;
function create() {
items = myGame.add.group();
// Items are rendered in the depth order in which they are added to the Group
items.add(myGame.add.sprite(64, 100, 'atari1'));
card = <Phaser.Sprite> items.add(myGame.add.sprite(240, 80, 'card'));
items.add(myGame.add.sprite(280, 100, 'atari2'));
myGame.input.onTap.addOnce(removeCard, this);
}
function removeCard() {
// Now let's kill the card sprite
card.kill();
myGame.input.onTap.addOnce(replaceCard, this);
}
function replaceCard() {
// And bring it back to life again - I assume it will render in the same place as before?
var bob = items.getFirstDead();
bob.revive();
}
function update() {
}
})();
-35
View File
@@ -1,35 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
// Here we create a quite tiny game (320x240 in size)
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update, render);
function init() {
// This sets a limit on the up-scale
myGame.stage.scale.maxWidth = 640;
myGame.stage.scale.maxHeight = 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 = Phaser.StageScaleMode.SHOW_ALL;
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
function create() {
myGame.world.setSize(2000, 2000);
for(var i = 0; i < 1000; i++) {
myGame.add.sprite(myGame.world.randomX, myGame.world.randomY, 'melon');
}
}
function update() {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y += 4;
}
}
function render() {
myGame.input.renderDebugInfo(16, 16);
}
})();
-62
View File
@@ -1,62 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
// Here we create a quite tiny game (320x240 in size)
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update, render);
function init() {
// This sets a limit on the up-scale
myGame.stage.scale.maxWidth = 640;
myGame.stage.scale.maxHeight = 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 = Phaser.StageScaleMode.SHOW_ALL;
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
function create() {
myGame.world.setSize(2000, 2000);
for (var i = 0; i < 1000; i++)
{
myGame.add.sprite(myGame.world.randomX, myGame.world.randomY, 'melon');
}
}
function update() {
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y += 4;
}
}
function render() {
myGame.input.renderDebugInfo(16, 16);
}
})();
-23
View File
@@ -1,23 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
myGame.loader.addImageFile('dragonsun', 'assets/pics/cougar_dragonsun.png');
myGame.loader.load();
}
function create() {
console.log('dragons 8');
myGame.input.onDown.add(test1, this);
}
function test1() {
console.log('down');
}
function update() {
}
function render() {
myGame.input.pointer1.renderDebug();
myGame.input.pointer2.renderDebug();
myGame.input.pointer3.renderDebug();
myGame.input.pointer4.renderDebug();
}
})();
-40
View File
@@ -1,40 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
myGame.loader.addImageFile('dragonsun', 'assets/pics/cougar_dragonsun.png');
myGame.loader.load();
}
function create() {
console.log('dragons 8');
myGame.input.onDown.add(test1, this);
}
function test1() {
console.log('down');
}
function update() {
}
function render() {
myGame.input.pointer1.renderDebug();
myGame.input.pointer2.renderDebug();
myGame.input.pointer3.renderDebug();
myGame.input.pointer4.renderDebug();
}
})();
-39
View File
@@ -1,39 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
myGame.loader.addImageFile('ball0', 'assets/sprites/yellow_ball.png');
myGame.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
myGame.loader.addImageFile('ball2', 'assets/sprites/blue_ball.png');
myGame.loader.addImageFile('ball3', 'assets/sprites/green_ball.png');
myGame.loader.addImageFile('ball4', 'assets/sprites/red_ball.png');
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
myGame.loader.load();
}
var balls;
function create() {
balls = myGame.add.group();
myGame.input.onTap.add(tapped, this);
}
function tapped(pointer, doubleTap) {
if(balls.countDead() > 0) {
var tempBall = balls.getFirstDead();
tempBall.revive();
tempBall.x = pointer.x;
tempBall.y = pointer.y;
} else {
var tempBall = new Phaser.Sprite(myGame, pointer.x, pointer.y, 'ball' + Math.round(Math.random() * 5));
tempBall.setBoundsFromWorld(Phaser.GameObject.OUT_OF_BOUNDS_KILL);
balls.add(tempBall);
}
tempBall.velocity.y = 150;
if(doubleTap) {
tempBall.scale.setTo(4, 4);
}
}
function update() {
}
function render() {
myGame.input.renderDebugInfo(16, 16);
}
})();
-64
View File
@@ -1,64 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
myGame.loader.addImageFile('ball0', 'assets/sprites/yellow_ball.png');
myGame.loader.addImageFile('ball1', 'assets/sprites/aqua_ball.png');
myGame.loader.addImageFile('ball2', 'assets/sprites/blue_ball.png');
myGame.loader.addImageFile('ball3', 'assets/sprites/green_ball.png');
myGame.loader.addImageFile('ball4', 'assets/sprites/red_ball.png');
myGame.loader.addImageFile('ball5', 'assets/sprites/purple_ball.png');
myGame.loader.load();
}
var balls: Phaser.Group;
function create() {
balls = myGame.add.group();
myGame.input.onTap.add(tapped, this);
}
function tapped(pointer: Phaser.Pointer, doubleTap: bool) {
if (balls.countDead() > 0)
{
var tempBall: Phaser.Sprite = <Phaser.Sprite> balls.getFirstDead();
tempBall.revive();
tempBall.x = pointer.x;
tempBall.y = pointer.y;
}
else
{
var tempBall: Phaser.Sprite = new Phaser.Sprite(myGame, pointer.x, pointer.y, 'ball' + Math.round(Math.random() * 5));
tempBall.setBoundsFromWorld(Phaser.GameObject.OUT_OF_BOUNDS_KILL);
balls.add(tempBall);
}
tempBall.velocity.y = 150;
if (doubleTap)
{
tempBall.scale.setTo(4, 4);
}
}
function update() {
}
function render() {
myGame.input.renderDebugInfo(16, 16);
}
})();
-19
View File
@@ -1,19 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
}
function create() {
// We lock the game to allowing only 1 Pointer active
// This means on multi-touch systems it will ignore any extra fingers placed down beyond the first
myGame.input.maxPointers = 1;
}
function update() {
}
function render() {
myGame.input.renderDebugInfo(16, 16);
myGame.input.pointer1.renderDebug(true);
myGame.input.pointer2.renderDebug(true);
myGame.input.pointer3.renderDebug(true);
}
})();
-31
View File
@@ -1,31 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
}
function create() {
// We lock the game to allowing only 1 Pointer active
// This means on multi-touch systems it will ignore any extra fingers placed down beyond the first
myGame.input.maxPointers = 1;
}
function update() {
}
function render() {
myGame.input.renderDebugInfo(16, 16);
myGame.input.pointer1.renderDebug(true);
myGame.input.pointer2.renderDebug(true);
myGame.input.pointer3.renderDebug(true);
}
})();
-36
View File
@@ -1,36 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.load();
}
var car;
var bigCam;
function create() {
myGame.camera.setBounds(0, 0, myGame.stage.width, myGame.stage.height);
myGame.add.sprite(0, 0, 'track');
car = myGame.add.sprite(180, 298, 'car');
car.rotation = 180;
car.maxVelocity.setTo(150, 150);
bigCam = myGame.add.camera(640, 0, 100, 200);
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(Phaser.Keyboard.LEFT)) {
car.rotation -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.rotation += 4;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 150));
} else {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 60));
}
}
})();
-59
View File
@@ -1,59 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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');
myGame.loader.load();
}
var car: Phaser.Sprite;
var bigCam: Phaser.Camera;
function create() {
myGame.camera.setBounds(0, 0, myGame.stage.width, myGame.stage.height);
myGame.add.sprite(0, 0, 'track');
car = myGame.add.sprite(180, 298, 'car');
car.rotation = 180;
car.maxVelocity.setTo(150, 150);
bigCam = myGame.add.camera(640, 0, 100, 200);
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(Phaser.Keyboard.LEFT))
{
car.rotation -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.rotation += 4;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 150));
}
else
{
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 60));
}
}
})();
+5
View File
@@ -0,0 +1,5 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
// If you don't give any parameters to Phaser beyond the defaults you'll see the standard Phaser boot screen appear.
var game = new Phaser.Game(this, 'game');
})();
+8
View File
@@ -0,0 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
// If you don't give any parameters to Phaser beyond the defaults you'll see the standard Phaser boot screen appear.
var game = new Phaser.Game(this, 'game');
})();
-4
View File
@@ -1,4 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600);
})();
-7
View File
@@ -1,7 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600);
})();
-58
View File
@@ -1,58 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
// Let's test having 2 totally separate games embedded on the same page
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 Phaser.Game(this, 'game', 400, 400, init2, create2, update2);
function init() {
myGame.world.setSize(3000, 3000);
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
function create() {
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
for(var i = 0; i < 1000; i++) {
myGame.add.sprite(myGame.world.randomX, myGame.world.randomY, 'melon');
}
}
function update() {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
myGame.camera.scroll.x -= 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
myGame.camera.scroll.x += 4;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
myGame.camera.scroll.y += 4;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
myGame.camera.scroll.y -= 4;
}
}
// And now for game 2, we're basically just duplicating the functions from above, but that's fine for this test
function init2() {
myGame2.world.setSize(1920, 1920);
myGame2.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
myGame2.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame2.loader.load();
}
var car;
function create2() {
myGame2.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
myGame2.add.sprite(0, 0, 'grid');
car = myGame2.add.sprite(400, 300, 'car');
myGame2.camera.follow(car);
}
function update2() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame2.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame2.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame2.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
}
})();
-104
View File
@@ -1,104 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
// Let's test having 2 totally separate games embedded on the same page
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 Phaser.Game(this, 'game', 400, 400, init2, create2, update2);
function init() {
myGame.world.setSize(3000, 3000);
myGame.loader.addImageFile('melon', 'assets/sprites/melon.png');
myGame.loader.load();
}
function create() {
myGame.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
for (var i = 0; i < 1000; i++)
{
myGame.add.sprite(myGame.world.randomX, myGame.world.randomY, 'melon');
}
}
function update() {
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
myGame.camera.scroll.x -= 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
myGame.camera.scroll.x += 4;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
myGame.camera.scroll.y += 4;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
myGame.camera.scroll.y -= 4;
}
}
// And now for game 2, we're basically just duplicating the functions from above, but that's fine for this test
function init2() {
myGame2.world.setSize(1920, 1920);
myGame2.loader.addImageFile('grid', 'assets/tests/debug-grid-1920x1920.png');
myGame2.loader.addImageFile('car', 'assets/sprites/car90.png');
myGame2.loader.load();
}
var car;
function create2() {
myGame2.camera.setBounds(0, 0, myGame.world.width, myGame.world.height);
myGame2.add.sprite(0, 0, 'grid');
car = myGame2.add.sprite(400, 300, 'car');
myGame2.camera.follow(car);
}
function update2() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame2.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame2.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame2.input.keyboard.isDown(Phaser.Keyboard.UP))
{
car.velocity.copyFrom(myGame.motion.velocityFromAngle(car.angle, 300));
}
}
})();
-46
View File
@@ -1,46 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var starfield;
var xx = [];
var yy = [];
var zz = [];
var xxx = 0;
var yyy = 0;
function create() {
// the width of the starfield
var star_w = 12000;
for(var i = 0; i < 800; i++) {
xx[i] = Math.floor(Math.random() * star_w * 2) - star_w;
yy[i] = Math.floor(Math.random() * star_w * 2) - star_w;
zz[i] = Math.floor(Math.random() * 160) + 1;
}
starfield = myGame.add.dynamicTexture(800, 600);
}
function update() {
starfield.clear();
for(var i = 0; i < 800; i++) {
if(zz[i] == 1) {
zz[i] = 100;
}
xxx = (xx[i]) / (zz[i]);
yyy = (yy[i]) / (zz[i])--;
//var x: number = xxx + myGame.input.x;
//var y: number = yyy + myGame.input.y;
var x = xxx + 400;
var y = yyy + 300;
var c = '#ffffff';
if(zz[i] > 80) {
c = '#666666';
} else if(zz[i] > 60) {
c = '#888888';
} else if(zz[i] > 40) {
c = '#aaaaaa';
}
starfield.setPixel(x, y, c);
}
}
function render() {
starfield.render();
}
})();
-61
View File
@@ -1,61 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
var starfield: Phaser.DynamicTexture;
var xx = [];
var yy = [];
var zz = [];
var xxx = 0;
var yyy = 0;
function create() {
// the width of the starfield
var star_w: number = 12000;
for (var i: number = 0; i < 800; i++)
{
xx[i] = Math.floor(Math.random() * star_w * 2) - star_w
yy[i] = Math.floor(Math.random() * star_w * 2) - star_w
zz[i] = Math.floor(Math.random() * 160) + 1;
}
starfield = myGame.add.dynamicTexture(800, 600);
}
function update() {
starfield.clear();
for (var i: number = 0; i < 800; i++)
{
if (zz[i] == 1) zz[i] = 100;
xxx = (xx[i]) / (zz[i]);
yyy = (yy[i]) / (zz[i])--;
//var x: number = xxx + myGame.input.x;
//var y: number = yyy + myGame.input.y;
var x: number = xxx + 400;
var y: number = yyy + 300;
var c: string = '#ffffff';
if (zz[i] > 80) c = '#666666';
else if (zz[i] > 60) c = '#888888'
else if (zz[i] > 40) c = '#aaaaaa';
starfield.setPixel(x, y, c);
}
}
function render() {
starfield.render();
}
})();
-33
View File
@@ -1,33 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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();
}
var car;
function create() {
car = myGame.add.sprite(200, 300, 'car');
myGame.onRenderCallback = render;
myGame.stage.context.font = '16px Arial';
myGame.stage.context.fillStyle = 'rgb(255,255,255)';
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.angularVelocity = -200;
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.angularVelocity = 200;
}
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
var motion = myGame.motion.velocityFromAngle(car.angle, 200);
car.velocity.copyFrom(motion);
}
}
function render() {
myGame.stage.context.fillText(myGame.time.time.toString(), 32, 32);
}
})();
-58
View File
@@ -1,58 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
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();
}
var car: Phaser.Sprite;
function create() {
car = myGame.add.sprite(200, 300, 'car');
myGame.onRenderCallback = render;
myGame.stage.context.font = '16px Arial';
myGame.stage.context.fillStyle = 'rgb(255,255,255)';
}
function update() {
car.velocity.x = 0;
car.velocity.y = 0;
car.angularVelocity = 0;
car.angularAcceleration = 0;
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
car.angularVelocity = -200;
}
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
car.angularVelocity = 200;
}
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
{
var motion:Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 200);
car.velocity.copyFrom(motion);
}
}
function render() {
myGame.stage.context.fillText(myGame.time.time.toString(), 32, 32);
}
})();
-58
View File
@@ -1,58 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 320, 460, init, create, update, render);
function init() {
myGame.loader.addImageFile('bunny', 'assets/sprites/wabbit.png');
myGame.loader.load();
myGame.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
}
var maxX;
var maxY;
var minX;
var minY;
function create() {
minX = 0;
minY = 0;
maxX = myGame.stage.width - 26;
maxY = myGame.stage.height - 37;
myGame.input.onDown.add(addBunnies, this);
// This will really help on slow Android phones
myGame.framerate = 30;
// Make sure the camera doesn't clip anything
myGame.camera.disableClipping = true;
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.font = '20px Arial';
addBunnies();
}
function addBunnies() {
for(var i = 0; i < 10; i++) {
var tempSprite = myGame.add.sprite(myGame.stage.randomX, 0, 'bunny');
tempSprite.velocity.x = -200 + (Math.random() * 400);
tempSprite.velocity.y = 100 + Math.random() * 200;
}
}
function update() {
myGame.world.group.forEach(checkWalls);
}
function render() {
// Note: Displaying canvas text causes a big performance hit on mobile
myGame.stage.context.fillText("fps: " + myGame.time.fps.toString(), 0, 32);
}
function checkWalls(bunny) {
if(bunny.x > maxX) {
bunny.velocity.x *= -1;
bunny.x = maxX;
} else if(bunny.x < minX) {
bunny.velocity.x *= -1;
bunny.x = minX;
}
if(bunny.y > maxY) {
bunny.velocity.y *= -0.8;
bunny.y = maxY;
} else if(bunny.y < minY) {
bunny.velocity.x = -200 + (Math.random() * 400);
bunny.velocity.y = 100 + Math.random() * 200;
bunny.y = minY;
}
}
})();
-94
View File
@@ -1,94 +0,0 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 320, 460, init, create, update, render);
function init() {
myGame.loader.addImageFile('bunny', 'assets/sprites/wabbit.png');
myGame.loader.load();
myGame.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
}
var maxX: number;
var maxY: number;
var minX: number;
var minY: number;
function create() {
minX = 0;
minY = 0;
maxX = myGame.stage.width - 26;
maxY = myGame.stage.height - 37;
myGame.input.onDown.add(addBunnies, this);
// This will really help on slow Android phones
myGame.framerate = 30;
// Make sure the camera doesn't clip anything
myGame.camera.disableClipping = true;
myGame.stage.context.fillStyle = 'rgb(255,0,0)';
myGame.stage.context.font = '20px Arial';
addBunnies();
}
function addBunnies() {
for (var i = 0; i < 10; i++)
{
var tempSprite = myGame.add.sprite(myGame.stage.randomX, 0, 'bunny');
tempSprite.velocity.x = -200 + (Math.random() * 400);
tempSprite.velocity.y = 100 + Math.random() * 200;
}
}
function update() {
myGame.world.group.forEach(checkWalls);
}
function render() {
// Note: Displaying canvas text causes a big performance hit on mobile
myGame.stage.context.fillText("fps: " + myGame.time.fps.toString(), 0, 32);
}
function checkWalls(bunny:Phaser.Sprite) {
if (bunny.x > maxX)
{
bunny.velocity.x *= -1;
bunny.x = maxX;
}
else if (bunny.x < minX)
{
bunny.velocity.x *= -1;
bunny.x = minX;
}
if (bunny.y > maxY)
{
bunny.velocity.y *= -0.8;
bunny.y = maxY;
}
else if (bunny.y < minY)
{
bunny.velocity.x = -200 + (Math.random() * 400);
bunny.velocity.y = 100 + Math.random() * 200;
bunny.y = minY;
}
}
})();
-62
View File
@@ -1,62 +0,0 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0" />
<title>Phaser Mobile Fullscreen Test</title>
<style>
body {
padding: 0;
margin: 0;
}
</style>
<script src="../phaser.js"></script>
</head>
<body>
<div id="game"></div>
<script type="text/javascript">
var myGame = new Game(this, 'game', 320, 200, init, create, update);
function init() {
myGame.stage.fullscreen.go();
myGame.loader.addImageFile('backdrop1', '../assets/pics/atari_fujilogo.png');
myGame.loader.addImageFile('backdrop2', '../assets/pics/acryl_bladerunner.png');
myGame.loader.load();
}
var pic1;
var pic2;
function create() {
pic1 = myGame.createSprite(0, 0, 'backdrop1');
pic2 = myGame.createSprite(0, 0, 'backdrop2');
}
function update() {
if (myGame.stage.fullscreen.isLandscape == true)
{
pic1.visible = true;
pic2.visible = false;
}
else
{
pic2.visible = true;
pic1.visible = false;
}
}
</script>
</body>
</html>

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