Recognizing individuals in Families

Get help using Construct 2

Post » Tue May 08, 2012 12:31 am

[QUOTE=Xavier] Did you try the condition "On destroyed"? And then an action that creates the debris on this position.

For instance, On flyingstone destroyed -> create object stonedebris on flyingstone x and y.

That way it will work every time that object is destroyed on other events.

Also, on destroyed is a trigger condition so it has to be the first condition.[/QUOTE]

Ah, I haven't thought of the On Destroyed condition! Thanks, that worked way better than my method! :-)


Thank you, everyone else! You've given me many nice ideas and good advice. :-)

(Max)
B
30
S
2
G
5
Posts: 7
Reputation: 5,099

Post » Sun Apr 09, 2017 1:33 am

Sorry, but this isn't actually a reply, but a relate question concerning the main topic. I've created a family of individual sprite objects. It looks pieces.X and pieces.Y ("pieces" is my family of sprites) would pertain to each individual sprite in the Family, so I could set an event for a sprite at X and Y equaling some other X and Y using a "For each" loop. My problem is, though it might catch that "pieces" member, it doesn't expose the an instance variable I've set in each of the sprites in the family, which total messes up my idea of why a "For each" would be useful... looping to find an object, then querying it for information. Yes it kind of seems to do that, but not to the degree that I need.

Its aggravating that I currently have to explicitly test each position of every "piece", in order to retrieve and use its instance variable to perform other actions. I need a way to loop through a set of objects, which I know I've set that instance variable on, find the one I want, and set the value of that instance variable into an array.... "You can't do that Dave." Anybody have an idea... is there an alternative plugin that will allow this kind of individual object access in a "for each" type of loop? BTW, each object (sprite) is similar, but unique in appearance. The same instance variable is defined on each of these, with the value I need. I guess what I'm trying to stress is, the sprites are not simply clones of some single sprite instance (if I'm describing that properly). Thanks!

[UPDATE] I solved my problem. I first shortened my list of positional checks by doing a "Pick by expression", which allowed me to grab the object I wanted out of my "pieces" Family, at X Y location in one line. Then, I realized that I already had the value I was looking for in an array, at the index I was passing to the function where my processing was. So, instead of depending on the instance variable, I could simply use the value at an array location using an index I was already being passed.
B
5
Posts: 5
Reputation: 235

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests