[R240] Dropping check issue

0 favourites
  • 5 posts
From the Asset Store
Now you can drop everything in your game with sound :)
  • Problem Description

    I'm working in an inventory system similar to Diablo system, where the player is able to drag the item over a slot and drop it in the inventory or on an equipment slot.

    The issue happen when I check if the item was dropped over another item. I'm trying to check the bottom item and set its position to the old position.

    In this CAPX I isolated the checking events.

    Attach a Capx

    https://dl.dropboxusercontent.com/u/470 ... _drop.capx

    Description of Capx

    This capx is designed to pick the bottom item when the user drop the one item over another;

    Steps to Reproduce Bug

    • When you pick one box, it will be placed on the layer top;
    • While dropping it will trigger a check:
    • If the item is overlapping another item, it will pick the bottom item and set the Global variable with its UID;

    Observed Result

    Nothing happened, the trigger didn't worked properly but the event happen;

    Expected Result

    Object is overlapping another object should trigger because it's true before the drop, but it's not.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    Windows 10 last updates installed

    Construct 2 Version ID

    R240

  • That is not a bug, sir.

    The trigger 'On drop' picks 1 sprite. The dropped sprite. So, at this moment the Selected Objects List (picklist) contains 1 and only 1 sprite.

    All sub conditions start picking from that fresh picked Selected Objects List. (fresh because it is a top level event)

    There are no other sprites in that list to pick from.

    So when you check the overlap in a sub condition, there are no sprites to check for, except that 1 dropped sprite.

    Overlap with itself is not reported.

    So, at this point the newly Filtered Selected Objects List (That started from that Previous Selected Objects List, containing 1 sprite) is now totally empty.

    As a result, that overlap condition is untrue, and it will not run any actions and sub conditions.

    Plz read this.

    https://www.scirra.com/manual/75/how-events-work

  • Thank you for the tip, it's hard to understand this behavior...

    I'm placing everything in variables and checking them to avoid it again =\

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use Functions, because functions start picking from scratch.

    You can use (under some circumstances) the system condition 'pick all' to broaden the picklist.

    But besides that, you are working with instances of the same object. And that should have a sub forum already.

    https://www.google.be/search?num=50&new ... scirra.com

    But, to make a long story short. It is just the way how Construct works. Once you understand it, you will love it.

    Conditions pick, actions work on the picked items, sub conditions start picking from the previous picked items.

  • Thank you! I already figured out how to work properly by checking the overlapping and setting variables, them picking the object by the UID using the stored variable to work with =]

    By the way, you opened my eyes, it's kinda different from Unity in many ways =\

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