Chigg / CS329eCook

Toprac
0 stars 0 forks source link

Kill count / highscore #5

Closed alanmms closed 7 years ago

Chigg commented 7 years ago

The killcount will use similar code to the HP text. Whenever you write the code to cause the enemies to die when they touch the bullet object, you can somehow iterate kills. This'll killl two birds with one stone.

HPText = game.add.text(16, 16, 'Health: ' + playerHP, {fontSize: '32px', fill: '#000'}); Killcount = game.add.text(-16, -16, 'Kills: ' + kills, {fontSize: '32px', fill: '#000'});

.... in the update function ...

HPText.fixedToCamera = true; HPText.cameraOffset.setTo(0,0);

Killcount.fixedToCamera = true; Killcount.cameraOffset.setTo(0,30);

Chigg commented 7 years ago

@alanmms