How do I check the overlap of the same object, but diff inst

Get help using Construct 2

Post » Tue Dec 23, 2014 2:41 pm

Ok, so I have two enemies that I do not want to touch each other when they fall... without using solid objects, as I'm using a drag and drop feature... so I have this setup:

Enemy Object, with 4 instances on the screen
if Enemy IS overlapping Enemy at offset (0,8) then change ONLY THIS instance variable "me" to 1
else continue to fall

Problem is... it'll changes the instance variable of "me" of the other object to 1, instead of the other.... or both... is there a way to fix this from happening?

Attached is an example that describes this problem... if you see in the code, it's set to make the instance "false" when it overlaps... but all it does is makes the one it overlaps false, but not both... it's complicating, but hopefully you can see what I mean in the example. Right click on the screen to spawn more 'falling' enemies. The ones that are there at start up, fall... and then change their variables properly... but the ones you create at startup, have no idea what's going on when it comes to changing themselves when they fall on top of another object, only the 'ground'... even though the code is in there. Try dragging and dropping around the ones that already hit the ground... notice they no longer fall? Now try a spawned object that hasn't hit the ground, but hit another object.... it SHOULD behave the same way, but instead, it continues to fall.

1.capx


There has to be a way to interact with two different instances of the same object when using conditions\actions... right?

I'm thinking more of a define option, like this maybe, for times when you using the same object:

Condition:
Object(0).Click (btw, I know it's easy to select a specific iid here)

Action:
Create-> Object(1) (but there is no way to grab the iid here, and use it in the next action, as you can see)
Set position (Object(1) to Object(0).x+200 & Object(0).y+0) (at this point, "Object" is now ONLY using the newly created one)
Delete Object(0) (continues to use the newly created instance)

Is this at all possible? This would be amazing.... cause instead, what this does (without the possibility of the bold'ed items) is deletes the object you JUST created.

Thanks!
You do not have the required permissions to view the files attached to this post.
B
47
S
15
G
3
Posts: 201
Reputation: 4,625

Post » Tue Dec 23, 2014 5:29 pm

Maybe good use of Pick condition (System ->Pick instances) could work. ;)
B
13
S
4
G
2
Posts: 14
Reputation: 2,324

Post » Tue Dec 23, 2014 6:39 pm

Change event 7 from an Else to a condition that picks overlapping blocks. "Else" wasn't picking.

stopdrop.capx
You do not have the required permissions to view the files attached to this post.
B
230
S
62
G
33
Posts: 902
Reputation: 40,319

Post » Tue Dec 23, 2014 6:52 pm

Paradox wrote:Change event 7 from an Else to a condition that picks overlapping blocks. "Else" wasn't picking.

stopdrop.capx



Now when it hits the ground, without it hitting a red block, it thinks it's still "falling"

Ninja edit: actually, what I meant to say is, if you drag and drop any of the items, then try creating a new one by right clicking, they don't behave properly....
B
47
S
15
G
3
Posts: 201
Reputation: 4,625

Post » Wed Dec 24, 2014 7:22 am

Hmm, not sure why moving one is changing what happens, but I may have fixed it by making event 7 an OR block, and having it check for ground as well.

stopdrop.capx
You do not have the required permissions to view the files attached to this post.
B
230
S
62
G
33
Posts: 902
Reputation: 40,319

Post » Wed Dec 24, 2014 2:53 pm

Wicked.... thanks Paradox! That'll help out immensely. :)
B
47
S
15
G
3
Posts: 201
Reputation: 4,625


Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish and 15 guests