• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

High Score Ranking like Flappy Bird

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

How can you implement a function that shares the highscore with a google account (e.g flappy bird ranking button)?
I appreciate every hint. Thanks.

Greets
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't used it (I don't write games) but this is the service that Google provides: https://developer.android.com/google/play-services/games.html

It has leaderboards, saved games, etc... So it is a great resource.
 
Jada Gliev
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Luke wrote:I haven't used it (I don't write games) but this is the service that Google provides: https://developer.android.com/google/play-services/games.html

It has leaderboards, saved games, etc... So it is a great resource.



Thank you.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To implement a function that shares the high score with a Google account in a game like Flappy Bird, you can follow these general steps:

1. Integrate Google Sign-In: Implement the Google Sign-In functionality in your game. This allows users to authenticate themselves using their Google accounts. You can use the Google Sign-In API to handle the authentication process.

2.Track and Store High Scores: Create a mechanism to track and store the high scores achieved by players. You can use a database or any persistent storage solution to store the scores. Associate each score with the player's unique identifier.

3.Implement High Score Sharing: Add a button or an option in the game's user interface to allow users to share their high scores. When the user clicks on this button, you can invoke the necessary API calls to initiate the sharing process.

4.Obtain User's Consent: Before sharing the high score, you should request the user's consent to access their Google account information. This can be done using the Google Sign-In API, which provides methods to prompt the user for permission.

5.Retrieve Access Token: Once the user grants permission, you can obtain an access token from the Google Sign-In API. This access token is required to make authenticated requests on behalf of the user.

6.Share High Score: With the access token, you can now send the high score data to a server-side component of your game. This component should be responsible for communicating with the Google Play Games Services or any other relevant Google APIs.

7.Use Google APIs: Utilize the appropriate Google APIs to share the high score. For example, you can use the Google Play Games Services API to submit the score to the player's leaderboard. The API documentation provides detailed information on how to make requests for specific functionalities.

8.Handle Errors: Handle any potential errors that may occur during the sharing process, such as network failures or API errors. Provide appropriate feedback to the user if there are any issues encountered.

9.Display Shared High Scores: Finally, you can also implement a feature to display shared high scores in the game. Retrieve the shared scores from the server-side component and present them to the player in a leaderboard or similar format.

By following these steps and integrating the necessary Google APIs, you can implement a function that shares the high score with a user's Google account in your game.
If you want to see the actual implementation of this logic you can check this on official website of Flappy bird unblocked at https://flappybirdunblocked.online/




reply
    Bookmark Topic Watch Topic
  • New Topic