0 Favourites

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

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

    [attachment=0:3l90wfat][/attachment:3l90wfat]

    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!

  • Maybe good use of Pick condition (System ->Pick instances) could work.

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

    [attachment=0:3o32i61q][/attachment:3o32i61q]

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

    [attachment=0:3m3e6o8e][/attachment:3m3e6o8e]

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

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

    [attachment=0:1t0j0ka1][/attachment:1t0j0ka1]

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Wicked.... thanks Paradox! That'll help out immensely.

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