0 Favourites

How do I populate a UI element from an array?

  • I've edited the post so it's a bit more succinct... I do tend to go overboard with my typing. Also I'm probably asking a bit much.

    I'm currently trying to learn arrays for a mech game I'm creating. Each mech uses the same group of object types and gets all of their data in the form of stats, which animation to use, weapons etc from two global arrays.

    I've got accessing arrays down, but I'm still a little fuzzy on looping through them. What I want to do is loop through a certain part of the mech array, which stores which weapons are in weapon slots, and determine how many non-zero entries I have in there (and resize a Weapon List UI element based on that), and then for each non-zero entry somehow create a new 'UI listing' with the weapon name, weapon cool down, weapon ammo etc. Kind of like this:

    How would I go about doing this, do you think?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Here's what the two arrays look like:

    Sorry for double-posting...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
101 37,404
imothep85's avatar
Unread hot topic
99 10,124
karshinkoff's avatar
Unread hot topic
56 4,727
MPPlantOfficial's avatar