How do I simplify this?

0 favourites
  • 9 posts
From the Asset Store
Array Based Weapons System: Simplify weapon integration and customization, no plugins needed.
  • I have a function that needs to iterate over a family to display every member of it in a list. So far the logic looks like this:

    Is there some way to simplify this process so I don't have to update it every time I add a member to the family? I'm also having some difficulty with the order. Like I tried to set the blend mode (so they don't appear outside of the scrollbox) but event 39 did not work so I had to iterate over the individual members as well. As an aside, I noticed when I set the height of the sprite these items are pinned to the pins move. This shouldn't be an issue though as I'll just rely on the instance variable.

    So how do I make this simpler when my list gets to 30+ members I don't have so much of a headache?

  • Perhaps you can remove the actions after the create object actions, and put them in a separate Event, condition: Heroes > On Created...

    This way, whenever an object in that family is created, it'll run through just 3 actions(the actions you had after the create object shown in your image).

    The heroes family will need to have the instance variables and behaviors applied to the family.

    Or create a seperate family if you need other things besides heroes, etc..

  • Use family

  • Okay so I was able to simplify 2 of the actions by using an event with "Heroes on created" + "Heroes on layer..." event. But I still don't know how to iterate over the family to make sure new members get added to this list if I add new members to the family.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What do you mean? If the members are in the family, then when they're created they will be automatically added to the list.

  • Is what I mean is if I add a new member to the family I will need to go back to event 38 to add a create action and a set instance variable action.

    I can't use say... "loop 0 until Heroes.count" create "Heroes". This would create a list of random heroes.

  • have you tried putting the instance variable action in the oncreate event and changing the object to the family?

    Why would you loop until Heroes.count to create heroes? Count is the number of heroes that have already been created. BTW, If you have members of the family in the layout when the layout starts, the on create will automatically get called.

  • Please tell us your requirements, and maybe even provide a full capx. That would make it easer to help.

    Also I think you're confusing what Families can do for you. At design time, a Family's members are object types. At run time, a Family can have a number of picked objects (instances) which can consist of any Family members, or none, or one of each, etc. You can't expect a Family to have 1 instance of each member (as it seems you're wanting to do).

  • My requirements is I need to create a scroll list box that creates and displays a list of options for the player. I'm looking to make a strategy RPG so I'll be needing this a lot. In this particular case I'm displaying a list a classes with the goal of the player selecting one for recruitment. I'll admit it has taken me a week just to assemble this portion of my game and it's gotten very frustrating. Here's the entire CapX file. Most of the relevant functions are in the listbox group. The bottom right button in Layout 1 summons the list.

    To do:

    * Scale the scrollbar to the size of the listbox.

    * Display a tooltip on class mouseover.

    * Enable Dragdrop from the listbox.

    * Possibly package this as a tutorial or a plugin.

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