How do I "Create Object (By Name)"

  • Is there a way to create a sprite by using the name of the sprite, like how layouts can be called by name? (I'm using Rex's CSV Plugin to make a dialogue system and, when a character is talking, I want to have a sprite of them onscreen). Effectively:

      When Text = "sprite_alice"
      • Create sprite "sprite_alice"

    Is there any way to do this currently?

  • there is no current C2 expression create object by name... however you dont actually need it... you can add a variable and say

    When Text = "sprite_alice"

    set variable to 1

    triggeronce

    variable=1

    create alice at x y

    When Text = "sprite_john"

    set variable to 2

    triggeronce

    variable=2

    create john at x y

  • Okay, that's a pretty simple workaround. I can see that getting quite complex quite quick with an RPG with a lot of characters, though, keeping track of all those numbers...

    EDIT: Just remembered that variables don't have to be numbers, and that text variables is a thing that exists. Thanks for your help! ^_^

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I suppose you already checked this out .

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)