Check if an object is covering another object?

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I saw a topic on the forum about this from twelve years ago but it was unresolved, so I'll try my luck again:

    I'll try to be concise. I need to do a dishwashing game. For that, the player lathers and covers with bubbles the objects given to him. No problem there. The issue comes when I need the game to check if the object (for example, a pan) is covered entirely, or at leats a 90% of its area, by those bubbles to mark it as completed and proceed to the next object.

    Can this be done in some way, or should I take another approach?

    Tagged:

  • Here's one way of doing it:

    dropbox.com/s/2ooh1o99entx1z2/dishwasher.c3p

    In this example I create a grid of dirt objects that cover the pan - these are invisible, but will be used to track how clean the pan is.

    There are two instances of the object, one with a dirty animation overlaying a another with a clean animation. As you move the mouse over the pan I repeat-spawn a mask object to hide the dirty version wherever it's spawned (using destination out effect), gradually revealing the clean one. Any dirt objects overlapping the mask object are destroyed - a tally is kept and when all have been destroyed the pan is 100% clean.

    Bubbles are created - I have these draining off but if you want them to remain you can disable their bullet behaviour.

    There's a more detailed explanation in the project comments.

  • Wow!! Thank you SO much for taking the time to even do an example! It's trully helpful. I was honestly not expecting a response :) Or at leats, not that fast.

    In the end, as a temporary measure, I managed to do it with a different approach as I mentioned (just spawning some dirt spots and checking when all of them got detroyed), but I will change to yours as it is more like I envisioned at the beggining.

    And again, thank you!

  • No problem :-)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Had another thought about this over night; instead of spawning loads of mask objects, you just use one that tracks the mouse and paste it to a drawing canvas object positioned over the dirty version of the pan - The canvas uses the destination out effect instead of the mask, and the mask is set to invisible.

    Here's an example:

    dropbox.com/s/x7njq8iru5x32m2/dishwasher01.c3p

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