How do I find all the objects on a layer?

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Fri Jul 15, 2011 3:50 pm

I am trying to use the SDK to find all the objects (of any type) on a given layer.

Any tips on how to do this would be appreciated.Alweth2011-07-15 15:51:11
B
1
G
1
Posts: 4
Reputation: 483

Post » Fri Jul 22, 2011 12:51 am

You can do this by grouping objects using Families. SciDave does a great job explaining how to use Families in his Mikey's Adventure tutorial, which can be found here:

http://69.24.73.172/scirra/forum/viewtopic.php?f=8&t=4421

It's the tutorial I'm currently reading. He also talks about the integral parts of any game, including HUDs and events, among other things.

If you mean see a group of objects highlighted or something similar while on a particular layout, I'm not sure there is something like that just yet. People correct me if I'm wrong. Psychlade2011-07-22 00:54:05
B
2
G
1
Posts: 9
Reputation: 568

Post » Fri Jul 22, 2011 5:02 am

don't have time to test this at the moment, but I would say you have to use pRuntime->GetTypes(...) and then pRuntime->GetTypeInstances(...) for each of the types you get
then loop through the instances and check instance->info.layer, or pRuntime->GetObjectLayer(...)
against the desired layer and put each matching object in a vector or listlucid2011-07-22 05:03:08
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sat Jul 23, 2011 12:42 pm

@lucid, thanks! That is what I was looking for. It's not the most intuitive, but it gets the job done.
B
1
G
1
Posts: 4
Reputation: 483


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests