Overlayed sprites, on click event

  • Hi,

    I have a problem with the click event on overlayed sprites.

    I have a sprite that works as a background of a section of the page, with other several sprites over that background: every time I click on the background an error function should be triggered, if I click on another sprite, instead, e success function should be triggered.

    The problem is that the click event trigger the success function AND the error function.

    I figured out some tricks to avoid this, such as write a condition like

    "click on background

    and

    not click on other sprites"

    In this case the actions should be performed only if the click event was triggered on the background only.

    In any case this fix isn't a real solution, because if I have a lot of different sprites with several different functions the amount of conditions will increase very badly.

    Is there any way to stop the propagation of an event only to a given sprite?

    I simply want specify a set of actions to be performed if the top sprite is clicked and a different set of actions to be performed if only the background sprite is clicked.

    Any ideas?

    Thank you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is a condition "Pick top/bottom instance", but it works only for 1 type of object at a time. In your case, you should do something like this.

    Just specify what object you want to pick first, else the next one, ...

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