1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GML Creating Object Based on String

Discussion in 'Programming' started by Meowanator, Jul 6, 2017.

  1. Meowanator

    Meowanator Member

    Joined:
    Mar 21, 2017
    Posts:
    72
    I am trying to make it so the game makes objects based on the string. I want to have the object load like:
    obj_(string) where I have obj_00, obj_01, etc.

    I am using Game Maker Studio 1.4
     
  2. JFitch

    JFitch Member

    Joined:
    Sep 28, 2016
    Posts:
    428
    Use an array.
    Code:
    obj[0]=obj_00;
    obj[1]=obj_01;
    obj[2]=obj_02;
    ...
     
  3. The Reverend

    The Reverend Member

    Joined:
    Sep 8, 2016
    Posts:
    558
    Read the documentation about the function asset_get_index()
    The example shows pretty much what you want.
     
    Meowanator likes this.
  4. Meowanator

    Meowanator Member

    Joined:
    Mar 21, 2017
    Posts:
    72
    Thanks! It works great.
     

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