Updated a lot of examples to Phaser 2.0 :)

This commit is contained in:
alvinsight
2014-02-28 18:22:52 +00:00
parent 8662cd2fd4
commit f17cdd9c32
24 changed files with 77 additions and 68 deletions
+2 -1
View File
@@ -23,6 +23,7 @@ function create() {
// The first parameter is how long to wait before the event fires. In this case 1 second (you could pass in 1000 as the value as well.)
// The next two parameters are the function to call ('updateCounter') and the context under which that will happen.
game.time.events.loop(Phaser.Timer.SECOND, updateCounter, this);
}
@@ -31,7 +32,7 @@ function updateCounter() {
counter++;
text.content = 'Counter: ' + counter;
text.setText('Counter: ' + counter);
}
+1 -3
View File
@@ -33,9 +33,7 @@ function createBall() {
var ball = game.add.sprite(game.world.randomX, 0, 'ball');
ball.body.gravity.y = 200;
ball.body.bounce.y = 0.5;
ball.body.collideWorldBounds = true;
ball.physicsEnabled = true;
}
+2 -2
View File
@@ -29,7 +29,7 @@ function updateCounter(idx) {
counters[idx]++;
text[idx].content = 'Counter ' + idx + ' = ' + counters[idx];
text[idx].setText('Counter ' + idx + ' = ' + counters[idx]);
}
@@ -42,7 +42,7 @@ function removeCounter() {
// Just updates the text
text[i].style.fill = '#3344aa';
text[i].content = 'Counter ' + i + ' removed';
text[i].setText('Counter ' + i + ' removed');
i--;
}