mirror of
https://github.com/wassname/phaser.git
synced 2026-08-16 11:25:21 +08:00
Preparing for new release
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/// <reference path="../../Phaser/Phaser.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
var circle;
|
||||
var floor;
|
||||
function create() {
|
||||
circle = myGame.createGeomSprite(200, 0);
|
||||
circle.createCircle(64);
|
||||
circle.acceleration.y = 100;
|
||||
circle.elasticity = 0.8;
|
||||
// A simple floor
|
||||
floor = myGame.createGeomSprite(0, 550);
|
||||
floor.createRectangle(800, 50);
|
||||
floor.immovable = true;
|
||||
}
|
||||
function update() {
|
||||
myGame.collide(circle, floor);
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path="../../Phaser/Phaser.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
|
||||
var circle: Phaser.GeomSprite;
|
||||
var floor: Phaser.GeomSprite;
|
||||
|
||||
function create() {
|
||||
|
||||
circle = myGame.createGeomSprite(200, 0);
|
||||
circle.createCircle(64);
|
||||
circle.acceleration.y = 100;
|
||||
circle.elasticity = 0.8;
|
||||
|
||||
// A simple floor
|
||||
floor = myGame.createGeomSprite(0, 550);
|
||||
floor.createRectangle(800, 50);
|
||||
floor.immovable = true;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
myGame.collide(circle, floor);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="../../Phaser/Phaser.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
var line;
|
||||
function create() {
|
||||
line = myGame.createGeomSprite(200, 200);
|
||||
line.createLine(400, 400);
|
||||
}
|
||||
function update() {
|
||||
//box.velocity.x = 0;
|
||||
//box.velocity.y = 0;
|
||||
//box.angularVelocity = 0;
|
||||
//box.angularAcceleration = 0;
|
||||
//if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
//{
|
||||
// box.angularVelocity = -200;
|
||||
//}
|
||||
//else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
//{
|
||||
// box.angularVelocity = 200;
|
||||
//}
|
||||
//if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
//{
|
||||
// box.velocity.copyFrom(myGame.motion.velocityFromAngle(box.angle, 200));
|
||||
//}
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,40 @@
|
||||
/// <reference path="../../Phaser/Phaser.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
|
||||
var line: Phaser.GeomSprite;
|
||||
|
||||
function create() {
|
||||
|
||||
line = myGame.createGeomSprite(200, 200);
|
||||
|
||||
line.createLine(400, 400);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
//box.velocity.x = 0;
|
||||
//box.velocity.y = 0;
|
||||
//box.angularVelocity = 0;
|
||||
//box.angularAcceleration = 0;
|
||||
|
||||
//if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
//{
|
||||
// box.angularVelocity = -200;
|
||||
//}
|
||||
//else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
//{
|
||||
// box.angularVelocity = 200;
|
||||
//}
|
||||
|
||||
//if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
//{
|
||||
// box.velocity.copyFrom(myGame.motion.velocityFromAngle(box.angle, 200));
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path="../../Phaser/Phaser.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
var floor;
|
||||
function create() {
|
||||
for(var i = 0; i < 100; i++) {
|
||||
var p = myGame.createGeomSprite(myGame.stage.randomX, Math.random() * 100);
|
||||
p.createPoint();
|
||||
p.fillColor = 'rgb(255,255,255)';
|
||||
p.acceleration.y = 100 + Math.random() * 100;
|
||||
p.elasticity = 0.8;
|
||||
}
|
||||
// A simple floor
|
||||
floor = myGame.createGeomSprite(0, 550);
|
||||
floor.createRectangle(800, 50);
|
||||
floor.immovable = true;
|
||||
}
|
||||
function update() {
|
||||
myGame.collide(myGame.world.group, floor);
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference path="../../Phaser/Phaser.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
|
||||
var floor: Phaser.GeomSprite;
|
||||
|
||||
function create() {
|
||||
|
||||
for (var i = 0; i < 100; i++)
|
||||
{
|
||||
var p:Phaser.GeomSprite = myGame.createGeomSprite(myGame.stage.randomX, Math.random() * 100);
|
||||
p.createPoint();
|
||||
p.fillColor = 'rgb(255,255,255)';
|
||||
p.acceleration.y = 100 + Math.random() * 100;
|
||||
p.elasticity = 0.8;
|
||||
}
|
||||
|
||||
// A simple floor
|
||||
floor = myGame.createGeomSprite(0, 550);
|
||||
floor.createRectangle(800, 50);
|
||||
floor.immovable = true;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
myGame.collide(myGame.world.group, floor);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,18 @@
|
||||
/// <reference path="../../Phaser/Phaser.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
var box1;
|
||||
var box2;
|
||||
function create() {
|
||||
box2 = myGame.createGeomSprite(300, 300).createRectangle(128, 128);
|
||||
box1 = myGame.createGeomSprite(320, 100).createRectangle(64, 64);
|
||||
box1.velocity.y = 50;
|
||||
}
|
||||
function update() {
|
||||
if(box1.collide(box2) == true) {
|
||||
box1.fillColor = 'rgb(255,0,0)';
|
||||
} else {
|
||||
box1.fillColor = 'rgb(0,255,0)';
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,32 @@
|
||||
/// <reference path="../../Phaser/Phaser.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
|
||||
var box1: Phaser.GeomSprite;
|
||||
var box2: Phaser.GeomSprite;
|
||||
|
||||
function create() {
|
||||
|
||||
box2 = myGame.createGeomSprite(300, 300).createRectangle(128, 128);
|
||||
box1 = myGame.createGeomSprite(320, 100).createRectangle(64, 64);
|
||||
|
||||
box1.velocity.y = 50;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
if (box1.collide(box2) == true)
|
||||
{
|
||||
box1.fillColor = 'rgb(255,0,0)';
|
||||
}
|
||||
else
|
||||
{
|
||||
box1.fillColor = 'rgb(0,255,0)';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
var box;
|
||||
function create() {
|
||||
box = myGame.createGeomSprite(200, 200);
|
||||
box.createRectangle(64, 64);
|
||||
}
|
||||
function update() {
|
||||
box.velocity.x = 0;
|
||||
box.velocity.y = 0;
|
||||
box.angularVelocity = 0;
|
||||
box.angularAcceleration = 0;
|
||||
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
|
||||
box.angularVelocity = -200;
|
||||
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
|
||||
box.angularVelocity = 200;
|
||||
}
|
||||
if(myGame.input.keyboard.isDown(Phaser.Keyboard.UP)) {
|
||||
box.velocity.copyFrom(myGame.motion.velocityFromAngle(box.angle, 200));
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,40 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
||||
|
||||
var box: Phaser.GeomSprite;
|
||||
|
||||
function create() {
|
||||
|
||||
box = myGame.createGeomSprite(200, 200);
|
||||
|
||||
box.createRectangle(64, 64);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
box.velocity.x = 0;
|
||||
box.velocity.y = 0;
|
||||
box.angularVelocity = 0;
|
||||
box.angularAcceleration = 0;
|
||||
|
||||
if (myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
box.angularVelocity = -200;
|
||||
}
|
||||
else if (myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
{
|
||||
box.angularVelocity = 200;
|
||||
}
|
||||
|
||||
if (myGame.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
{
|
||||
box.velocity.copyFrom(myGame.motion.velocityFromAngle(box.angle, 200));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user