Adjusted delta timer cap and fixed some typos and more examples.

This commit is contained in:
photonstorm
2014-01-27 17:08:20 +00:00
parent 4432d37e6e
commit dbdb2a2026
10 changed files with 106 additions and 76 deletions
+18 -26
View File
@@ -34,7 +34,7 @@ function create() {
balls = game.add.group();
for (var i = 0; i < 50; i++)
for (var i = 0; i < 30; i++)
{
var s = balls.create(game.rnd.integerInRange(100, 700), game.rnd.integerInRange(100, 200), 'balls', game.rnd.integerInRange(0, 6));
s.body.velocity.x = game.rnd.integerInRange(-400, 400);
@@ -48,6 +48,11 @@ function create() {
balls.setAll('body.minBounceVelocity', 0.9);
balls.setAll('body.friction', 0.5);
sprite2 = game.add.sprite(300, 250, 'gameboy', 2);
sprite2.name = 'green';
sprite2.body.collideWorldBounds = true;
// sprite2.body.bounce.setTo(0.5, 0.5);
sprite = game.add.sprite(300, 100, 'gameboy', 0);
sprite.name = 'red';
sprite.body.collideWorldBounds = true;
@@ -55,10 +60,6 @@ function create() {
sprite.body.bounce.setTo(0.5, 0.9);
sprite.body.friction = 0.5;
sprite2 = game.add.sprite(300, 250, 'gameboy', 2);
sprite2.name = 'yellow';
sprite2.body.collideWorldBounds = true;
// sprite2.body.bounce.setTo(0.5, 0.5);
game.input.onDown.add(launch, this);
@@ -66,8 +67,10 @@ function create() {
function launch() {
sprite.body.velocity.x = -200;
sprite.body.velocity.y = -200;
game.time._x = true;
// sprite.body.velocity.x = -200;
// sprite.body.velocity.y = -200;
}
@@ -85,28 +88,17 @@ function update() {
game.physics.collide(sprite, layer);
game.physics.collide(sprite2, layer);
game.physics.collide(sprite, sprite2);
if (!flag)
{
for (var i = 0; i < balls._container.children.length; i++)
{
if (balls._container.children[i].y < 5 && balls._container.children[i].body.velocity.y === 0)
{
balls._container.children[i].alpha = 0.5;
console.log(balls._container.children[i]);
flag = true;
}
}
}
}
function render() {
if (sprite)
{
game.debug.renderBodyInfo(sprite, 20, 30);
}
game.debug.renderText(game.time.fps + ' (min: ' + game.time.fpsMin + ' max: ' + game.time.fpsMax + ') ' + game.time.physicsElapsed, 32, 32);
// if (sprite)
// {
// // game.debug.renderBodyInfo(sprite, 20, 30);
// game.debug.renderBodyInfo(sprite2, 20, 230);
// }
}