[108 to 112]Drag and Drop Behaviour, minor bug

0 favourites
  • 4 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • ok. Let's see I can express the problem properly here as there are more steps and strange behaviour involved.

    CAPX: dl.dropbox.com/u/14087254/DragAndDropBug.capx

    The design

    The sample uses a dual analog setup for testing purposes. The intention is that upon pressing the large circular area(pad). The DnDB object(stick) is moved to the touch position and then proceeds to have the DnDB object dragging condition.

    Problem

    The Drag and Drop Behaviour(DnDB)if placed into a folder for sorting will not achieve the desired above results. the behaviour object will be moved to the touch position, but will not be put into drag mode.

    Steps to produce

    Test A(working)

    run game

    put a finger on the either large circle.

    Move finger around.

    DnDB moves with finger as it is in "is dragging" state.

    Test B(not working)

    In the events. Put either stick1 or stick2 into the "PUT_STICK_IN_HERE_TO_BREAK" sub folder.

    run the game

    touch either large circle

    move finger around

    DnDB object does not move with finger as the object "is dragging" was not set. :(

    There are two results from this

    1. the object does not switch to dragging

    2. Even if there is only one DnDB object. No other DnD objects will work.

    I hope I expressed this correctly. I left two test cases inside to show that it doesn't matter which DnDB object is in a subfolder. As it does continue to affect others that are not.

    Chrome, FF, Opera

    Android Browser and Chrome, IOS Safari 5 and 6

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can't reproduce in r112; works identically whether the objects are in a folder or not. Folders are not actually exported to the runtime, they only exist in the editor for organisational purposes. Therefore running the game should produce identical results regardless of folder organisation, and this is consistent with what I see. Can you provide any more details about the problem? It appears it is not related to the folders, but it could be caused by something else you've done and not mentioned here.

  • Interesting, but ok. I think there was a step I missed. I agree. I wouldn't think it should have any effect on it at all. Though the result seems to occur on all my devices I test with.

    I made the capx simpler just to show a single sample rather than show that it seems to effect all the DnDB objects. I moved the controller stick off for the testing purpose and I put the stick in the folder.

    same location, same file name, but modified

    CAPX: dl.dropbox.com/u/14087254/DragAndDropBug.capx

    Not working sample(default)

    put finger(mouse) on large grey circle(not the red stick)

    Red stick will move to finger(working)

    move finger. The red stick does not follow(not working)

    Working sample

    Take stick1 out of folder

    run sample

    put finger on large grey circle.

    red stick moves with finger.

    It's important that what is being pressed is the large grey circle and not the red stick. Pressing the large grey circle moves the stick to the finger and starts the drag and drop.

  • Ah, I see what is happening now. Your events conflict with the Drag & Drop behavior. DnD automatically handles mouse clicks and starts dragging the object. Your events move the object with the DnD behavior on a click. So now your events depend precisely on the order of whether the event or the behavior receives the click first:

    If the event receives the click first, it moves the object under the mouse. Then DnD receives it second, sees the object is under the mouse, and starts dragging it.

    If DnD receives the click first, it notices the object is not under the mouse, so ignores the click and does not start dragging the object. Then the event receives the click and moves the object under the mouse, but it's too late, DnD has already decided not to drag it.

    You should not depend on the order of events like this, it's undefined by design. Basically, don't create events that conflict with the automatic handling done by behaviors. Rearranging the objects in the object bar can change the order in which events are received, which you shouldn't depend on anyway. Workaround: don't use a behavior, just code the events to move the object yourself. Closing as won't fix.

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