Skip to content
Snippets Groups Projects
Commit 1e31e5a0 authored by Niko Kaski's avatar Niko Kaski
Browse files

step 9

parent 8f9f1845
No related branches found
No related tags found
1 merge request!2Master
......@@ -36,6 +36,8 @@
var stars;
var platforms;
var cursors;
var score = 0;
var scoreText;
var game = new Phaser.Game(config);
......@@ -99,6 +101,8 @@
});
scoreText = this.add.text(16, 16, 'score: 0', { fontSize: '32px', fill: '#000' });
this.physics.add.collider(player, platforms);
this.physics.add.collider(stars, platforms);
......@@ -135,6 +139,9 @@
function collectStar (player, star)
{
star.disableBody(true, true);
score += 10;
scoreText.setText('Score: ' + score);
}
</script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment