Hello haxe community, hope to get a bit of help regarding an issue I can’t figure out myself.
My name is Adrian and I develop html5 games using the Stencyl game engine wich basic coding language is Haxe. Although Stencyl is quite easy to use by using drag and drop blocks in order to build the logic for the games yet at some point you need Haxe coding skills in order to implement specific tasks that hasn’t yet been implemented as drag&drop blocks or extensions.
Currently I’m stuck when it comes to hardcode a Haxe function that communicates with an external SDK the https://gamedistribution.com/sdk/html5 to be more precise
Basicaly the SDK it’s initialized once inside the index.html of the exported game by setting it’s server path using javascript.
Once the user starts to play the game at same point “after a life is lost for example” when he clicks the “Play again” button an advertisement is triggered - this part is solved and working correctly
So here comes the part where I need help coding a listener function that will receive events from the SDK as when an advertisement is shown to the user - to pause the game and mute sounds and once the ad is closed to resume the game.
Searching online I found this piece of code that does exactly what I need except it uses LUA coding language so I’m asking if someone here would be willing to help by rewriting it in HAXE:
gdsdk.set_listener(function(self, event, message)
print(event, message)
if event == gdsdk.SDK_GAME_PAUSE then
-- pause your game -
elseif event == gdsdk.SDK_GAME_START then
-- resume your game
elseif event == gdsdk.SDK_REWARDED_WATCH_COMPLETE then
-- give reward to player (optional)
end
end)
The functions for Pausing and Resuming the game are prebuilt in Stencyl and can integrate them myself.
Kind regards to all and many thanks in advance to everyone taking time to read this post and give some help.