How do I build a HUD from data?

0 favourites
  • 2 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • I am probably overthinking this.

    My game has a "Cargo" mechanic, and the player's ship can have a variable number of Cargo Modules that I want to represent in the HUD as Full or not full. But, since the plan is for ships to be player designed and altered during gameplay, I can't know what the maximum number of Cargo Modules will be, so I can't just place 5 or 10 in the HUD and call it done.

    This lead me to the thought of creating an irregular grid for the HUD display, and adding (and/or removing) Cargo Module indicators to the grid as needed. This is where I run into a wall of "How do I do that?" I have an event chain that will only run when the Player's Cargo Modules value changes, and an event chain that only runs when the Player's Cargo amount changes.

    How do I do the math loop in an event to fill in the grid when more or less sprites are needed?

    How do I select the correct HUD display sprite to update from the list of System->CreateObject created sprites?

    Thanks in advance!

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, with many hours of work, an Array, two Functions, and half a dozen global variables, I finally have (most of) it working. I can add and remove modules just by changing the number of modules in the Player object's instance variable, and the HUD properly adjusts to the new number. While it is technically a loop, it only adds or removes one module per tick until the numbers are correct.

    I keep the UID of each created indicator in an Array, so I can get the UID from At() and then Pick instance with UID. I haven't gotten to the part where I change the Animation to indicate Full or not full quite yet, but it won't be too hard from here.

    Thanks for reading.

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