Updating copyright year and README.

This commit is contained in:
photonstorm
2014-02-05 16:54:59 +00:00
parent 8e77e8cedb
commit 0896c2fac7
102 changed files with 160 additions and 298 deletions
+1 -2
View File
@@ -41,7 +41,6 @@ function create() {
sprite4 = game.add.sprite(380, 100, 'wizball');
sprite4.body.setCircle(46);
sprite4.body.collideWorldBounds = true;
sprite4.body.friction = 0;
sprite4.body.bounce.setTo(0.9, 0.9);
sprite4.body.velocity.setTo(100, 100);
@@ -49,7 +48,7 @@ function create() {
function update() {
game.physics.collideArray(sprite4, [ sprite1, sprite2, sprite3 ]);
game.physics.collide(sprite4, [ sprite1, sprite2, sprite3 ]);
}
+8 -15
View File
@@ -25,17 +25,6 @@ var bg;
function create() {
$('#step').click(function(){
console.log('---- STEP', game.stepCount, '-------------------------------');
game.step();
});
$('#start').click(function(){
console.log('---- START DEBUGGING -------------------------------');
game.enableStep();
player.debug = true;
});
game.stage.backgroundColor = '#000000';
bg = game.add.tileSprite(0, 0, 800, 600, 'background');
@@ -63,6 +52,9 @@ function create() {
player.body.collideWorldBounds = true;
player.body.setRectangle(16, 32, 8, 16);
// Un-comment this on to see the body collision areas / data
// player.debug = true;
player.animations.add('left', [0, 1, 2, 3], 10, true);
player.animations.add('turn', [4], 20, true);
player.animations.add('right', [5, 6, 7, 8], 10, true);
@@ -119,10 +111,8 @@ function update() {
}
}
// if (jumpButton.isDown && player.body.touching.down && game.time.now > jumpTimer)
if (jumpButton.isDown && player.body.onFloor() && game.time.now > jumpTimer)
{
console.log('jump');
player.body.velocity.y = -250;
jumpTimer = game.time.now + 750;
}
@@ -131,7 +121,10 @@ function update() {
function render () {
game.debug.renderPhysicsBody(player.body);
game.debug.renderBodyInfo(player, 16, 24);
if (player.debug)
{
game.debug.renderPhysicsBody(player.body);
game.debug.renderBodyInfo(player, 16, 24);
}
}
+5 -7
View File
@@ -21,7 +21,7 @@ EnemyTank = function (index, game, player, bullets) {
this.turret.anchor.setTo(0.3, 0.5);
this.tank.name = index.toString();
this.tank.body.immovable = true;
this.tank.body.immovable = false;
this.tank.body.collideWorldBounds = true;
this.tank.body.bounce.setTo(1, 1);
@@ -77,7 +77,6 @@ EnemyTank.prototype.update = function() {
};
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload () {
@@ -122,10 +121,9 @@ function create () {
tank = game.add.sprite(0, 0, 'tank', 'tank1');
tank.anchor.setTo(0.5, 0.5);
tank.animations.add('move', ['tank1', 'tank2', 'tank3', 'tank4', 'tank5', 'tank6'], 20, true);
// tank.play('move');
// This will force it to decelerate and limit its speed
tank.body.friction = 0.2;
tank.body.linearDamping = 0.2;
tank.body.maxVelocity.setTo(400, 400);
tank.body.collideWorldBounds = true;
@@ -194,15 +192,15 @@ function removeLogo () {
function update () {
game.physics.collide(enemyBullets, tank, bulletHitPlayer, null, this);
game.physics.overlap(enemyBullets, tank, bulletHitPlayer, null, this);
for (var i = 0; i < enemies.length; i++)
{
if (enemies[i].alive)
{
enemies[i].update();
game.physics.collide(tank, enemies[i].tank);
game.physics.collide(bullets, enemies[i].tank, bulletHitEnemy, null, this);
game.physics.overlap(bullets, enemies[i].tank, bulletHitEnemy, null, this);
enemies[i].update();
}
}
+2 -2
View File
@@ -42,7 +42,7 @@ function create() {
wab.name = 'wab' + i;
wab.body.collideWorldBounds = true;
wab.body.mass = 0.1;
wab.body.friction = 0.2;
wab.body.linearDamping = 0.2;
}
hill = game.add.sprite(450, 400, 'hill');
@@ -53,7 +53,7 @@ function create() {
block = game.add.sprite(575, 300, 'block');
block.body.collideWorldBounds = true;
block.body.mass = 5;
block.body..friction = 0.4;
block.body.linearDamping = 0.4;
analog = game.add.sprite(200, 450, 'analog');
analog.body.allowGravity = false;
+1 -1
View File
@@ -133,7 +133,7 @@ function create () {
// tank.play('move');
// This will force it to decelerate and limit its speed
tank.body.friction = 0.2;
tank.body.linearDamping = 0.2;
tank.body.maxVelocity.setTo(400, 400);
tank.body.collideWorldBounds = true;
+1 -1
View File
@@ -42,7 +42,7 @@ function create() {
player.anchor.setTo(0.5, 0.5);
player.body.collideWorldBounds = true;
player.body.bounce.setTo(0.9, 0.9);
player.body.friction = 0.2;
player.body.linearDamping = 0.2;
player.body.gravity.setTo(0, 8);
// Enable input.
+1 -1
View File
@@ -37,7 +37,7 @@ function create() {
player.anchor.setTo(0.5, 0.5);
player.body.collideWorldBounds = true;
player.body.bounce.setTo(0.9, 0.9);
player.body.friction = 0.2;
player.body.linearDamping = 0.2;
// Enable input.
player.inputEnabled = true;
+1 -1
View File
@@ -23,7 +23,7 @@ function create() {
s.name = 'alien' + s;
s.body.collideWorldBounds = true;
s.body.bounce.setTo(0.8, 0.8);
s.body.friction = 0;
s.body.linearDamping = 0;
s.body.minVelocity.setTo(0, 0);
s.body.velocity.setTo(10 + Math.random() * 40, 10 + Math.random() * 40);
}
@@ -16,11 +16,12 @@ function create() {
ball = game.add.sprite(400, 0, 'ball');
ball.body.gravity.y = 6;
ball.body.gravity.y = 200;
ball.body.bounce.y = 1;
tilesprite = game.add.tileSprite(300, 450, 200, 100, 'starfield');
tilesprite.body.immovable = true;
tilesprite.body.setRectangle(200, 100, 0, 0);
cursors = game.input.keyboard.createCursorKeys();
@@ -32,13 +33,13 @@ function update() {
if (cursors.left.isDown)
{
tilesprite.x += 8;
tilesprite.tilePosition.x += 8;
tilesprite.x -= 8;
tilesprite.tilePosition.x -= 8;
}
else if (cursors.right.isDown)
{
tilesprite.x -= 8;
tilesprite.tilePosition.x -= 8;
tilesprite.x += 8;
tilesprite.tilePosition.x += 8;
}
if (cursors.up.isDown)
@@ -54,6 +55,6 @@ function update() {
function render() {
game.debug.renderSpriteBounds(tilesprite);
game.debug.renderPhysicsBody(tilesprite.body);
}
+1 -1
View File
@@ -43,7 +43,7 @@ function create() {
game.physics.gravity.y = 250;
p.body.bounce.y = 0.2;
p.body.friction = 1;
p.body.linearDamping = 1;
p.body.collideWorldBounds = true;
game.camera.follow(p);
+2 -2
View File
@@ -176,7 +176,7 @@ function test7() {
// sprite.body.gravity.y = 200;
// sprite.body.friction = 0.2;
// sprite.body.linearDamping = 0.2;
game.input.onDown.add(launch7, this);
@@ -375,7 +375,7 @@ function update() {
if (sprite3)
{
game.physics.collideArray(sprite, [sprite2, sprite3]);
game.physics.collide(sprite, [sprite2, sprite3]);
game.physics.collide(sprite2, sprite3);
}
else
+1 -1
View File
@@ -29,7 +29,7 @@ function create() {
car.body.collideWorldBounds = true;
car.body.bounce.setTo(0.8, 0.8);
car.body.allowRotation = true;
car.body.friction = 0.4;
car.body.linearDamping = 0.4;
// car.body.acceleration.x = 10;
game.input.onDown.add(start, this);
+2 -2
View File
@@ -59,13 +59,13 @@ function test8() {
sprite.body.bounce.setTo(0.8, 0.8);
sprite.body.minBounceVelocity = 1.2;
sprite.body.velocity.x = -400;
sprite.body.friction = 1.2;
sprite.body.linearDamping = 1.2;
sprite2 = game.add.sprite(500, 100, 'ball');
sprite2.body.collideWorldBounds = true;
sprite2.body.bounce.setTo(0.5, 0.5);
sprite2.body.minBounceVelocity = 0.8;
sprite2.body.friction = 0.5;
sprite2.body.linearDamping = 0.5;
game.input.onDown.add(launch8, this);
+7 -7
View File
@@ -152,7 +152,7 @@ function test5() {
// sprite2.body.checkCollision.down = false;
// sprite2.body.mass = 1;
sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch5, this);
@@ -182,7 +182,7 @@ function test4() {
sprite2.body.checkCollision.down = false;
// sprite2.body.mass = 1;
// sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch4, this);
@@ -213,7 +213,7 @@ function test3() {
sprite2.body.bounce.setTo(0.9, 0.9);
// sprite2.body.mass = 1;
// sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch3, this);
@@ -237,7 +237,7 @@ function test2() {
sprite.body.collideWorldBounds = true;
// sprite.body.checkCollision.right = false;
sprite.body.bounce.setTo(0.9, 0.9);
// sprite.body.friction = 0;
// sprite.body.linearDamping = 0;
// sprite.scale.setTo(2, 2);
// sprite.body.mass = 2;
@@ -248,7 +248,7 @@ function test2() {
// sprite2.body.bounce.setTo(0.9, 0.9);
// sprite2.body.mass = 1;
// sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch2, this);
@@ -274,7 +274,7 @@ function test1() {
sprite.body.checkCollision.right = false;
// sprite.body.bounce.setTo(0.9, 0.9);
// sprite.body.bounce.setTo(1, 1);
// sprite.body.friction = 0;
// sprite.body.linearDamping = 0;
// sprite.scale.setTo(2, 2);
// sprite.body.mass = 2;
@@ -284,7 +284,7 @@ function test1() {
sprite2.body.bounce.setTo(0.9, 0.9);
// sprite2.body.mass = 1;
// sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch1, this);
+1 -1
View File
@@ -28,7 +28,7 @@ function create() {
sprites.setAll('body.collideWorldBounds', true);
sprites.setAll('body.bounce.x', 1);
sprites.setAll('body.bounce.y', 1);
sprites.setAll('body.friction', 0);
sprites.setAll('body.linearDamping', 0);
sprites.setAll('body.minBounceVelocity', 0);
}
+7 -7
View File
@@ -138,7 +138,7 @@ function test5() {
// sprite2.body.checkCollision.down = false;
// sprite2.body.mass = 1;
sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch5, this);
@@ -168,7 +168,7 @@ function test4() {
sprite2.body.checkCollision.down = false;
// sprite2.body.mass = 1;
// sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch4, this);
@@ -199,7 +199,7 @@ function test3() {
sprite2.body.bounce.setTo(0.9, 0.9);
// sprite2.body.mass = 1;
// sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch3, this);
@@ -223,7 +223,7 @@ function test2() {
sprite.body.collideWorldBounds = true;
// sprite.body.checkCollision.right = false;
sprite.body.bounce.setTo(0.9, 0.9);
// sprite.body.friction = 0;
// sprite.body.linearDamping = 0;
// sprite.scale.setTo(2, 2);
// sprite.body.mass = 2;
@@ -234,7 +234,7 @@ function test2() {
// sprite2.body.bounce.setTo(0.9, 0.9);
// sprite2.body.mass = 1;
// sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch2, this);
@@ -260,7 +260,7 @@ function test1() {
sprite.body.checkCollision.right = false;
// sprite.body.bounce.setTo(0.9, 0.9);
// sprite.body.bounce.setTo(1, 1);
// sprite.body.friction = 0;
// sprite.body.linearDamping = 0;
// sprite.scale.setTo(2, 2);
// sprite.body.mass = 2;
@@ -270,7 +270,7 @@ function test1() {
sprite2.body.bounce.setTo(0.9, 0.9);
// sprite2.body.mass = 1;
// sprite2.body.bounce.setTo(1, 1);
// sprite2.body.friction = 0;
// sprite2.body.linearDamping = 0;
game.input.onDown.add(launch1, this);
+1 -1
View File
@@ -34,7 +34,7 @@ function create() {
//sprite.body.drag.setTo(0, -20);
// sprite.body.drag.setTo(10, 10);
sprite.body.friction = 0.1;
sprite.body.linearDamping = 0.1;
// sprite.body.sleepMin.setTo(-50, -20);
// sprite.body.sleepMax.setTo(50, 20);
+2 -2
View File
@@ -48,7 +48,7 @@ function create() {
balls.setAll('body.bounce.x', 0.8);
balls.setAll('body.bounce.y', 0.9);
balls.setAll('body.minBounceVelocity', 0.9);
balls.setAll('body.friction', 0.5);
balls.setAll('body.linearDamping', 0.5);
*/
sprite2 = game.add.sprite(340, 250, 'gameboy', 2);
@@ -61,7 +61,7 @@ function create() {
sprite.body.collideWorldBounds = true;
sprite.body.minBounceVelocity = 0.9;
sprite.body.bounce.setTo(0.5, 0.9);
sprite.body.friction = 0.5;
sprite.body.linearDamping = 0.5;
game.input.onDown.add(launch, this);