Drag And Drop Overview


Drag and Drop (DnD™) is a visual scripting tool that can be used to create your games without actually typing any code. That's not to say that you aren't programming code when you use DnD™, as you are, only that your code is created and presented in a visual way using "blocks" of actions rather than text. Actions are simple expressions or statements that can be "chained" together to have an instance of an object do something when placed in a room, for example, you could have an action in a Create Event to move an instance in a random direction, and another action in a Collision Event to make it bounce off the things it collides with (for more information on the different events available and how they work together see the section on Object Events). DnD™ Overview Screen The image above shows a typical object open on a workspace to be edited. It has an "Event" window and a "Code" window chained to it, and in the code window you can see where we have constructed our DnD™. Let's look a bit closer at this window and see what options are available to us: DnD™ Properties Screen Below you can find more information on each of the sections shown:

When you add an Event to your object, a new tab is opened in the code window to display the contents of that event. You can add multiple events and have multiple tabs open at the same time, switching between them and editing them as you wish. You can also close the tabs at any time to reduce clutter (selecting the event in the object again will re-open them), and you can click and drag the tab out of the window into its own code window, in which case closing the object or the code window will not close the new window. Tabs can be dragged left or right to be re-ordered too. `


As you add action blocks to your event, they will appear in "shorthand" form as a plain English overview of what's going on. The overview order is the order in which each of the action blocks will be run for that event, and you can click on any item in the list to have the action block view zoom to that position for editing.


This workspace area is where you drag Actions from the Toolbox to create your DnD™ code. Click on an action and drag it into this area to add it to the list of actions and edit it. Most actions have various parameters (arguments) that you can set, and most will also take keywords, instance variables, or even GML functions - for example, you can call the Set Direction action and use the GML function random(val) to set a random direction.

As you add action blocks to your code, they will be visually "chained" together to indicate the order in which different actions will occur, although how this chain is created will depend on the initial block that has been used. For example, an if block will have two chains - one to the blocks that are to be called if the condition being checked is true and then the next block after that. For more information on constructing action blocks into code, see the section below.

While in the Action Block workspace, you can use the middle mouse button to pan around and the mouse wheel to scroll the action list up or down. If you hold while moving the mouse wheel, then the view will scroll left/right, and if you hold down / and move the mouse wheel then the view will zoom in and out, permitting you to see more of the workspace with the actions. You can click on any action from the action list on the left to focus on that action, resetting the zoom and position. Also note that you can resize the action blocks by moving the mouse towards the edges of the block and then - when the cursor changes - dragging in the direction you require.

You can also right click anywhere in the DnD™ workspace to bring up the RMB Menu: DnD™ Workspace RMB Menu

This menu has the following options:

  • Cut / Copy / Paste: This will permit you cut, copy or paste any action that is selected in the workspace. Note that you can use + outside of the actions and drag, or use / + on individual actions, to select more than one and apply the command to all of them.

  • Disable: This command will disable the action (or actions) selected. When an action is disabled, it is still visible in the workspace but it will not run when you compile the game. In this way you can add/remove actions for testing and debugging. The image below shows some DnD™ code with actions disabled: DnD™ Disable Actions You can see that the actions "If Score" and "Go To Next Room" have been disabled and so they will be skipped when the game is tested or compiled.

  • Toggle Breakpoint: This command will toggle a breakpoint on or off for the selected action. A breakpoint is simply a point in the DnD™ code where the debugger should stop when the game is being run in Debug Mode. An action with a breakpoint assigned to it will be highlighted, as shown in the image below (the "If Health" action has been set as a breakpoint): DnD™ Breakpoint
  • Delete All Breakpoints: With this command you can remove all breakpoints form the DnD™ code.

  • Collapse All: DnD™ actions can be either collapsed or expanded, where a collapsed action will simply show the name of the action but not any of the internal values thus maximising the available space for the workspace. For example: DnD™ Collapsed Actions As you can see, the actions take up much less space, and you can still see what they do from the short description given to the right.

  • Reset Layout: This will reset the DnD™ workspace, setting the zoom level to 100%, focusing on the currently selected action, and expanding any (and all) collapsed actions too.

  • Live Preview: When you select this option, you will enable or disable the DnD™ to GML (GameMaker Language) code preview window. This is explained in more detail on the page Changing DnD™ To Code.

  • Convert To GML: This will convert all your actions in the current event to GML (GameMaker Language) code. Be very careful with this as you cannot convert GML back into the DnD™ actions that it was created from. You can convert the event back to a DnD™ event from code, but any code will simply be wrapped in an Execute Code action.
  • Single Pane / 2 Columns / 3 Columns: These options can be used to split the current worskspace into 1, 2 or 3 different "panes". Each pane is a seperate workspace that can have scripts or events dragged onto them so you can edit and compare 2 or more DnD™ code blocks at a time. The image below shows two scripts in one window shown in their own workspace pane: DnD™ Split Workspace Panes

The toolbox is where all the DnD™ actions are stored, with different sections holding collections (libraries) of actions that are similar or related. Each collection of actions is related to a specific theme or common purpose and you simply click and drag the required action from the toolbox into the Action Block view to add it to the current event. To make things simpler - as there are a lot of actions - you can use the "Search" bar at the top to search for a specific action or to filter the visible actions (type "draw" for example to get all the drawing actions), and you can also click and drag icons from any library into your Favourites folder to keep commonly used actions together. This is particularly useful if there are certain things you'll be doing again and again. The favourites folder can be cleared by clicking the small "bin" icon.

For a complete list of the actions available, as well as what arguments they take and how they can be chained, please see the Drag And Drop Reference section.


The following pages go into a bit more depth about how to construct action block code, as well as how to set the scope of the actions to affect different things within your project and other important details:

  1. Constructing Action Block Code
  2. Applying Actions To Other Instances
  3. Action Block Scripts
  4. Changing DnD™ To Code