action to object with value on collision?

Get help using Construct 2

Post » Wed Mar 16, 2016 4:52 pm

i need give action to object that collide with other same instanse object with different value.
i try all, nothing works, when i use conditions,or,and or sub condition, i can give actions only to objects in conditions... i can give actions only to all objects that overlapping-collide, no multi rules or rules inside rules?
for example : i have 40 sprites clones of same object, some of them have value flag 1 other 0, i need give action only to object that overlapping-collisions with flag 1 and have flag 0, and left others that do not collide with it.
how to do that?
B
5
Posts: 12
Reputation: 251

Post » Wed Mar 16, 2016 5:56 pm

I can't at the moment test my theory, but if I recall correctly, you can use one of the below solutions:

> On Collision with Object X
----> For Each
-------- > Compare Variable Flag = 0

Do actions.

That or instead of using "For Each" you can use Pick All Comparison and add in an expression: object.flag and equal to 0 or 1.

Hope that helps.
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Wed Mar 16, 2016 6:26 pm

Vallar wrote:I can't at the moment test my theory, but if I recall correctly, you can use one of the below solutions:

> On Collision with Object X
----> For Each
-------- > Compare Variable Flag = 0

Do actions.

That or instead of using "For Each" you can use Pick All Comparison and add in an expression: object.flag and equal to 0 or 1.

Hope that helps.

that problem, compare flag = 0 not enought, need also comparsion to collided object that must have flag 1, if i do like you say its select all objects with flag = 0 if only one collide to flag 1, i need select only object with flag = 0 that directly collide with flag=1
B
5
Posts: 12
Reputation: 251

Post » Thu Mar 17, 2016 7:10 am

In that case do two conditions:

-----> Compare Variable Flag = 0
AND (right click on the slot above and select "Add Another Condition").
------> Compare Variable Flag = 1

Now you can compare the flags as you wish.
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Thu Mar 17, 2016 8:46 am

Vallar wrote:In that case do two conditions:

-----> Compare Variable Flag = 0
AND (right click on the slot above and select "Add Another Condition").
------> Compare Variable Flag = 1

Now you can compare the flags as you wish.


if i do 2 comparsion-condition merged it give negative result, there will be no object because it cant be flag=0 and flag=1 in same time... and if i do and, or, or separate subconditions i also cant select because object will filter by first condition.
I can do - if object with flag=1 collide to object, and cant do - if object collide to object with flag=1,
, seems its just imposible, how it can be that hard?
B
5
Posts: 12
Reputation: 251

Post » Thu Mar 17, 2016 9:05 am

Message: seawall can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
can someone help me please ? there is example .capx http://ge.tt/4rgpnvY2 , need make sprite objects that collide center sprite opacy 50 and do nothing that not collide with flag=1 directly, nothing helps :(

Image

Image
B
5
Posts: 12
Reputation: 251

Post » Thu Mar 17, 2016 9:15 am

Message: Vallar can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I am trying to understand exactly what you are trying to do and I am not sure I fully understand it.

So here is a little CAPX that might help with collision detection based on an instance variable.

https://goo.gl/NIVfz9

There is a space added because the forums removes the URL

If that doesn't help, let me know. Good luck! :)
Last edited by Vallar on Thu Mar 17, 2016 9:31 am, edited 1 time in total.
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Thu Mar 17, 2016 9:22 am

Message: seawall can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
Vallar wrote:I am trying to understand exactly what you are trying to do and I am not sure I fully understand it.

So here is a little CAPX that might help with collision detection based on an instance variable.

https://www.dropbox.com/s/ z0f9kv2rdezjh ... .capx?dl=0

There is a space added because the forums removes the URL

If that doesn't help, let me know. Good luck! :)

link briken https://www.dropbox.com/s/z0f9kv2rdezjh ... .capx?dl=0 its insert ... can you pust link in short way or two parts?
i just need give action to object if its collide with object that has value 1, program allow give action only to first object, because its same object i need check values on object that coolide with object that i need add action.. program dont allow do that it not have multi rules or rules insade rules, if you do condition it will filter all others object from it, and it allows do condition values check only to firs object not second that need to check.... ((((
B
5
Posts: 12
Reputation: 251

Post » Thu Mar 17, 2016 9:33 am

I think your actions need to change. Remove the "For Each" and have it like that:

> On Collision with Sprite:
----> Compare flag = 0 ::::> Set opacity to 50
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Thu Mar 17, 2016 10:35 am

Vallar wrote:I think your actions need to change. Remove the "For Each" and have it like that:

> On Collision with Sprite:
----> Compare flag = 0 ::::> Set opacity to 50

if i do that it set opacy 50 to all sprites that have collision and have flag=0, and i need only set opacy if it collide to sprite with flag =1
B
5
Posts: 12
Reputation: 251

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 18 guests