How do I create a Smart Item List?

0 favourites
  • 5 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi Everyone!

    I am working on some sort of a football manager game. I have a huge list of players and their stats (everyone has 6 stats for now) that I keep in array format and an inventory array for the 11 players that will start the match.

    Now I want to create a squad screen with players formations like this;

    and when I click the profile icon, I want to show a list of available players. I managed to paste players' info in a section like this;

    but I want to show a list, formed with this format, automatically for all the available players in the database.

    Right now I am using this to write down stats for one single player;

    As you can see, it has 7 different objects + the button to select.

    It simply feels wrong to create hundreds of objects for a list that goes on like this (and I know that list will have way more than 4 players);

    Step by step:

    1. User sees a squad list (first screenshot)
    2. User clicks on any of the players that he wants to change
    3. User sees a list of all the available players that is suitable for this position (each player has the format from the second screenshot. If there are 3 players available, 3 players shown, if there are 100 players available, 100 players shown)
    4. User chooses a player from the list (click ok)
    5. Selected player is on previously selected position

    I hope it's all clear and I hope someone else faced this problem and solved it before.



  • See this demo I made (you can open the capx file in C3):

  • I hope I am somewhat correctly addressing the question at hand.

    I am on my phone right now and I don’t have the access or means to test or really write out events so I will try to explain this the best I can.

    I would start by addressing each of the players in an array.

    e.g. foreach player in availablePlayers

    Then possibly create an empty sprite or group of the text items. Something to keep all the data organized using instance variables. Then set the text to the data you pulled. That way you won’t need to create a bunch of objects you are just changing the text based on what the data pulled from the foreach statement is.

    To Clarify:

    At onLoadInventory Complete. Depending on how you have that set up I would try and use a for statement

    e.g. for 1 < Inventory.Count

    then create the objects

    then set the text to Inventory.At(loopindex, 0) and what not for those objects

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • See this demo I made (you can open the capx file in C3):

    Thanks a lot I will check it out as soon as I have my editor around.

    jackarivera: Thank you for your reply! My main problem is deciding on how many objects to create.

    In theory; 6 stats + 1 name for each player ; so 7 text objects

    In order to create a list of 8 players, I need to create 8 * 7 = 56 different objects and fill them in with a for loop?

    Or is there an easier way like I create only 7 text objects,

    After filling those 7 fields I consider that player to be done in a list,

    and move on to the next player to fill same 7 text objects. But objects has to move to the next position in the list

  • See this demo I made (you can open the capx file in C3):

    it actually worked! Thank you so much!

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