action to object with value on collision?

0 favourites
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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?

  • 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.

  • 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

  • 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.

  • 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?

  • can someone help me please ? there is example .capx 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 <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad" />

  • 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.

    goo.gl/NIVfz9

    There is a space added because the forums removes the URL

    If that doesn't help, let me know. Good luck! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

  • 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! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    link briken 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.... ((((

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • 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

  • A pick with evaluation action should do the trick.

    Try the Capx I have linked below:

    goo.gl/LPOZNq

    EDIT: Fixed URL

  • A pick with evaluation action should do the trick.

    Try the Capx I have linked below:

    https://goo.gl/LPOZNq

    EDIT: Fixed URL

    Nooo, this not work, it give action to center sprite, i dont need give action to it i need check collision to it and give action to all others that directly collide to it. It makes center sprite opacy 50%, i need conneted sprites to it become 50% and dont touch others that not have direct collision to flag =1.

    I need do that (i set opacy manualy to show):

    its that to hard to do?

  • I don't think it is too hard, no. But I couldn't understand what you need and the CAPX wasn't really enough. After all I am only trying to help.

    Here is a method to do this:

    goo.gl/c0u2gy

    I cloned the same object and only changed the flag and its name. So they are 2 objects now (Flag0 and Flag1) but both look the same. Now you can just do a collision check and from that check you can do whatever action you want.

    If you don't like this method, I suggest you wait for someone else's answer. Good luck!

  • I don't think it is too hard, no. But I couldn't understand what you need and the CAPX wasn't really enough. After all I am only trying to help.

    Here is a method to do this:

    https://goo.gl/c0u2gy

    I cloned the same object and only changed the flag and its name. So they are 2 objects now (Flag0 and Flag1) but both look the same. Now you can just do a collision check and from that check you can do whatever action you want.

    If you don't like this method, I suggest you wait for someone else's answer. Good luck!

    thanks, i need use 1 object i plan add many data to it, and this example shows how limited contruct 2 is.

  • I think it is more a limitation of my knowledge than Construct 2 itself. I would suggest waiting till someone else notices the thread and tries to help.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)