Newgrounds IO (medals only)

rob1221

  • *
  • Posts: 9473
With the declining use of Flash, Newgrounds has created a multiplatform API for their site called newgrounds.io.  This is mostly relevant for HTML5 games.  This extension is based on the Haxe library of Newgrounds IO found here: https://github.com/Geokureli/Newgrounds

Download Extension
(must be signed in to the forums to download)

Init with App ID: _____ Encryption Key: _____  [Debug/Release]
Use this block at the start of your game to start the API.  For the encryption settings on the Newgrounds site, choose RC4 and Base64.  Then enter the matching key in this block along with your app ID.  Use the "Debug" dropdown option when testing and the "Release" dropdown option when publishing.

Log in to Newgrounds
This block is not needed for games published on Newgrounds, but if you want to test locally you need to use this block to connect to Newgrounds.  Allow the popup if it is blocked by the browser.

Set Unlock Callback  [Medal]
This optional block is used to respond to a medal unlock.  The medal info can be used to create a popup since by default nothing is displayed when a medal is unlocked.  You can use the embedded "Medal" block with the next block to get any of the medal properties.

_____ of Medal _____
This block can be used with the previous one to get one of the medal properties.  In my testing, the point value always showed 0 and the image URL wasn't usable due to a CORS violation (blocked by Newgrounds), but I left those properties in there anyway.

Unlock Medal with ID _____
This unlocks a medal using the ID assigned to the medal by Newgrounds (not the name).  If the medal is unlocked, the medal callback will be triggered if there is one.  If "Debug" was selected when starting the API, the medal will be locked so that it can be unlocked again.

Side note: Newgrounds changes the name of the file with each upload, which causes HTML5 saves to be lost.  To fix that, refer to this topic: http://community.stencyl.com/index.php/topic,59317.0.html

« Last Edit: October 26, 2019, 10:20:51 am by rob1221 »