How do I create a OS dock that is populated dynamically

Just started using Construct 2? Post your questions here

Post » Thu Aug 27, 2015 6:59 pm

Goal: An operating system-like taskbar/dock that will start empty and be populated with applications/icons as they unlock throughout the game. Applications could be marked or added to some data structure and the dock will update to list all elements in the grouping.

Problem: Currently, I am making each application manually and adding the application to the dock in the "On start of layout". Each application has a boolean to determine if it is unlocked yet and whether to display it. This will become bulky and require a lot of duplicate code later on when there may be dozens of dock elements.

Question: Is there a data structure or method I could use where I could add a newly unlocked application to a list/set a variable/add to a group/etc... and the dock will automatically add or remove elements so it matches the list?

I have searched quite a bit for a similar thread and have not found anything. Please excuse me if this has been asked before!

Thank you.
Posts: 1
Reputation: 177

Post » Fri Aug 28, 2015 10:08 pm

Generally, processing code is a relatively light process. You really could just set your dock up with code like

>If App is Unlocked >Show icon
>Else >Destroy icon

(to put it very crudely). There isn't really a need to have it trigger on layout starts and then have to figure out how to re-trigger it later on in the same layout.
Posts: 63
Reputation: 2,454

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests