Picking/filtering instance issue(s)

Get help using Construct 2

Post » Thu Aug 21, 2014 12:59 am

Hey there,

I got a few issues with filtering instances. I joined two .capx files to show what I'm trying to do.

In the first case, I'm trying to create an object (blue) to another object's (red) position after a short loading animation. Of course, I want to create blue over only one instance of red, not on every instances of red...but it doesn't work (see .capx).

The second case is a sort of cheat codes system in which you enter the name of any object in a family into the editBox, followed by "=0". Every object in the family has got its name stored in an instance variable (family instance variable of course), and I ask the editBox to compare which name was entered, followed by "=0" as it's part of the cheat code, and then I want that very object to become invisible when you press the button to send the cheat code. Doesn't quite work either... (see .capx)

Any idea? Or is what I'm trying to do even possible with the way Construct 2 is designed?

Thanks in advance.
You do not have the required permissions to view the files attached to this post.
B
11
S
3
G
3
Posts: 206
Reputation: 2,379

Post » Thu Aug 21, 2014 1:06 am

Your events are backwards in CreateObject...
And you need to explicitly pick the matching objects in the other.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Thu Aug 21, 2014 2:24 am

CreateObject : So the events have to be in that order, ok... Why that actually?

PickingByVariable : Nice! I should have thought of that! Thanks a lot! :)
B
11
S
3
G
3
Posts: 206
Reputation: 2,379

Post » Thu Aug 21, 2014 2:37 am

Yours:
Event1 asks: are any loading sprites overlapping Red -> answer, yes (all of them do - each 'loading' overlaps each Red))
Event2 triggers when you click on a Red. The actions are: set 'loading' to Visible (but that is all of them, you have not picked the one that is overlapping the Clicked Red, you've by default picked all 'loading'.)

Mine:
Event 1: pick the Red that is clicked -> that is the single clicked one.
Event 2: pick the 'loading' that overlaps the one Red. Action: set that one picked 'loading' to Visible, etc.

Triggers occur outside of the C2 script/loop, so in general you want these at the top level, and then refine from there.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Thu Aug 21, 2014 2:49 am

Ok, I understand better. As I thought, triggers like mouse clicks seem to be "higher priority" conditions.
Still I thought that sub-events inherited conditions - and the according filtering/picking - from the main event.

Thanks a lot anyway. :)
B
11
S
3
G
3
Posts: 206
Reputation: 2,379

Post » Thu Aug 21, 2014 2:52 am

They do, but there was no filtering from the main event.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Thu Aug 21, 2014 1:54 pm

Ok, I've played with the CreateObject example again, and I'm running into another issue. Now instead of different instances of the same object (red), I got a few objects from the same family, and my conditions imply checking which one is clicked and if a loading-object overlaps it (as before), but they also check what are the state of its instance variables. I don't know if that's an issue with the multi-filtering, but it's not working once again (see .capx).

Hopefully you or anybody else can help, and if so thanks in advance.
You do not have the required permissions to view the files attached to this post.
B
11
S
3
G
3
Posts: 206
Reputation: 2,379

Post » Thu Aug 21, 2014 2:08 pm

You are still Creating Blue at red.x/y. Needs to be Family1.x/y
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Thu Aug 21, 2014 2:42 pm

Yeah, of course... Thanks for pointing it out. Now it works.

But for some weird reason it doesn't work in an identical situation in an actual game I'm trying to develop. I created the example .capx cause I didn't want to have to post my actual game in here. Can I P.M. you?
B
11
S
3
G
3
Posts: 206
Reputation: 2,379

Post » Thu Aug 21, 2014 3:21 pm

Yes, that's fine.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494


Return to How do I....?

Who is online

Users browsing this forum: mariusvm and 13 guests