From 03acdb6a7aace1a0442d466d632532945d369f81 Mon Sep 17 00:00:00 2001 From: Gurpreet Singh Matharoo Date: Mon, 13 Jul 2026 13:26:57 +0530 Subject: [PATCH 01/28] docs(feature): Iniital prefab builder text documentation --- .../IDE_Tools/Additional_IDE_Tools.htm | 2 +- Manual/contents/IDE_Tools/Prefab_Library.htm | 7 +- Manual/contents/The_IDE/Plugins/Plugins.htm | 49 +++++++----- .../The_IDE/Plugins/Prefab_Builder.htm | 71 ++++++++++++++++++ Manual/contents/The_IDE/The_IDE.htm | 6 ++ .../Images/Icons/Icon_Tick_Check_Green.png | Bin 0 -> 490 bytes Manual/toc/Default.toc | 3 + 7 files changed, 117 insertions(+), 21 deletions(-) create mode 100644 Manual/contents/The_IDE/Plugins/Prefab_Builder.htm create mode 100644 Manual/contents/assets/Images/Icons/Icon_Tick_Check_Green.png diff --git a/Manual/contents/IDE_Tools/Additional_IDE_Tools.htm b/Manual/contents/IDE_Tools/Additional_IDE_Tools.htm index ec97a5d04..1bdef1189 100644 --- a/Manual/contents/IDE_Tools/Additional_IDE_Tools.htm +++ b/Manual/contents/IDE_Tools/Additional_IDE_Tools.htm @@ -33,7 +33,7 @@

Project & Assets

© Copyright YoYo Games Ltd. 2026 All Rights Reserved
diff --git a/Manual/contents/IDE_Tools/Prefab_Library.htm b/Manual/contents/IDE_Tools/Prefab_Library.htm index 9110c0929..30a228c8f 100644 --- a/Manual/contents/IDE_Tools/Prefab_Library.htm +++ b/Manual/contents/IDE_Tools/Prefab_Library.htm @@ -20,9 +20,12 @@

Prefab Library

When you use an asset from the Prefab Library, that asset is not copied into your project but is simply referenced. The actual asset is only loaded from its Collection (source project) when your game is built. This means your game stays up-to-date with any changes in the Collection package without you needing to re-import any assets.

This allows you to use the same assets in multiple projects and have them all be updated when the Collection is updated.

-

You can customise a Prefab asset to use custom properties while retaining its link to its Collection. You can also choose to duplicate an asset into your project, at which point the asset is unlinked from its Collection, meaning that it will no longer receive updates from its Collection however it will be fully modifiable within your project. See: Modifying Prefabs

+

You can customise a Prefab asset to use custom properties while retaining its link to its Collection. You can also choose to duplicate an asset into your project, at which point the asset is unlinked from its Collection, meaning that it will no longer receive updates from its Collection however it will be fully modifiable within your project. See: Modifying Prefabs

 If any used Prefab Collections could not be located during compilation, GameMaker will attempt to download and install the required packages and start the build process again. However, in case the installation fails for any reason (e.g. no internet connection), you can double-click on the relevant message that appears in the Compiler Output to attempt installation of the required package.

 For possible issues with project loading when Prefab resources cannot be found, see: Project Format

+

Creating Prefab Collections

+

You can create your own Prefab Collections for use among your projects and for sharing with other developers.

+

See: Prefab Builder

Adding Prefab Packages

Currently you can use the official GameMaker Asset Bundles via the Prefab Library.

Open the Prefab Library via the Windows menu in the menu bar. When you open this for the first time, your Prefab Library will be empty.

@@ -59,7 +62,7 @@

Referencing Prefab Assets In Code

  • ::io.gamemaker.uiicons-1.0.3::spr_ui_heart: This specifies the full package ID and version to ensure there are no possible name collisions.
  • Note that your project must have a reference to the version of the Collection you are trying to pull from. If the specified asset is not found in the specified Collection, you will get a compile error.

    -

    Referencing Code Symbols

    +

    Referencing Code Symbols

    Scripts included in Prefab Collections may export Enums, Macros and Script Functions using the following syntax:

    #export symbol1,symbol2,symbol3,...

    Any project that has a reference to such a Collection can use the exported symbols in code, e.g. to make use of an Enum/Macro or call a Script Function.

    diff --git a/Manual/contents/The_IDE/Plugins/Plugins.htm b/Manual/contents/The_IDE/Plugins/Plugins.htm index de223950a..ee5c04a92 100644 --- a/Manual/contents/The_IDE/Plugins/Plugins.htm +++ b/Manual/contents/The_IDE/Plugins/Plugins.htm @@ -1,23 +1,36 @@ - - - - Plugins - - + + + + + IDE Plugins + + + + + + + -

    Manual Page

    -

     

    -

     

    -

     

    - -
    © Copyright YoYo Games Ltd. 2025 All Rights Reserved
    +
    © Copyright YoYo Games Ltd. 2026 All Rights Reserved

    ds_map_clear

    -

    This function will clear the (previously created) DS map of all key/value pairs, but it will not delete the DS map itself from memory. For that you should use the function ds_map_destroy(). Note that clearing a map will de-reference any data structures stored in the map giving a memory leak, so you would need to go through it and destroy all data structure items manually before clearing the map to prevent this. The only time this is not required is when you have flagged any items in the map as a DS list or as another DS map, in which case these items will be destroyed (not cleared!) and their memory cleaned up automatically when the parent map is cleared.

    +

    This function will clear the (previously created) DS map of all key/value pairs, but it will not delete the DS map itself from memory. For that you should use the function ds_map_destroy().

    +

    Note that clearing a map will de-reference any data structures stored in the map giving a memory leak, so you would need to go through it and destroy all data structure items manually before clearing the map to prevent this. The only time this is not required is when you have flagged any items in the map as a DS list or as another DS map, in which case these items will be destroyed (not cleared!) and their memory cleaned up automatically when the parent map is cleared.

     

    Syntax:

    ds_map_clear(id)

    @@ -53,7 +54,7 @@

    Example:

    Next: ds_map_copy
    -
    © Copyright YoYo Games Ltd. 2024 All Rights Reserved
    +
    © Copyright YoYo Games Ltd. 2026 All Rights Reserved

    ds_priority_clear

    -

    With this function you can clear all data from the given priority queue data structure. This does NOT destroy the data structure (for that you should use ds_priority_destroy()), it only wipes all data from it and returns an empty priority queue.

    +

    With this function you can clear all data from the given priority queue data structure. This does NOT destroy the data structure (for that you should use ds_priority_destroy()), it only wipes all data from it.

     

    Syntax:

    ds_priority_clear(id)

    diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Data_Structures/DS_Queues/ds_queue_clear.htm b/Manual/contents/GameMaker_Language/GML_Reference/Data_Structures/DS_Queues/ds_queue_clear.htm index 615cb5b9e..71a078514 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Data_Structures/DS_Queues/ds_queue_clear.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Data_Structures/DS_Queues/ds_queue_clear.htm @@ -15,7 +15,7 @@

    ds_queue_clear

    -

    With this function you can clear all data from the given queue data structure. This does NOT destroy the data structure (for that you should use ds_queue_destroy()), it only wipes all data from it and returns an empty queue.

    +

    With this function you can clear all data from the given queue data structure. This does NOT destroy the data structure (for that you should use ds_queue_destroy()), it only wipes all data from it.

     

    Syntax:

    ds_queue_clear(id)

    diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Data_Structures/DS_Stacks/ds_stack_clear.htm b/Manual/contents/GameMaker_Language/GML_Reference/Data_Structures/DS_Stacks/ds_stack_clear.htm index 2ac7c2962..c3c6aa2bc 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Data_Structures/DS_Stacks/ds_stack_clear.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Data_Structures/DS_Stacks/ds_stack_clear.htm @@ -15,7 +15,7 @@

    ds_stack_clear

    -

    With this function you can clear all data from the given stack data structure. This does NOT destroy the data structure (for that you should use ds_stack_destroy()), it only wipes all data from it and returns an empty stack.

    +

    With this function you can clear all data from the given stack data structure. This does NOT destroy the data structure (for that you should use ds_stack_destroy()), it only wipes all data from it.

     

    Syntax:

    ds_stack_clear(id)

    From 256035e7991a98e0cea827a202347dc024308267 Mon Sep 17 00:00:00 2001 From: gurpreetsinghmatharoo Date: Tue, 4 Aug 2026 11:38:09 +0100 Subject: [PATCH 06/28] docs(general): Document that the depth range is only a safe recommended range, as it's platform-dependent https://github.com/YoYoGames/GameMaker-Bugs/issues/15689 --- .../Instances/Instance_Variables/depth.htm | 4 ++-- .../Rooms/General_Layer_Functions/layer_depth.htm | 7 ++++--- Manual/contents/assets/snippets/Depth_range.hts | 14 ++++++++++++++ .../assets/snippets/Note_layer_depth_range.hts | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 Manual/contents/assets/snippets/Depth_range.hts diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/Instance_Variables/depth.htm b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/Instance_Variables/depth.htm index 8987e60d8..f5efeb183 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/Instance_Variables/depth.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/Instance_Variables/depth.htm @@ -23,7 +23,7 @@

    depth

    Usage Notes

    • You cannot set the depth of an instance in its Draw event (all other events are fine). You can, however, set the depth at which to draw things in Draw Events using gpu_set_depth.
    • -
    • There is a minimum (-16000) and maximum (16000) depth value outside of which instances will not be drawn, although they will still exist and process events.
    • +
    • You can assign a floating point value as the depth, though the decimals will have no effect as GameMaker truncates the value (i.e. removes the decimal part). Depth is treated as an as integer number internally.
    • When you modify the depth variable and GameMaker manages the layers, the built-in layer variable will hold an invalid layer handle (-1) instead of a valid one, since managed layers cannot be manipulated through code. @@ -52,7 +52,7 @@

      Example:

      Next: layer
      -
      © Copyright YoYo Games Ltd. 2025 All Rights Reserved
      +
      © Copyright YoYo Games Ltd. 2026 All Rights Reserved

      layer_depth

      This function can be used to change the depth of the given layer, changing the order in which its contents will be rendered to the screen.

      -

      You supply the layer handle (which you get when you create the layer using layer_create) or the layer name (as a string - this will have a performance impact) and then give the new depth to set it to (an integer value from -16000 to 16000). The layer depth is defined as being higher when "further away" from the camera and lower when "closer" to the camera, so if you have three layers with depths -100, 0, 100, the layers will draw in the order 100, 0, -100, so that the "top" layer (i.e., the closest to the camera view and so drawn over everything else) will be the layer with the -100 depth.

      +

      You supply the layer handle (which you get when you create the layer using layer_create) or the layer name (as a string - this will have a performance impact) and then give the new depth to set it to. The layer depth is defined as being higher when "further away" from the camera and lower when "closer" to the camera, so if you have three layers with depths -100, 0, 100, the layers will draw in the order 100, 0, -100, so that the "top" layer (i.e., the closest to the camera view and so drawn over everything else) will be the layer with the -100 depth.

      The following image shows a schematic of how depth works for layers:

      -

      Layer depth exampleNote that you can check the depth of a layer at any time using the function layer_get_depth. Also note that the minimum and maximum layer depths are -16000 to 16000, and anything outside of those depths will not be rendered. If you require a depth outside of that range then you will need to use the function layer_force_draw_depth.

      +

      Layer depth exampleYou can check the depth of a layer at any time using the function layer_get_depth.

      +

      Keep in mind that modifying the depth of a layer may change which Filters and Effects are applied to it, as changing the depth to be lower than an FX layer's depth will no longer apply its effect on the layer.

       

      @@ -62,7 +63,7 @@

      Example:

      -
      © Copyright YoYo Games Ltd. 2025 All Rights Reserved
      +
      © Copyright YoYo Games Ltd. 2026 All Rights Reserved

      vertex_get_buffer_size

      This function gets the size of the given vertex buffer in bytes.

      +

      Note that vertex buffers are created with an initial size of 32768 bytes and grow as data is added, so the value returned will never be lower than that, regardless of the data inside the vertex buffer.

       

      Syntax:

      vertex_get_buffer_size(buffer)

      @@ -29,14 +30,14 @@

      Syntax:

      buffer - Vertex Buffer + Vertex Buffer The vertex buffer to get the size of.

       

      Returns:

      -

      Real

      +

      Real

       

      Example:

      bufferBytes = vertex_get_buffer_size(buff);

      @@ -50,7 +51,7 @@

      Example:

      -
      © Copyright YoYo Games Ltd. 2023 All Rights Reserved
      +
      © Copyright YoYo Games Ltd. 2026 All Rights Reserved

      Drawing

      -

      This section, and the following section on Movement and Controls, are aimed at giving you practical examples of GML Code or GML Visual, to get you started making your first game projects. We won't be explaining things in too much depth as we want you to get started making stuff as quickly as possible, so we encourage you to explore any links as you go along and to use the "search" function of the manual to look for additional information on anything you aren't sure about.

      -

      In this section we're going to draw information to the screen, both text and images, and also explain a bit more about the different Draw Events, specifically, the main Draw event and the Draw GUI event (note that in some of the examples you will be required to add other events, but we'll explain these as we come to them).

      -

      The Draw Events

      +

      In this section we're going to draw things in the room, both text and images. This is done using a Draw event:

      +

      The Draw Eventschange image to Draw

      Before going any further, you might want to make a new project from the Start Page, and add (or create) a few sprites as well as an object or two, as we'll be giving you some code that you can test using these. Even a white square will work for now as the sprite for our object!

      Now, as mentioned in the section on Objects And Instances, if you don't add a Draw Event to the object, then GameMaker will default draw, meaning that if the object has a sprite assigned to it this sprite will be drawn, complete with any transforms that have been added.

      What do we mean by transforms? Well, each object has a number of built-in variables that will control how an instance of the object draws its sprite when default drawing, and you can change these variables as the game runs to change the way the sprite is drawn.

      @@ -68,7 +67,7 @@

      Drawing

       

      The above examples illustrate just some of the many ways that you can manipulate the object sprite when GameMaker is default drawing, but what about if you want to draw more than one thing for an object? In those cases you need to use the Draw Event to explicitly tell GameMaker what to draw, which is what we'll do in the following examples.

      -

      Drawing Two (or more) Sprites Together

      +

      Drawing Two (Or More) Sprites Together

      For this example, you'll need two sprites and one object. Call the sprites "spr_One" and "spr_Two", and then set the "spr_One" origin to the center and for "spr_Two" set its origin to the middle-left:

      Show Origins For SpritesAssign the first sprite ("spr_One" with the center origin) to the object you have created and then add a Create Event. In the Create Event add the following GML Visual or GML:

      @@ -122,106 +121,8 @@

      Drawing

      Run the project again and you should see this:

      Example Of Drawing Shapes And Text Together

      One important thing to note about this, is that even though we aren't drawing the assigned sprite, it will still be used for collision detection. So, while you may be drawing one thing, collisions will still be calculated based on the assigned sprite even if it's not visible. This is quite handy actually, as it means you can draw different sprites, but maintain a single collision mask based on the assigned sprite. Also note that you can still apply the different transforms like X/Y scale, and collisions will be based on the changed size, even though there is nothing being drawn to show this.

      -

      You can also do the opposite, where you change the sprite assigned to the instance, but keep one mask by applying a sprite to the mask_index variable.

      -
      -

       

      -

       

      -

      The GUI Layer

      -

      We mentioned at the top of the page that we'd be talking about the Draw GUI Event as well as the Draw Event, so let's look at that now.

      -

      The Draw GUI Event works on something called the GUI Layer, which is a special drawing layer of a fixed width and height that is drawn over the contents of the room. The great thing about the GUI layer is that it doesn't move with the room's camera, so it's the ideal place to add static GUI (or HUD) items, like scores, healthbars and other information that your game requires to communicate to the user. You can find out more information on the GUI layer from the Draw Events section of the manual.

      -

       Rooms can be larger than the screen size, so you can have large levels for the player to move around in. This means that in the Room Editor (or in code) you need to define a camera that follows the action of your game. This is basically a way of setting up a fixed area of the screen to display different parts of the larger room based on - for example - the player position in the room, and is used in a lot of games. Think of the way that the view always follows the main character in classic games like Mario or Zelda. That's done with cameras. For information on setting up cameras, see Cameras And Viewports.

      -

      The following examples are all going to be using the Draw GUI event, so you'll need to create an object and add that event to it. Note that the object doesn't need a sprite assigned, as we are not wanting to default draw anything, nor do we need it to detect collisions. Objects like this, that are only designed for drawing things or controlling certain aspects of the game are often called Controller Objects. Also note that we will be using the same object for all the examples, so we recommend that you go through these one after the other (although this is not strictly necessary).

      -

      Draw GUI Event In An Object Drawing Text

      -
      -

      When drawing to the GUI layer, the top-left corner of the window is the origin position (0, 0), and to the right is +X and down is +Y. This makes positioning text and graphics very easy, as you'll see in this example.

      -

      All we're going to do here is draw a value that represents the player's score, so in our object we'll need to add a Create Event to initialise a variable to hold this value, like this:

      -

      Defining A Variable Using DnD

      -

      player_score = 0;

      -

      We also want to add a Keyboard Down <Space> Event to the object, as we'll be using that to increment the score while you hold the Space key.

      -

      Adding A Space Key Pressed Event

      -

      In this event add the following:

      -

      GML VisualActions In The Space Key Event

      -

      var _val = irandom(100);
      - player_score = player_score + _val;

      -

      This generates a random number from 0 to 100 and adds that to the "player_score" variable (in GML Visual, "Relative" is marked, making it an addition operation instead of assignment).

      -

      Finally, let's draw the score value in the Draw GUI event, like this:

      -

      Drawing Text To The GUI Layer Using DnD

      -

      draw_set_halign(fa_left);
      - draw_set_colour(c_yellow);
      - draw_text(32, 32, "SCORE:");
      - draw_set_colour(c_white);
      - var _str = string(player_score);
      - draw_text_transformed(32, 48, _str, 2, 2, 0);

      -

      You'll notice how we've used hard-coded (or fixed) values for the x/y position of the text to be drawn, since we don't need it to be relative to any instance as we are drawing to the GUI layer. We've also used the "set colour" function to change the colour of the text, as well as the "transformed" fucntion to make the actual score value larger, which illustrates how you can go about customising text elements in your own games.

      -

      Add a single instance of this object to your room now and then press the Play button Play Icon. When the game runs press the <Space> key and you should see the score value increase.

      -

      Animation Showing Text Being Drawn To The GUI Layer

      -

       

      -
      -

      Drawing Sprites

      -
      -

      In this example, we are going to use the GUI layer to draw some sprites. The most obvious use for this is to draw the players lives, so lets go ahead and do just that! You'll need a sprite for this example - which should be about 64x64 pixels - but it shouldn't be assigned to the object, as we'll be drawing it ourselves.

      -

      To start with, we need to add some new variables to the object in the Create Event (if you've done the previous example, add the following below what's already there):

      -

      Defining Variables Using DnD

      -

      player_lives = 3;
      - gui_w = display_get_gui_width();

      -

      In this code we initialise a variable for the player lives, but we also create a variable to hold the width of the GUI layer, so that we can position things correctly relative to the right edge of the screen.

      -

      We could just hardcode a value into the code and use that, but that would mean that if we make any changes to the size of the room or camera later, then we'd need to go through the code and change the value everywhere. Using the display_get_gui_width() function instead means that we don't need to worry about any future changes like that as the code will adapt automatically to whatever size the GUI layer ends up being.

      -

      Next we want to add a Keyboard Pressed <Enter> Event to the object, as we'll be using that to change the number of lives every time the Enter key is hit:

      -

      Adding An Enter Key Pressed Event

      -

      In this event add the following:

      -

      GML VisualIn The Enter Key Down Event

      -

      player_lives = player_lives - 1;
      -
      - if (player_lives < 0)
      - {
      -     player_lives = 3;
      - } -

      -

      This lowers the lives by 1 each time the key is hit, and when it goes below 0, it resets it to 3.

      -

      Finally, we need to draw the sprites to the display. For this we'll be using a "for" loop (information using GML here and for GML Visual here), along with the GUI width variable to position everything in the top right corner of the screen. So, add this into the Draw GUI Event (after any other actions that it may have from previous examples):

      -

      GML VisualActions To Draw Sprites To The GUI Layer

      -

      for (var i = 0; i < player_lives; i += 1)
      - {
      -     var _xx = gui_w - 48 - (i * 70);
      -     draw_sprite(spr_Heart, 0, _xx, 48);
      - }

      -

      If you haven't already added an instance of this object to a room, go ahead and add it now (only one!), then press the Play button Play Icon. Once the game is running press the <Enter> key various times to see the lives change.

      -

      Animation Drawing Sprites To The GUI Layer

      -

      Before you leave this example, you should experiment with the number of lives and see what happens. At the moment it's set to 3, but change the Create Event and the Key Pressed event to set the value to 5, or 10... if you've done everything right, then the code should adapt and draw them all correctly!

      -

       

      -
      -

      Drawing A Healthbar

      -
      -

      This final example covers drawing a healthbar to the GUI layer. There are a number of ways that this can be done, but GameMaker has a built-in function specifically for doing healthbars, so that's what we'll be using here, although you can create your own using sprites or shapes too. To start with, as before, we need to initialise a varaible to hold the health value, so add the following GML Visual or GML into the Create Event of the object (after any other code that may already be there):

      -

      Defining A Variable Using DnD

      -

      player_health = 100;

      -

      We want to use the arrow keys to change the health value up or down depending on which arrow key is pressed, and we could do that by adding in two Keyboard Pressed <Arrow> events, however it's probably easier to use a Step Event and some code to check for the keys, so go ahead and add a Step Event now with the following GML Visual or GML:

      -

      Step Event GML VisualActions

      -

      if (keyboard_check(vk_up))
      - {
      -     if (player_health < 100)
      -     {
      -         player_health = player_health + 1;
      -     }
      - }
      -
      - if (keyboard_check(vk_down))
      - {
      -     if (player_health > 0)
      -     {
      -         player_health = player_health - 1;
      -     }
      - } -

      -

      Try to think about what this does!

      -

      With that done, we can actually get around to drawing the healthbar, which is done in the Draw GUI event, adding the following (after anything else that is already there):

      -

      GML VisualFor The Draw GUI Event To Draw A Healthbar

      -

      var _xx = display_get_gui_width() / 2;
      -
      - draw_healthbar(_xx - 50, 24, _xx + 50, 40, player_health, c_black, c_red, c_lime, 0, true, true); +

      You can also do the opposite, where you change the sprite assigned to the instance, but keep one mask by applying a sprite to the mask_index variable.

      -

      Add an instance of this object to a room if you haven't already done so (only one, though!), and then press the Play button Play Icon. Once the game is running press the <Up Arrow> and <Down Arrow> keys various times to see the health change.

      -

      Animation Of Drawing A Healthbar

       

      We hope that after doing these examples you have a bit more confidence when using GameMaker and a bit more understanding of how it all works. The next section will explore how to get these things you've been drawing to move around the room as well as accept - and respond to - user input.

      @@ -235,7 +136,7 @@

      The GUI Layer

      -
      © Copyright YoYo Games Ltd. 2025 All Rights Reserved
      +
      © Copyright YoYo Games Ltd. 2026 All Rights Reserved

      draw_set_alpha

      -

      With this function you can set the base draw alpha for the game. This value can be set from 0 to 1 with 0 being fully transparent and 1 being fully opaque (the default value), and will affect all further drawing, including backgrounds, sprites, fonts, primitives and 3D.

      -

      Note that if you are drawing any of the assets and supplying an alpha argument as part of the function (for example, when using draw_sprite_ext), then the alpha value set here will be overridden, so drawing a sprite using draw_sprite_ext() with an alpha argument of 1 will draw the sprite fully opaque regardless of the alpha set with draw_set_alpha (this will work the same when using draw_self and setting the image_alpha of the instance). Also note that when an instance is default drawing (i.e.: it has a sprite but no Draw Event), then the image_alpha variable will be clamped to the alpha set with draw_set_alpha, such that an image_alpha of 1 and a draw alpha of 0.5 will draw the sprite at alpha 0.5, while an image_alpha of 0.25 and a draw alpha of 0.5 will draw the sprite at 0.25 alpha.

      -

       If you use this function to set the draw alpha to values other than 1, remember to reset it back to the default value using draw_set_alpha(1); at the end of the event. Otherwise, the modified draw alpha will continue to apply to other graphical elements and cause unwanted transparencies. See also: GM2063

      +

      With this function you can set the base draw alpha for the game. This value can be set from 0 to 1 with 0 being fully transparent and 1 being fully opaque (the default value), and will affect further drawing, including backgrounds, sprites, fonts, primitives and 3D.

      +

      Note that if you are drawing a sprite and supplying an alpha argument as part of the function (for example, when using draw_sprite_ext), then the alpha value set in that function will be used, so drawing a sprite using draw_sprite_ext() with an alpha argument of 1 will draw the sprite fully opaque regardless of the alpha set with draw_set_alpha (this will work the same when setting the image_alpha on an instance, meaning this function never affects instances doing default draw).

      +

       If you use this function to set the draw alpha to values other than 1, remember to reset it back to the default value using draw_set_alpha(1) at the end of the event. Otherwise, the modified draw alpha will continue to apply to other graphical elements and cause unwanted transparencies. See also: GM2063

       

      Syntax:

      draw_set_alpha(alpha)

      From 4cf8bdd45d125becaec98c1b1b510e24adae8068 Mon Sep 17 00:00:00 2001 From: Gurpreet Singh Matharoo Date: Fri, 21 Aug 2026 13:21:08 +0530 Subject: [PATCH 12/28] docs(general): You cannot use anon functions as constructor parent https://github.com/YoYoGames/GameMaker-Bugs/issues/15671 --- Manual/contents/GameMaker_Language/GML_Overview/Structs.htm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manual/contents/GameMaker_Language/GML_Overview/Structs.htm b/Manual/contents/GameMaker_Language/GML_Overview/Structs.htm index fefe40c23..3cc71c1f0 100644 --- a/Manual/contents/GameMaker_Language/GML_Overview/Structs.htm +++ b/Manual/contents/GameMaker_Language/GML_Overview/Structs.htm @@ -192,7 +192,7 @@

      Constructor Functions

      empty_vector = new Vector2();

      Inheritance

      Functions created this way will also support single inheritance, i.e.: you can create a constructor function that inherits data from another constructor function.

      -

       When working with inheritance, you cannot use method variables to define the constructor function, only script functions.

      +

       When working with inheritance, you cannot use method variables or anonymous functions in general to define the constructor function, only named script functions.

      For example, we created the Vector2 constructor function above, so we can then use that as the "parent" for another constructor function, which we'll call Vector3:

      function Vector3(_x, _y, _z) : Vector2(_x, _y) constructor
      {
      @@ -305,7 +305,7 @@

      Struct Functions

      -
      © Copyright YoYo Games Ltd. 2025 All Rights Reserved
      +
      © Copyright YoYo Games Ltd. 2026 All Rights Reserved
      -

      draw_sprite_general

      -

      This function combines the function draw_sprite_ext() with the function draw_sprite_part(), adding in some additional blending options so that each corner of the final sprite part can be blended with an individual colour.

      -

      Note that applying colours to corners may not look exactly as you expect due to how sprites are drawn. See the following example, where the image on the left is drawn with a different bottom-left colour, and the image on the right is drawn with a different bottom-right colour:

      -

      In each image the gradients do not seamlessly span the whole rectangle and instead seem to be split into halves. This is due to a rectangle actually being made up of two triangles, where the corner colours supplied into this function are applied to each vertex of the two triangles (hence 6 vertices at 3 per triangle). This causes the colours between the vertices to be interpolated for each triangle separately.

      -

      Colour blending is only recommended for the HTML5 target when WebGL is enabled, although you can still set the blending colour if it is not enabled and it will blend the sprite as normal. However all blending in this way creates a duplicate sprite which is then stored in the cache and used when required. This is far from optimal and if you use multiple colour changes it will slow down your games performance unless you activate WebGL. If you do not wish to use WebGL, then you can set the sprite cache size to try and limit this should it be necessary using the function sprite_set_cache_size().

      -

      This function may not work as expected when using skeleton animation sprites, and you may find that the function only draws the first frame of the default pose. You should be using the draw_skeleton_* functions instead.

      -

      When drawing with this function, the sprite x offset and y offset are ignored and the sprite part will be drawn with the top left corner at the specified x / y position in the room.

      -
      -

      -

      Syntax:

      -

      draw_sprite_general(sprite, subimg, left, top, width, height, x, y, xscale, yscale, rot, c1, c2, c3, c4, alpha)

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      ArgumentTypeDescription
      spriteSprite AssetThe sprite to draw.
      subimgRealThe subimg (frame) of the sprite to draw (image_index or -1 correlate to the current frame of animation in the object).
      leftRealThe x position on the sprite of the top left corner of the area to draw.
      topRealThe y position on the sprite of the top left corner of the area to draw.
      widthRealThe width of the area to draw.
      heightRealThe height of the area to draw.
      xRealThe x coordinate of where to draw the sprite.
      yRealThe y coordinate of where to draw the sprite.
      xscaleRealThe horizontal scaling of the sprite, as a multiplier: 1 = normal scaling, 0.5 is half etc...
      yscaleRealThe vertical scaling of the sprite, as a multiplier: 1 = normal scaling, 0.5 is half etc...
      rotRealThe rotation of the sprite. 0=normal, 90=turned 90 degrees counter-clockwise etc.
      c1ColourThe colour with which to blend the top left area of the sprite.
      c2ColourThe colour with which to blend the top right area of the sprite.
      c3ColourThe colour with which to blend the bottom right area of the sprite.
      c4ColourThe colour with which to blend the bottom left area of the sprite.
      alphaRealThe alpha of the sprite (from 0 to 1 where 0 is transparent and 1 opaque).
      -

      -

      Returns:

      -

      N/A

      -

      -

      Example:

      -

      draw_sprite_general(sprite_index, image_index, 8, 8, sprite_width-16, sprite_height-16, x, y, 2, 0.5, 180, c_white, c_white, c_black, c_black, 1);

      -

      This will draw the instances assigned sprite (sprite_index) and its current frame of animation (image_index), however it will shave an 8px margin off all four sides of the sprite. It will be stretched to double its usual width but half its usual height. It will be opaque, and upside down. The top area of the sprite will be blended white and hence normal, but the bottom area will be black, meaning the sprite will go from normal to a silhouette downwards in a smooth gradient.

      -

      -

      -

      - -

      draw_sprite_stretched

      -

      This function simply takes a sprite resource and stretches it over the given width and height so that it occupies that area. As with draw_sprite() you can specify a sprite and a sub-image for drawing, then the x / y position in the room for the sprite to be drawn at and finally a width and a height (which must be pixel values). The image below shows the result of this function with different sets of arguments:

      -

      draw_sprite_stretched example

      -

      NOTE When drawing with this function, the sprite x offset and y offset (or origins) are ignored and the sprite is drawn with the top-left corner at the specified x/y position in the room.

      -

      -

      -

      Syntax:

      -

      draw_sprite_stretched(sprite, subimg, x, y, w, h)

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      ArgumentTypeDescription
      spriteThe sprite to draw.
      subimgThe subimg (frame) of the sprite to draw (image_index or -1 correlate to the current frame of animation in the object).
      xThe x coordinate of where to draw the sprite.
      yThe y coordinate of where to draw the sprite.
      wThe width of the area the stretched sprite will occupy.
      hThe height of the area the stretched sprite will occupy.
      -

      -

      Returns:

      -

      N/A

      -

      -

      Example:

      -

      draw_sprite_stretched(sprite_index, image_index, x, y, sprite_width, sprite_height / 2);

      -

      This will draw the instance's assigned sprite and its sub-image with the left corner at the instance x/y position. Its width is set to the same as the sprite, and the height is the sprite height divided by two.

      -

      -

      -

      - -

      draw_sprite_tiled_ext

      -

      This function will take a sprite and then repeatedly tile it across the whole view (or room if no view is defined), starting from the coordinates that you give in the function and with each tile scaled, colour blended and with the alpha that you define (these properties are the same as those used in draw_sprite_ext()). This function is for 2D (orthographic) projections only, and will not work correctly when a 3D camera projection is used.

      -

      Colour blending is only recommended for the HTML5 target when WebGL is enabled, although you can still set the blending colour if it is not enabled and it will blend the sprite as normal. However all blending in this way creates a duplicate sprite which is then stored in the cache and used when required. This is far from optimal and if you use multiple colour changes it will slow down your games performance unless you activate WebGL. If you do not wish to use WebGL, then you can set the cache size to try and limit this should it be necessary using the function sprite_set_cache_size().

      -
      -

      -

      Syntax:

      -

      draw_sprite_tiled_ext(sprite, subimg, x, y, xscale, yscale, colour, alpha)

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      ArgumentTypeDescription
      spriteSprite AssetThe sprite to draw.
      subimgRealThe subimg (frame) of the sprite to draw (image_index or -1 correlate to the current frame of animation in the object).
      xRealThe x coordinate of where to draw the sprite.
      yRealThe y coordinate of where to draw the sprite.
      xscaleRealThe horizontal scaling of the sprite. A multiplier ' 1 = normal scaling, 0.5 is half etc.
      yscaleRealThe vertical scaling of the sprite. A multiplier ' 1 = normal scaling, 0.5 is half etc.
      colourColourThe colour with which to blend the sprite. c_white is to display it normally.
      alphaRealThe alpha of the sprite (from 0 to 1 where 0 is transparent and 1 opaque).
      -

      -

      Returns:

      -

      N/A

      -

      -

      Example:

      -

      draw_sprite_tiled_ext(sprite_index, image_index, x, y, 2, 2, c_red, 0.5);

      -

      This will draw the instances assigned sprite (sprite_index) and its current frame of animation (image_index) at the instances own x and y position, but scaled to twice the normal size, blended red and with half the normal alpha. The sprite will be tiled horizontally and vertically across the view.

      -

      -

      -

      - @@ -20,12 +19,12 @@

      Overview

      The latter method (of specifying the filter/effect in your code) only works with string literals directly specified in the function argument, which means that if you use a variable or any logic to come up with the filter/effect name string, then the asset compiler will not detect that and the filter/effect will not be loaded.

      Consider the following examples:

      -

      // This will work on its own
      - var _fxshake = fx_create("_filter_screenshake");
      -
      - // This will NOT work on its own
      - var _myfilters = { screenshake: "_screenshake" }
      - var _filter_to_use = "_filter" + _myfilters.screenshake;
      +

      // This will work on its own
      + var _fxshake = fx_create("_filter_screenshake");
      +
      + // This will NOT work on its own
      + var _myfilters = { screenshake: "_screenshake" }
      + var _filter_to_use = "_filter" + _myfilters.screenshake;
      var _fxshake = fx_create(_filter_to_use);

      To ensure that the latter method works, you can simply add the filter to at least one room in your project, or ensure that fx_create() is called anywhere in your project with the filter name as a string constant (and not a variable).

      @@ -73,17 +72,17 @@

      Modify FX At Runtime

    Here is example code for the workflow mentioned above:

    Create Event

    -

    // Store the FX struct, and its parameters struct, in variables
    - pixelate_fx = layer_get_fx("Effect_1");
    +

    // Store the FX struct, and its parameters struct, in variables
    + pixelate_fx = layer_get_fx("Effect_1");
    pixelate_fx_params = fx_get_parameters(pixelate_fx);

    Step Event

    -

    // Change param as variable
    - pixelate_fx_params.g_CellSize = round((mouse_x / room_width) * 64);
    -
    - // Or, change param as string
    - pixelate_fx_params[$ "g_CellSize"] = round((mouse_x / room_width) * 64);
    -
    - // Apply updated parameters struct to the FX struct
    +

    // Change param as variable
    + pixelate_fx_params.g_CellSize = round((mouse_x / room_width) * 64);
    +
    + // Or, change param as string
    + pixelate_fx_params[$ "g_CellSize"] = round((mouse_x / room_width) * 64);
    +
    + // Apply updated parameters struct to the FX struct
    fx_set_parameters(pixelate_fx, pixelate_fx_params);

    FX Runtime Parameters

    @@ -102,10 +101,10 @@

    Single Layer Mode

    By default, a filter/effect is applied to the layer that it is assigned to and all layers below that layer, however you can use fx_set_single_layer() to enable Single Layer mode for a filter/effect to make sure that it's only applied to the layer that it is assigned to.

    The following visual shows a filter being applied to multiple layers (which is the default behaviour for all FX layers), and then the same filter with Single Layer mode enabled and applied to a non-FX layer:

    -
    Fire Jump man is woozy with the universe +
    Fire Jump man is woozy with the universe
    Single Layer Mode OFF
    -
    Fire Jump man is woozy... alone +
    Fire Jump man is woozy... alone
    Single Layer Mode ON
    @@ -116,7 +115,7 @@

    Single Layer Mode

    Back: Rooms
    -
    Next: UI Layers
    +
    Next: UI Layers
    © Copyright YoYo Games Ltd. 2025 All Rights Reserved
    @@ -128,5 +127,5 @@
    © Copyright YoYo Games Ltd. 2025 All R - - \ No newline at end of file + + \ No newline at end of file diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Rooms/Rooms.htm b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Rooms/Rooms.htm index d582a9f9e..75a30c3fc 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Rooms/Rooms.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Rooms/Rooms.htm @@ -1,16 +1,15 @@ - - - + + Rooms - - + + - - - - + + + + @@ -32,8 +31,8 @@

    Global

  • room_width
  • room_persistent
  • -

     The variables listed above will not be valid in a script, as scripts are executed before the first room is loaded.
    -
    +

     The variables listed above will not be valid in a script, as scripts are executed before the first room is loaded.
    +
    This only applies to code written at the root of a script, but not to functions created inside scripts, as those functions can be executed at any time during the game.

    Information

    @@ -77,7 +76,7 @@

    Layers and Elements

  • Sequence Elements
  • Text Elements
  • Particle System Elements
  • -
  • UI Layers
  • +
  • UI Layers
  • Filters and Effects