Drag and Drop breaks when used on Family?

0 favourites
  • 14 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • The exact code below used to work perfectly when it was referencing an individual Card object. Now that we've changed the Card object instead into a Family (Cards) of Card objects, it no longer functions. In trying to debug it, we're noticing that the On Drop condition seems to not co-exist well with the other conditions, but as previously stated it was working fine before switching to a Family.

    Any ideas?

  • Does the family have any other behaviours?

  • drag and drop will fail in 1 certain situation as far as i know. if you set the position of an object by events while dragging it will cause drag and drop to fail. other conditional logic shouldn't affect it unless some conditions returns false which will basically not happen since the condition logic you have is not meet.

    based on your conditional logic they should work, however they might fail on calling the function and execution and their respective actions

  • Only other behavior is Tween.

    There might be a clash of other conditions / executions in a different part of the code...but oddly, when I remove the additional conditions and just have it execute On Drop - it all works. So that's why it makes me suspicious that it is the combination of the conditions together that is causing some weirdness.

  • but oddly, when I remove the additional conditions and just have it execute On Drop - it all works.

    This likely means that one of these conditions is false when "On drop" happens. You can disable one condition at a time and find which one causes the problem. Then investigate why it can be false.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah makes sense, was working on this late the other day, but from what I remember it failed when any of them were toggled on no matter which one I chose.

  • Yeah makes sense, was working on this late the other day, but from what I remember it failed when any of them were toggled on no matter which one I chose.

    Hi if you read what i typed, you will narrow down the issue, the problem is in the function calling. there is a pause between each function you call, therefore make sure to rearrange them.

    this sounds like when the drag and drop conditions happen, the 1st function call will disable one of the conditions and the other 2 remaining in the action list will not trigger.

  • this sounds like when the drag and drop conditions happen, the 1st function call will disable one of the conditions and the other 2 remaining in the action list will not trigger.

    I may have misunderstood you, but if you are talking about the screenshot in the first post, there is no way the first function can disable the remaining two. All conditions are evaluated first, and if they are all true, then all actions will be executed. So all 3 functions will run one after another, without any pauses. Even if one of the functions changes the variables used in conditions, it won't matter, because they have already been evaluated.

  • I may have misunderstood you, but if you are talking about the screenshot in the first post, there is no way the first function can disable the remaining two. All conditions are evaluated first, and if they are all true, then all actions will be executed. So all 3 functions will run one after another, without any pauses. Even if one of the functions changes the variables used in conditions, it won't matter, because they have already been evaluated.

    Hi Doop, you understood me correctly, i was thinking the 1st function call can disable some conditional logic parameter before the 2nd function or 3rd fires up, i know it shouldn't happen as you said, since that execution was already evaluated, but strangely enough in C2 this would be a regular thing that happened. and i was thinking that issue would've passed on to C3 as well... since nobody knew what would be the cause at that point... this sounded to me as a good reason .. hi hi ! ^_^

  • No, I don't think this could happen in C2 either. One possible scenario when the first function could stop the other two from running is if it deactivated the group with those two functions. Or if the same conditions are checked again inside the two functions.

  • The only possible scenario when the first function could stop the other two from running is if it deactivated the group with those two functions.

    hehe, you just answered it yourself... what is a group? (just a toggle value 1 or 0/checkbox)

    what is a conditional logic locked not equal to zero? or equal to false? same thing... so if in the 1st function call those 2 conditions change before the 2nd or 3rd function call fires up... they will not fire.

    Edited: this is based on the function method of action... if you remember in Construct in order to have events/action act like function calls we have to do a wait 0 so next set of actions wait for above to complete then fire up ... but in functions... that wait 0 happens by default.. this will cause the other 2 functions to have time to re-evaluate the conditions that fired them in 1st place. (this is main reason i don't use functions... )

  • Edited: this is based on the function method of action... if you remember in Construct in order to have events/action act like function calls we have to do a wait 0 so next set of actions wait for above to complete then fire up ... but in functions... that wait 0 happens by default.. this will cause the other 2 functions to have time to re-evaluate the conditions that fired them in 1st place. (this is main reason i don't use functions... )

    I'm sorry, but I don't think what you are saying is correct.

    In any event actions and sub-events are executed from top to bottom. Functions are no different. They don't add any "wait 0" to the execution order. (unless you are using asynchronous functions and specifically wait for them to complete)

    And any conditions are evaluated only once, except when in loops.

  • I'm sorry, but I don't think what you are saying is correct.

    In any event actions and sub-events are executed from top to bottom. Functions are no different. They don't add any "wait 0" to the execution order. (unless you are using asynchronous functions and specifically wait for them to complete)

    And any conditions are evaluated only once, except when in loops.

    yes you seem to be correct, i just tested my "understanding" doing what i was saying, the functions do call up correctly even if in 1st function call i change 2 conditions to not fire the functions in the list ... weird i can swear what i was saying was happening ... but it seems is as you said, when we actually wait for them specifically to complete, or in loops. sorry for dragging it out to much, this was actually really refreshing, i understood something new on functions hehe ...

  • This happens to me all the time. I still regularly discover that something in construct works differently from how I imagined it :)

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