https://github.com/d954mas/defold-crazygames-sdk
Sdk for crazygames.com
https://github.com/d954mas/defold-crazygames-sdk
Last synced: 4 months ago
JSON representation
Sdk for crazygames.com
- Host: GitHub
- URL: https://github.com/d954mas/defold-crazygames-sdk
- Owner: d954mas
- Created: 2022-04-20T11:41:41.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-06T16:23:11.000Z (about 1 year ago)
- Last Synced: 2025-02-06T05:38:02.833Z (4 months ago)
- Language: C++
- Size: 26.4 KB
- Stars: 6
- Watchers: 1
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-defold - Crazy Games
README
## Sdk for crazygames.com
https://developer.crazygames.com/sdk#HTML5NOT SUPPORTED. Use on your own risk.
I made this sdk for api v1. Now crazy use api v2.
Pull request with v2 support was merged.
In theory this should worked.I don't test v2 api. The documentation and example may be not correct.
Look at code.
I make this sdk for my game, so not all functions are ready.
This extension use jstodef to send messages from JavaScript to Lua
**Implemented:**
- ad midgame
- ad rewarded
- gameplay(start,stop)
- happytime**Not implemented:**
- banners
- Adblock Detection
- Invite link
- User information## Installation
__1)__ Add defold-crazygames-sdk in your own project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:
https://github.com/d954mas/defold-crazygames-sdk/archive/refs/tags/v0.2.0.zip__2)__ Add [jstodef](https://github.com/AGulev/jstodef) in your own project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:[https://github.com/AGulev/jstodef/archive/master.zip](https://github.com/AGulev/jstodef/archive/master.zip)
Or point to the ZIP file of a [specific release](https://github.com/AGulev/jstodef/releases).## Example
```lua
--1.Register jstodef listener
jstodef.add_listener(function(_, message_id, message)
if (message_id == "CrazyGame_adStared") then
--logic
elseif (message_id == "CrazyGame_adFinished") then
--logic
elseif (message_id == "CrazyGame_adError") then
--logic
end
end)--2.Ask for ad
crazy_games.request_ad("midgame")
crazy_games.request_ad("rewarded")--3.Gameplay
crazy_games.gameplay_start()
crazy_games.gameplay_stop()--4.Happy time
crazy_games.happy_time()
```