Integrated SAT. Fixed lots of examples. Fixed documentation. Added new examples and built new phaser.js file for testing.

This commit is contained in:
photonstorm
2014-01-27 06:29:26 +00:00
parent 45518b3ecd
commit 4505aa50f6
35 changed files with 4065 additions and 2261 deletions
+2 -2
View File
@@ -31,8 +31,8 @@ function create() {
flyer.body.bounce.setTo(0.8, 0.8);
// This sets the gravity the sprite responds to in the world, as a point
// Leave x=0 and set y=8 to simulate falling
flyer.body.gravity.setTo(0, 8);
// Leave x=0 and set y=80 to simulate falling
flyer.body.gravity.setTo(0, 80);
}
+11 -9
View File
@@ -20,7 +20,9 @@ function create() {
// displays it on-screen
// and assign it to a variable
ball = game.add.sprite(400, 200, 'ball');
knocker = game.add.sprite(400, 200, 'dude');
knocker.body.immovable = true;
// This gets it moving
ball.body.velocity.setTo(200, 200);
@@ -33,37 +35,37 @@ function create() {
ball.body.bounce.setTo(1, 1);
// This sets the gravity the sprite responds to in the world, as a point
// Here we leave x=0 and set y=8 to simulate falling
ball.body.gravity.setTo(0, 8);
// Here we leave x=0 and set y=80 to simulate falling
ball.body.gravity.setTo(0, 80);
}
// Move the knocker with the arrow keys
function update () {
// Enable physics between the knocker and the ball
game.physics.collide(knocker, ball);
if (cursors.up.isDown)
{
knocker.body.velocity.y = -400;
knocker.body.velocity.y = -300;
}
else if (cursors.down.isDown)
{
knocker.body.velocity.y = 400;
knocker.body.velocity.y = 300;
}
else if (cursors.left.isDown)
{
knocker.body.velocity.x = -400;
knocker.body.velocity.x = -300;
}
else if (cursors.right.isDown)
{
knocker.body.velocity.x = 400;
knocker.body.velocity.x = 300;
}
else
{
knocker.body.velocity.setTo(0, 0);
}
// Enable physics between the knocker and the ball
game.physics.collide(knocker, ball);
}
+2 -2
View File
@@ -31,8 +31,8 @@ function create() {
image.body.bounce.setTo(0.8, 0.8);
// This sets the gravity the sprite responds to in the world, as a point
// Leave x=0 and set y=8 to simulate falling
image.body.gravity.setTo(0, 8);
// Leave x=0 and set y=180 to simulate falling
image.body.gravity.setTo(0, 180);
}
+1 -1
View File
@@ -19,7 +19,7 @@ var launchVelocity = 0;
function create() {
// set global gravity
game.physics.gravity.y = 100;
game.physics.gravity.y = 200;
game.stage.backgroundColor = '#0072bc';
var graphics = game.add.graphics(0,0);