mirror of
https://github.com/wassname/phaser.git
synced 2026-08-14 12:40:17 +08:00
Integrated SAT. Fixed lots of examples. Fixed documentation. Added new examples and built new phaser.js file for testing.
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user