[R240] Dropping check issue

Bugs will be moved here once resolved.

Post » Fri Dec 09, 2016 9:01 pm

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
Image
B
106
S
23
G
17
Posts: 1,356
Reputation: 22,135

Post » Fri Dec 09, 2016 11:18 pm

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
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Dec 10, 2016 1:23 am

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 =\
Image
B
106
S
23
G
17
Posts: 1,356
Reputation: 22,135

Post » Sat Dec 10, 2016 10:42 am

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Dec 10, 2016 1:06 pm

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 =\
Image
B
106
S
23
G
17
Posts: 1,356
Reputation: 22,135


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 4 guests