mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
Physics.processRebound now takes Body direction into account, helps with body-body collision bounces (thanks ram64)
Fixed the Example / physics / mass velocity test. Fixed readme typo.
This commit is contained in:
@@ -15,15 +15,13 @@ function create() {
|
||||
|
||||
aliens = game.add.group();
|
||||
|
||||
game.physics.gravity.y = 100;
|
||||
|
||||
for (var i = 0; i < 50; i++)
|
||||
{
|
||||
var s = aliens.create(game.world.randomX, game.world.randomY, 'baddie');
|
||||
s.name = 'alien' + s;
|
||||
s.body.collideWorldBounds = true;
|
||||
s.body.bounce.setTo(0.8, 0.8);
|
||||
s.body.linearDamping = 0;
|
||||
s.body.linearDamping = 0.1;
|
||||
s.body.minVelocity.setTo(0, 0);
|
||||
s.body.velocity.setTo(10 + Math.random() * 40, 10 + Math.random() * 40);
|
||||
}
|
||||
@@ -32,10 +30,8 @@ function create() {
|
||||
car.name = 'car';
|
||||
car.anchor.setTo(0.5, 0.5);
|
||||
car.body.collideWorldBounds = true;
|
||||
// car.body.bounce.setTo(0.8, 0.8);
|
||||
car.body.allowRotation = true;
|
||||
// car.body.immovable = true;
|
||||
// car.body.minBounceVelocity = 0;
|
||||
car.body.immovable = true;
|
||||
|
||||
}
|
||||
|
||||
@@ -65,17 +61,4 @@ function update() {
|
||||
|
||||
function render() {
|
||||
|
||||
for (var i = 0; i < aliens._container.children.length; i++)
|
||||
{
|
||||
game.debug.renderPolygon(aliens._container.children[i].body.polygons);
|
||||
}
|
||||
|
||||
game.debug.renderPolygon(car.body.polygons);
|
||||
|
||||
// game.debug.renderBodyInfo(aliens._container.children[0], 32, 32);
|
||||
game.debug.renderBodyInfo(aliens._container.children[0], 32, 32);
|
||||
|
||||
// game.debug.renderBodyInfo(car, 16, 24);
|
||||
// game.debug.renderBodyInfo(aliens.getFirstAlive(), 16, 24);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user