Asset - Scripts InstanceCreate

Discussion in 'Marketplace' started by csanyk, Mar 31, 2018.

  1. csanyk

    csanyk Member

    Joined:
    Jun 20, 2016
    Posts:
    821
    InstanceCreate is my first Marketplace asset for GMS2. I created it mostly as an exercise to make sure I knew how to create assets for GMS2, and also to "fix" a mild annoyance I have with the instance create functions in GMS2.

    This is a very simple script for GMS2 users who came from GMS1, and are used to the GML function named instance_create().

    In GMS2, due to the introduction of Layers, instance_create() was replaced by two functions: instance_create_layer(), and instance_create_depth() for backward compatibility.

    This script simply wraps both of those, checks to see what data type the third argument is, and then passes the arguments into the correct function. If argument[2] is a string, instance_create_layer(), otherwise instance_create_layer().

    This is a pretty pointless script, since the convenience of using this script to replace the two functions comes at the cost of an if(type) check. But if you enjoy having a function called instance_create() available to your projects, and can't stop typing it, then this asset is for you!
     
  2. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,064
    Houston, we have a problem.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice