How do I Set text from array!(Solved)

0 favourites
  • 4 posts
From the Asset Store
Animated Text
$3.99 USD
With AnimatedText behavior you can make an impression of the text being “typed live”.
  • hello all, I am stumped.

    I have a 2d array, 0,0 the value is UID, Name

    I want to set text to name from my array.

    example:

    1, bob

    2, sam

    3, josh

    so if I select an Object(Josh) hs data is stored in the array, how do i set text to the y of my array to pull the name? I tryed array.at(object.UID, 1) the UID is set and loaded into the array in the x position and the name is generated and placed in the y position. and now clicking on the object i want to display that random name from the Y position in my array.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • .. and now clicking on the object i want to display that random name from the Y position in my array.

    If I understood correctly...

  • Not quite,

    I am working with a 3,2,1 array.

    index 1 = Object.UID, "Name1"

    index 2 = Object.UID, "Name2"

    index 3 = Object.UID, "Name3"

    when I load the game I have one sprite that spawns 3 so each one will have a unique UID, I also have a random name generator and it adds it to the Y of the array matching the UID to store the data. Now when I am in the game and select the Object I have a text that should display its name only, how do I get the Y from the array in the text?

    so if I select Objust.UID 25 my code will search in the array for object.uid 25 now from that I want to display the name it was given.

  • Figured it out!

    array.At(array.IndexOf(object.UID),1)

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