I don't think this is possible yet, but it should be with Scratch 2.0
Offline
You could use a list. Here is an example of a list being used. Whenever the cat touches Srite 2 it adds 1 to the score and then puts that onto the list of previous scores:
When green flag clicked
set score to 0
forever
if touching sprite 2
change score by1
add score to previous scores
wait 1 sec
edit this a bit for the kind of leaderboard you want (e.g. it adds the score to the list and then displays the list when you die)
Offline
Sorry here's scratch blocks
(scratchblocks)
when gf clicked
set (score) to 0
forever
if <touching (Sprite2 v)>
change (score) by (1)
add (score) to (previous scores) //edit this for the kind of leaderboard you want
wait (1) secs
end
end
(/scratchblocks)
Offline
lavapenguin wrote:
Sorry here's scratch blocks
when gf clicked set [score v] to (0) forever if (touching [Sprite2 v]?) change [score v] by (1) add (score) to [previous scores v]//edit this for the kind of leaderboard you want wait (1) secs end
Fixed. If you'd like to learn more about scratchblocks, you can read my article here.
Anyway, hello lavapenguin and welcome to Scratch!
Last edited by ErnieParke (2012-11-23 15:35:13)
Offline
Got confused so here's scratchblocks (i tested them this time)
when gf clicked set [score] to 0 forever if <touching [Sprite2 v]> change [score) by [1] add [score] to [previous scores] //edit this for the kind of wait [1] secs //leaderboard you want end end
Offline
I don't know a way to save previous scores... but I have other ways to make leader boards.
Way #1: The player goes against themselves and shows all their scores from their playing session.
when gf clicked delete [all v] of [leader board v]
when I receive [game over v] add (score) to [leader board v] if <(score) > (item (1 v) of [score board v])> insert (score) at (1 v) of [score board v] endWay #2: Put player up against fake people.
when gf clicked delete [all v] of [leader board v] add [Jimmy's score: 125] to [score board v] add [Bob's score: 372] to [score board v] add [Junior's score: 433] to [score board v]
when I receive [game over v] if <(score) > (Jimmy's score)> say [you beat Jimmy!] for (2) secs end if <(score) > (Bob's score)> say [you beat Bob!] for (2) secs end if <(score) > (Junior's score)> say [you beat Junior!] for (2) secs endHope those are useful
Last edited by tree-hugger (2012-11-23 17:05:08)
Offline
tree-hugger wrote:
I don't know a way to save previous scores... but I have other ways to make leader boards.
Way #1: The player goes against themselves and shows all their scores from their playing session.when gf clicked delete [all v] of [leader board v]when I receive [game over v] set [score to check v] to [1] set [last place? v] to [1] repeat (length of [score board v]) if <<(score) > (item (score to check) of [score board v])> and <(last place?) = [1]>> insert (score) at (score to check) of [score board v] set [last place? v] to [0] end change [score to check v] by (1) end if <(last place?) = [1]> //The way you had it, the score would always be added to last place, whether it's supposed to or not add (score) to [leader board v] endWay #2: Put player up against fake people.when gf clicked delete [all v] of [leader board v] add [Jimmy's score: 125] to [score board v] add [Bob's score: 372] to [score board v] add [Junior's score: 433] to [score board v]when I receive [game over v] if <(score) > (Jimmy's score)> say [you beat Jimmy!] for (2) secs end if <(score) > (Bob's score)> say [you beat Bob!] for (2) secs end if <(score) > (Junior's score)> say [you beat Junior!] for (2) secs endHope those are useful
Fixed #1, part 2,
Offline