Enable Effect ONLY on the specific instance I drag ?

  • Hi All,

    I have 2 Outline Effects: "Outline" (for mouse cursor OVER) and "Outline2" for Dragging.

    As you can see on the example C3 file:

    When the mouse cursor is over ANY instance of the "Created_Objects" Family it enables "Outline" effect ONLY on the TOP picked one. no more than 1 instance is affected.

    BUT! when dragging an instance while it's overlapping other instances, they will ALSO enable the effect... and this is what I would like to solve.

    I would like the same result as mouse cursor is over any instance, BUT whlie dragging, means:

    I want ONLY 1 instance to have outline at a time.

    To SEE the issue on action, just DRAG an instance OVER any other instance... as you can see, it will also act as "mouse cursor is over" which I failed to solve.

    DOWNLOAD Example C3 File

    Please have a look at the attached C3 project and try to help me out, also if you can add explanation of how you solved it, it will be very helpful for me in my learning journey while looking at your solution.

    Thanks ahead!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this:

    Object is Dragging -> Object set outline effect
    
    Else 
     Mouse cursor is over Object -> Object set outline effect
    
  • Thanks for the quick reply dop2000 :)

    I think I got lost trying to understand where to put your code or replace my last part of the code with it (which I tried) also I didn't understand which outline effect to use because the 2 must cancel each other when one is working like in the example when mouse cursor is over. (beside the drag issue I try to solve).

    I did some tests before I replied but they turn into guesses... which is what I made me post this thread originally.

  • OK, so I came up with this other simple solution which uses the left mouse button down.

    From a rough few tests it works, but anyone think it's a stable solution for my purpose, or I may ran into issues with this way later on?

    The reason I ask this because I truly not sure if I'll have problems later, but it's the only way that I could make it work (yes, I'm a C3 noob I can only do VERY basic code as you can see).

    This is my current (work for now) solution:

    Any tips / advice related to this? (based on my first thread where I describe the problem)

    Thanks ahead!

  • Why don't you just try replacing your code with what I suggested and see how it goes? Should be something like this:

  • Why don't you just try replacing your code with what I suggested and see how it goes? Should be something like this:

    Sorry for the late reply, I appreciate your help as always :)

    The reason I use my code above and not your example is mainly because it won't solve the "outline2" issue I mentioned but only "outline" while my current code makes it work.

    Also I made that the right button won't drag to make sure won't work but only the left button.

  • Sorry, I don't understand what issue with outline2 do you mean. Please see this file, both outlines work and I added an event to disable dragging with right mouse button:

    dropbox.com/s/ls9yx2fi43f4ig0/ONE%20Selection%20ONLY%20Tests%20-%20v1.c3p

  • Sorry, I don't understand what issue with outline2 do you mean. Please see this file, both outlines work and I added an event to disable dragging with right mouse button:

    https://www.dropbox.com/s/ls9yx2fi43f4ig0/ONE%20Selection%20ONLY%20Tests%20-%20v1.c3p?dl=0

    Nice! this new code you changed on the file makes it work because you address also "outline2" unlike the other screenshot code you forgot about it, so it didn't work.

    It seems like your current code is more efficient than mine, shorter but basically what I did with the right button disable on different group. I have so much to learn! thanks again dop2000 :)

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