clicking is triggering multiple actions, why?

0 favourites
  • 5 posts
From the Asset Store
Click! Click! 136 click sounds for your video games or media projects
  • I have a 'game field' sprite object that is in the background layer.

    I also have a 'cat' sprite object placed within the 'game field' area.

    When I click the 'game field' I want a new instance of 'cat' created at the point of click. (I got that working)

    If I click a 'cat' instance, I want that instance deleted.

    As it it, when I click a cat object, it just adds another cat on top of the previous cat object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You have on clicked on the playfield and the button, since they both overlap you are getting both clicks most likely...

    Or, you need to have something in your logic saying don't do it under certain circumstances. For example placing the object should only work when a variable like "placeable" is true, then when you place the object set placeable back to false so that it doesn't keep happening.

  • so how so you pick an object if this isnt the way to do it? Theres a few posts that mention this, but none that really cover a technique and explain it.

    as an aside...

    I think 'click selected object' action only tests whether a click is within a square. It dosent seem to have any understanding of what object is being clicked on (should be the topmost one), only that mouse.x and mouse.y are within some defined area.

  • If you have more than one object with an on-click event assigned to it, and those objects are overlapping, then you trigger the on-click for each of them.

    So you may want to do something like this:

    On-Clicked Playfield and as an additional condition Not-Clicked Turret1 (Use the invert option for that)

  • ahhhh interesting, will give that a try, ty

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