[SOLVED] How do I make a gamescore?


#1

Ok so Im trying to make a ingame score like this


ok so I looked this https://www.w3schools.com/graphics/game_score.asp but I want in to be based off how long you can survive and when you lose I want it to say restart heres the project link:https://playcanvas.com/editor/scene/773725


[SOLVED] Need Help With Score System
#2

If you want to make the scoreboard from Flappy Bird, you probably ought to look at the Flappy Bird project:

https://playcanvas.com/project/375389/overview/flappy-bird

Here is the code for the score.js script that sets the numbers on the score display:

https://playcanvas.com/editor/code/375389?tabs=4554273

Here’s the scoreboard entity in the hierarchy:

Notice how it has three child entities. One for each digit.

To set the score board, from any script, just call:

var score = 100;
this.app.fire('ui:score', score);

…assuming you set the score script name property to ‘score’.


#3

I kinda need help setting it up lol


#4

I just gave detailed instructions and a working example. What’s missing from my answer?


#5

@Axulity_YT I can help with setting it up.


#6

For flappy bird, when you pass a position, the score increases. Meaning in Galaxy ball, we should increase the score after a certain position.


#7

Your explanation was very detailed and now I think I can create the Score System. Thank you!