Discuss Scratch

BlueJusticeXD-School
Scratcher
7 posts

How do you make a scoreboard?

Okay so I am making a game and I wanted it to be a competition game so I was wondering how you make a scoreboard
when green flag clicked
say [Help me with scoreboard please]
imfh
Scratcher
1000+ posts

How do you make a scoreboard?

Do you mean a leaderboard which everyone who plays the project can see themself on? If so you'll probably want to start by looking at global high scores on the wiki using cloud variables. You could also use someone else's base project such as my demo here.
MaximunPokeMaster
Scratcher
500+ posts

How do you make a scoreboard?

you can use a variable to make a scoreboard:
when green flag clicked
forever
if <depends on the type of the game ::sensing> then
change [player 1's (or 2's) score v] by (1)
end
end
(you will have to do this code with both sprites, or one if it's something like a pong game.)

Last edited by MaximunPokeMaster (April 30, 2019 18:25:52)

XxShazammxX
Scratcher
100+ posts

How do you make a scoreboard?

To make a scoreboard:

Create a new variable:
(score)

Add this to your project:

when green flag clicked
set [score] to [0]

Then everytime the player scores, use:
change [score] by (1)


If you want to make your own art for a variable, you'll need to make a seperate sprite with costumes with numbers, and the name of the costume must be the number in the costume. I can get you some code for that, if you like.

098765432154321
Scratcher
500+ posts

How do you make a scoreboard?

A scoreboard script should be this. (maybe?)

when green flag clicked
delete (all v) of [Scores v]
broadcast [Start Game v]
add (join [Player 1: ] (P1_Score)) to [Scores v]
add (join [Player 2: ] (P2_Score)) to [Scores v]
forever
replace item (1 v) of [Scores v] with (join [Player 1: ] [(P1_Score)])
replace item (2 v) of [Scores v] with (join [Player 2: ] [(P2_Score)])
end

The “delete all” block deletes the scores, then the broadcoast block starts the game.
Now, the 2 add blocks sets the scores both to the 2 players, then the forever block replaces these scores with their current score.

I hope this works and it helped you

Replace the (P1_Score) and (P2_Score) with variables of those names.

Last edited by 098765432154321 (May 1, 2019 11:23:03)

Powered by DjangoBB