[Suggestion] Compare Instances of Same Object

Discussion and feedback on Construct 2

Post » Wed Dec 11, 2013 10:48 pm

I'm trying to set up some events that compare the conditions of instances of the same object.

For example, say I have two square instances. For all intents and purposes, they're the same. However, their instances variables may have different values and their coordinates will likely not be the same, and so on.

I need a way to identify and compare two instances of the same object.

So, say Square(1) has an instance variable value of 10.
I need to way to check and see that if any OTHER Square(n) overlaps that Square(1), those OTHER Square(n) instances will have their variable set to 10, as well.

Hopefully that's clear enough. If not, I'll give a more specific example from the game I'm making.

UPDATE:
Here's an example of the kind of feature I'm looking for...
We have the Pick By Comparison event.

Object: [select]
Expression: [...]
Comparison: < , > , == , =/= ...so on
Value


That usually works when comparing two different objects or properties of a single object.

What I'm looking for would look more like this

Object: [select]
Instance one expression or value: [...]
Comparison: [...]
Instance two expression or value: [...]


Because right now, when I'm comparing two instances of the same object, whether by Overlap, Pick By [...], For Each... I'm still running into problems in trying to identify each instance when needed within the larger comparison and testing.Rhindon2013-12-11 22:59:12
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 793
Reputation: 15,157

Post » Fri Dec 13, 2013 4:31 am

[bump]
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 793
Reputation: 15,157

Post » Fri Dec 13, 2013 5:20 am

You can use Families for this. It's been discussed before, so there should be as thread you can search on. You pick one as the base object and the second as a family object. Now you have both picked at once.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Fri Dec 13, 2013 5:50 am

@blackhornet - Huh. So... Do something like "Pick Family" then "Pick Object Instance In Family"?
Something like that?
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 793
Reputation: 15,157

Post » Fri Dec 13, 2013 6:40 am

No. Have a look at this thread:
RecursiveLineDrawing
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Fri Dec 13, 2013 1:15 pm

Or you can use 'Pick Nth instance' and local variables.
Scirra Founder
B
403
S
238
G
89
Posts: 24,660
Reputation: 196,167

Post » Fri Dec 13, 2013 8:55 pm

@Ashley - I've been trying that, but I keep running into issues how how to do...
-> Pick object instances that meet these two criteria.
-->> From that selection, further pick from those instances.

@BluPhaze made a suggestion similar to what you're saying on the Facebook group. I'll give it a shot.

@blackhornet - Thank you, sir! As always, you're a tremendous help!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 793
Reputation: 15,157

Post » Sat Dec 14, 2013 5:22 pm

Why is that a problem? You can just keep adding conditions to further filter it down.
Scirra Founder
B
403
S
238
G
89
Posts: 24,660
Reputation: 196,167

Post » Sat Dec 14, 2013 7:51 pm

Considering that:
A: there can only be two objects in a collision, and
B: the likelihood of of said objects occupying the same point at collision is very small. You can then assume that "Pick closest to" 0x, 0y, and "Pick closest to" layoutwidthx, layoutheighty, would pick each object separately.
Image ImageImage
B
172
S
50
G
184
Posts: 8,445
Reputation: 116,109

Post » Sun Dec 15, 2013 3:28 am

@newt - Hmmm...that makes sense, but I'm having trouble conceiving it in my head as to how I'd do it in C2.
Anyway, someone suggested I use the tilemap as an alternative. I'm going to give that a shot.

@Ashley - Mighty good question, sir. Heck if I have a good answer. I've been struggling to filter things down, but I suspect that my lack of understanding of all the finer points of how each action and event works (behind the scenes) is making it hard for me see what will or won't work.

It's rather like when I learned just how For/For Each work. I THOUGHT they worked one iteration each tick. Turns out, as I learned later, they work until done, even if that means several iterations per tick. At least, that has been my understanding of late.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 793
Reputation: 15,157

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests