Still trying to understand picking

For questions about using Classic.

Post » Tue Dec 01, 2009 5:40 pm

Hello,
another picking question from me.

In my event sheet, I have a section "Setup", where there are several "Start of Layout"-events.
One of them is setting up the gameworld, creating planets at random positions, then going through all the players and picking a random planet for them to have as homeworld.

At a later stage, I trigger a an event "Every 1000 milliseconds", where I try to go through all the planets and update their gamestate. However, it seems that the script only picks a single planet: the one that's been last picked by the setup event (the homeworld of the last player added to the game in this case).
Is there a way for me to manually tell Construct to forget about previously picked objects and start picking from scratch?
B
3
G
3
Posts: 14
Reputation: 903

Post » Tue Dec 01, 2009 5:56 pm

You can always call functions which forget picked objects. Or if you want to pick every instance of an object which has been previously picked in an event tree, you could simply use a family for that purpose.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Tue Dec 01, 2009 6:00 pm

Oh, totally sorry - was my fault. I created my Player-Object in the wrong line (before the loop that actually determines how many players there are).
Yeah, I've been working 24hours straight on this now. I should take a break.
Thanks for the help though :)
B
3
G
3
Posts: 14
Reputation: 903

Post » Tue Dec 01, 2009 10:03 pm

For the record, the best way to reset picking is simply in another event (like you say with multiple start of level events). However, if that's tricky, like if you're several subevents deep, then you can call a function with the function object, and specify that picked objects should be forgotten.
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests