How do make a list of tasks and control them independently of each

0 favourites
  • 10 posts
From the Asset Store
Template for scrollable list, fully documented in comment and video
  • Hello,

    I am trying to create a list of tasks and control them independently of each other within a single text box. The main mission text is separate from the task text. There can be any number of tasks to accomplish and would like to have them turn green when completed while keeping the rest the default color. Is this possible? Your help is greatly appreciated.

  • Hello,

    After viewing the javascript API for the text plugin, I do not think this is possible. The text colour affects the entire text.

    Why not have each task as a single text?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for your reply. I could if it is possible to space it correctly. If a task spans multiple lines then the text ends up overlapping. If there is a solution to this that would help. Thank you.

  • Hello,

    If you stored each task in an array along with its status of completion and the mission ts for, you could filter it and loop over each and place it accordingly to the previous one, leaving adequate spacing.

  • That sounds like it should work. If you don't mind, could you explain how that's done as if I know little about arrays; it would be appreciated. Or maybe point me in the right direction. I am not too familiar with them yet since I've been mostly using dictionary instead. I know the basics about how to create them and how to store in the x but that's about it. Thank you for your help.

  • Hello,

    I have not yet used the Array plugin built into C3 yet. I am a javascript programmer so I do most of my programming using scripts over event sheets but the concepts remain the same.

    The array documentation is well written but for someone new to programming concepts in general I can see how it might be difficult pick up right away.

    In that case, there is also a good example project called "Languages from JSON template" you can find on the startup screen.

    The interface to them in C3 is very similar to a spreadsheet. You would define the dimensions, which is essentially a visualization of how many rows and columns you need. Each row would be a task, each column a data point representing that task. In this case it be be a column for the task description and another one presenting if the task is complete. (check the JSONLanguageData.json file in the startup example)

    Now you have your data defined you need to load it into your project using the AJAX plugin also shown in the startup example and explained in the documentation.

    Once the data is loaded into memory, you can now iterate over each row spawning new text which pulls the data out of the array.

    I hope it helps, i'll try help you further when you encounter more specific problems.

  • Thank you for the follow up and detailed explanation. The theory makes sense and will just be a matter of implementation. I will check out those tutorials in the start up examples and see what I can figure out. I appreciate your continued efforts through my learning process.

  • I got something that is working! But still haven't been able to fix the original issues

    1) Change the text color when a task is complete

    2) Align the text so that it doesn't overlap if it were to span multiple lines

    I really appreciate your assistance.

    I hope this file link works!AuQJ1GGThi6apGPIva3_JK3xnrSn

  • Hello,

    So I have taken a quick look at your example. I would have a column for each task called "completed" in the array. The value for the column in each row is either true or false (initially false).

    Now when you perform the task you update the boolean value to true, create a condition which will also update the text colour for that text elements that are completed.

    I would also look at not placing the text elements manually but spawning them automatically when the task UI is opened. Doing this will allow you use the previous text elements position and size to determine where the next one gets placed.

    As you are probably realising, the task isn't always as simple as you might think :)

    Let me know how you get on.

  • Thank you for your feedback. Ha the "task" is indeed not as simple as I thought :)

    Throughout the game there will be a lot of tasks so this array will end up being HUGE and even more so if I need another column for each task when completed. Might be easier to not change the text and just change the color or add a checkmark or something.

    After each mission is complete, is it possible to repopulate the array with a new set of text? Maybe create a json file for each mission...? I would probably have to create a dictionary variable or two that stores which mission and checkpoint the player is on so the correct file is loaded.

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