how do i distinguish between objects..

  • Hey, first of all I'll state that I am new here, I have been playing around, reading on these forums and read the tuts on this site, and god bless C2 is amazing for that new task I got, thanks for that :)

    My Question, or my misunderstanding goes like this;

    (for short) How do I distinguish between 'object clicked' and 'object spawned' when it spawns on top of 'object clicked' ? it then counts as a click on spawned object.. or is it just me there misunderstood something?

    (for long) I have created a sprite, which functions as a clickable box (no graphics) in for example layer 1, when clicked I trigger an event to create a new object, in layer 2, I make it spawn at Mouse.X and Mouse.Y.

    This new object have its own "clickable subevents", but my first click on the clickable box, triggers this new objects events - and I am trying to figure out why.

    (for illustration) I have a empty box, when I click i spawn a plane, - the plane begins to fly. When I click on the plane, its opacity decreases. My problem is, when I firstly click on the empty box, it counts as a click on the plane, which then 'starts off' on lower opacity than intended -

    Just me? or did I misunderstand something?

    /Nijal

  • Apparently you have to pay attention to the order of the events.

    I reproduced what you said from what you told, here is the working version:

    ClickAndSpawn-working.capx

    Here is a workaround if ever you need one :

    ClickAndSpawn-workaround.capx

    And finaly, here is "the original" as you described and experienced it :

    ClickAndSpawn-surprise.capx

    So as said before, the order of events allows to obtain what is intended.

    Nevertheless I'm wondering Ashley why/how so the plane's on click event gets triggered when creating a new plane, and especially why no object is picked, despite the object being obviously clicked, since it's triggered (when clicking to create a new plane, all present planes on screen get their opacity turned to 99 automaticly, a fading one as a new one).

    Tested on FF 7.0.1

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Brilliantly Kyatric - Thanks

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