How do I create spritefont based on its uid

0 favourites
  • 5 posts
From the Asset Store
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • Hi, there

    I use system create object to create spritefont, as i have two spritefonts named font which I copied not cloned,(uid:1 and uid:2), every time when I create object the font, it always create uid:1, so How can I pick the uid 2 to create. when I use pick font instance with uid:2, it not works. please help

  • Uid is based on the order in which all objects are created, so it can not be used to create instances.

    To pick an object outside of its creation event you have to use something specific to that object.

    A variable works nice for that.

    You can give an instance an identifier in its variable at its creation.

  • You can use the .asJSON expression and the "load from json" action to copy one object to another. For example if you want to create a Sprite that is a copy of the Sprite with a uid of 2 you could do the following.

    Global text template=""

    On click

    Pick Sprite by uid 2

    --- set template to Sprite.asJSON

    --- create Sprite at (0,0)

    --- Sprite: load from json template

    --- Sprite: set position to (mouse.x, mouse.y)

  • thanks R0J0hound & newt , seems it's not that easy to pick the instance, so I use another ways, thanks again

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My solution would be to give the SpriteFont an instance variable.

    Then system > compare instance variable > SpriteFont > Variable = 1 | SpriteFont > set text

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