A downloadable tool

Buy Now$1.00 USD or more

This extension allows you to Drag & Drop files into your HTML5 game. You can use this to enhance user experience, and maybe create some kind of modding system for your game.

DOCUMENTATION

web_dragdrop_init(bool debugMode?, bool receiveDragOverCallbacks?);

  • Description : Initializes Web Drag&Drop extension.
  • Parameters;
    [debugMode?] : Enables or disables debug mode. Prints out console messages
  • [receiveDragOverCallbacks] : When dragging files, it callbacks too many events that may be costly. You'll probably never going to need this event, so you may set this as false.

Returns : Social Async Events

  • "id" :  This will always be webdragdropid (constant)
    "event_type" : This can be "dragover", "dragenter", "dragleave" or "drop". (string)
  • If "event_type" is "drop", additional parameters are added to the event.
    "file_type" : Type of the file that's been dropped. A simple text file is data:text/plain;base64. (string)
  • "file_source" : Source of the file, which is usually base64. For a text file, you can use base64_decode() function to get it usable in Game Maker. (string)

Purchase

Buy Now$1.00 USD or more

In order to download this tool you must purchase it at or above the minimum price of $1 USD. You will get access to the following files:

fritsbie.gamemaker.html5draganddrop.yymps.zip 366 kB

Comments

Log in with itch.io to leave a comment.

is it possible to add png files and then use it as sprites?

When you add a .png file, you'll get its base64 code as the file_source parameter. You should be able to convert this base64 to a sprite,

Here's what I found on Yoyogames Forums.

var buff=buffer_base64_decode(base64string); //Use async_load[? "file_source"] for this argument
buffer_save(buff,working_directory+"userImage.png");
spr_userimage=sprite_add(working_directory+"userImage.png",0,0,0,0,0);
buffer_delete(buff);