Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fossrit/sugar-badges
Sugar Badges Library
https://github.com/fossrit/sugar-badges
Last synced: 1 day ago
JSON representation
Sugar Badges Library
- Host: GitHub
- URL: https://github.com/fossrit/sugar-badges
- Owner: FOSSRIT
- Created: 2013-10-21T17:59:55.000Z (about 11 years ago)
- Default Branch: develop
- Last Pushed: 2014-04-30T21:30:46.000Z (over 10 years ago)
- Last Synced: 2024-11-06T23:12:56.053Z (8 days ago)
- Language: Python
- Size: 147 KB
- Stars: 5
- Watchers: 12
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
sugar-badges
============Sugar Badges Library
This library is used to add a badge feature to your Sugar activity or game. Badges can be used to reward users who have met certain requirements decided by you!
Badges can be displayed by installing and running the Sash activity found here https://github.com/FOSSRIT/Sash
sugar-badges is pip installable (using the command "`pip install sugar-badges`"). We recommend doing your development with sugar-badges in a virtual environment just to be safe.
To use the badge library in your existing project you will need to add this line to the top of your Python file:
```python
from sugar_badges import badges
```To enable badges in your game, add this line to your init:
```python
self.badges = badges(activity_name, activity_bundle_id)
```And finally, to award badges you should make a call to the award method in badges.py using this format:
```python
self.badges.award(badge_name, badge_description)
```Badge images should be stored in a badges folder. The filenames should match the badge names you use when calling "award".
To see an example of an activity that has badges already added to it, check out the code for the SkyTime game https://github.com/FOSSRIT/SkyTime