Local Leader Boards
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Local Leader Boards
Is there good code to make a local leader board where you don't need a server?
Oh and side question how do you make items in a graphic field randomize their location in the field? I have been tinkering around with some of my own code but it doesn't spread out enough; it just makes a pretty flat back slash.
Thanks,
Danny
Oh and side question how do you make items in a graphic field randomize their location in the field? I have been tinkering around with some of my own code but it doesn't spread out enough; it just makes a pretty flat back slash.
Thanks,
Danny
Re: Local Leader Boards
Hi, Danny. A new version of 'Snowballer' just went live this morning in the app store (an LC iOS game) - the main additions were local and online leader boards. I just read and write the leader board info to a text file and display it in a field.
The game's data file can contain multiple entries - one per line - and one of the entries is the high score information. To make sure that a large multi line text entry becomes one line in the data file, I use the following code;
... and base64Decode it when you read it back from the text file.
JC
The game's data file can contain multiple entries - one per line - and one of the entries is the high score information. To make sure that a large multi line text entry becomes one line in the data file, I use the following code;
Code: Select all
put base64Encode(tHiScores) into tSaveHiScores
replace LF with empty in tSaveHiScores
JC
LiveCode Development & Training : http://splash21.com
Re: Local Leader Boards
Hey Splash sorry for the later reply. I've been trying out the leaderboard code, it's been a big help, thanks!
I have been trying to make a graphic appear, like a "game over," when these balls are finished up falling into the bucket. (Please reference some of my past post for a better explanation of my game idea).
I was playing around with some code
"fBallsDropped" is a field that changes depending on how many balls are dropping and right now the max is 10, also i'm just using the answer function to show that something is happening. My problem is that if I make it greater than (>) then it says "hi" every time no matter how high I make the number in the code. If I make it less than (<) then it won't say "Hi" no no matter how I change the code.
If you or any one else reading this could help it would be great.
Thanks,
Danny
I have been trying to make a graphic appear, like a "game over," when these balls are finished up falling into the bucket. (Please reference some of my past post for a better explanation of my game idea).
I was playing around with some code
Code: Select all
on timerPlay
if "fBallsDropped" > 9 then
answer "hi"
end if
end timerPlay
If you or any one else reading this could help it would be great.
Thanks,
Danny
Re: Local Leader Boards
Hi, Danny. You just need to drop the word 'field' in to specify the object's value you're comparing - at the moment you're comparing the string "fBallsDropped" with the number 9;
HTH 
Code: Select all
on timerPlay
if field "fBallsDropped" > 9 then
answer "hi"
end if
end timerPlay

LiveCode Development & Training : http://splash21.com
Re: Local Leader Boards
Once again THANK YOU. I was thinking like algebra, so if one field in greater than or less than, then an event would happen.
I saw in your game "snowballer" (Congrats on getting an app to the App Store!) that you have constraint on how far back you can pull the snowball in the box. Would you be able to tell me how to do that with a field? Like keeping a bucket in a graphic field. I was testing the code that you had posted somewhere in the forums but I couldn't quite figure it out.
Any ideas?
Thanks,
Danny
I saw in your game "snowballer" (Congrats on getting an app to the App Store!) that you have constraint on how far back you can pull the snowball in the box. Would you be able to tell me how to do that with a field? Like keeping a bucket in a graphic field. I was testing the code that you had posted somewhere in the forums but I couldn't quite figure it out.
Any ideas?
Thanks,
Danny
Re: Local Leader Boards
Hi, Danny. From the 'Snowman Example' stack on rev online : check out the touchMove handler that gets called when a finger moves on the screen.
It receives the id of the touch event and x and y co-ordinates (pX and pY)
All I'm doing is checking pX and pY against the edges of the 'pull area' graphic (the dark rectangle - which is hidden in the final app) and resetting them if they fall outside.
This ensures that the point pX,pY lies inside the allowed area.
It receives the id of the touch event and x and y co-ordinates (pX and pY)
All I'm doing is checking pX and pY against the edges of the 'pull area' graphic (the dark rectangle - which is hidden in the final app) and resetting them if they fall outside.
This ensures that the point pX,pY lies inside the allowed area.
Code: Select all
# constrain pulling to the dark 'pullArea' rectangle on screen
if pX < the left of grc "pullArea" then put the left of grc "pullArea" into pX
if pX > the right of grc "pullArea" then put the right of grc "pullArea" into pX
if pY < the top of grc "pullArea" then put the top of grc "pullArea" into pY
if pY > the bottom of grc "pullArea" then put the bottom of grc "pullArea" into pY
LiveCode Development & Training : http://splash21.com
Re: Local Leader Boards
Hey Splash, I Got it to work.
This might be an easy question. When the round is over the bucket moves off the screen and then I hit the "retry" button quickly to bring it back; the bucket quickly flashes on the screen and then goes away and the balls proceed to fall without a bucket on the screen. If I wait a second or two it usually appears but I can't assume that a player is going to wait that long to hit the retry button. I'm almost 99.9% positive that I wrote the right code but it just doesn't seem to work.
just to get it out of the way.
to bring it back to the front of the screen. I have that code on the "retry" button and the "start" button as back ups
Do you know why that would be happening?
Thanks,
Danny

Code: Select all
set the layer of img "bucket" to bottom
Code: Select all
on moveBucket
set the layer of img "Bucket" to top
end moveBucket
Do you know why that would be happening?
Thanks,
Danny
Re: Local Leader Boards
Something else must be moving or hiding your bucket image.
Maybe your normal code just continues, and sets the location or layer of the bucket, as if the game would still be running?
Or some other code hides the bucket graphic by setting it's visibility?
Maybe your normal code just continues, and sets the location or layer of the bucket, as if the game would still be running?
Or some other code hides the bucket graphic by setting it's visibility?
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: Local Leader Boards
Sweet! I think I had a couple of buttons moving the bucket around and after I deleted the code it started showing up and staying there.
Thanks,
Danny
Thanks,
Danny
Re: Local Leader Boards
Hi Splash,splash21 wrote:...A new version of 'Snowballer' just went live this morning in the app store (an LC iOS game) - the main additions were local and online leader boards. I just read and write the leader board info to a text file and display it in a field.
The game's data file can contain multiple entries - one per line - and one of the entries is the high score information. To make sure that a large multi line text entry becomes one line in the data file, I use the following code;
... and base64Decode it when you read it back from the text file.Code: Select all
put base64Encode(tHiScores) into tSaveHiScores replace LF with empty in tSaveHiScores
JC
Can you explain in more detail how one sets up an online leader board?
Thanks,
Dan
Re: Local Leader Boards
I would also like to know how to set one up.
Hi Splash,
Can you explain in more detail how one sets up an online leader board?
Thanks,
Dan
Re: Online Leader Boards
After some further investigation yesterday, I discovered that Apple provides a "Game Center" which provides (among other things) a centralized leader board service. There is a "Game Kit API" that developers can use to read/write to the "Game Center". I assume the Game Kit is a set of DLLs that the developer must use. I am not an advanced LiveCode developer, so I don't know how to "interop" with external DLLs.
I was hoping someone had already done this and would be willing to share...
I was hoping someone had already done this and would be willing to share...
Re: Local Leader Boards
I hate to say, "Me, too!" but...dburdan wrote:I would also like to know how to set one up.Can you explain in more detail how one sets up an online leader board?
Me, too!

Re: Online Leader Boards
The GameKit Api is only for people developing with xcode. The LiveCode developers would need to add support for game center in order for us to use it. I have code for an online leaderboard that I use. I will post it when I'm done with my app.cruddydan wrote:After some further investigation yesterday, I discovered that Apple provides a "Game Center" which provides (among other things) a centralized leader board service. There is a "Game Kit API" that developers can use to read/write to the "Game Center". I assume the Game Kit is a set of DLLs that the developer must use. I am not an advanced LiveCode developer, so I don't know how to "interop" with external DLLs.
I was hoping someone had already done this and would be willing to share...
Re: Local Leader Boards
That would be much appreciated... Thanks.
Dan
Dan