This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-11-21 17:36:41

Ashley888
New Scratcher
Registered: 2012-03-27
Posts: 1

Leaderboard

Hey everyone how do you create leaderboards that save previous scores thanks
Regards
Ash

Offline

 

#2 2012-11-22 04:20:48

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Leaderboard

I don't think this is possible yet, but it should be with Scratch 2.0


Be nice, I'm an old lady  wink

Offline

 

#3 2012-11-22 13:46:36

lavapenguin
Scratcher
Registered: 2012-04-03
Posts: 4

Re: Leaderboard

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

 

#4 2012-11-23 15:22:55

lavapenguin
Scratcher
Registered: 2012-04-03
Posts: 4

Re: Leaderboard

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

 

#5 2012-11-23 15:31:10

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Leaderboard

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)


http://i46.tinypic.com/35ismmc.png

Offline

 

#6 2012-11-23 15:31:56

lavapenguin
Scratcher
Registered: 2012-04-03
Posts: 4

Re: Leaderboard

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

 

#7 2012-11-23 17:03:53

tree-hugger
Scratcher
Registered: 2011-11-19
Posts: 38

Re: Leaderboard

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]
end
Way #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
end
Hope those are useful  smile

Last edited by tree-hugger (2012-11-23 17:05:08)


http://oi48.tinypic.com/1y7tjr.jpghttp://oi50.tinypic.com/28tb34j.jpg                     http://oi50.tinypic.com/21c6v74.jpg                    ...ya, I'm weird... REAL weird...
BITBOT ALL THE WAY!!!     Only the WEIRDEST games!     (that's just  a Tree-Hugger thing)

Offline

 

#8 2012-11-25 11:32:17

mathfreak231
Scratcher
Registered: 2012-10-24
Posts: 80

Re: Leaderboard

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] 
end
Way #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
end
Hope those are useful  smile

Fixed #1, part 2,


~This sig is false~
I'm on teh wiki!

Offline

 

Board footer