[r163] Container not used in Set Position to Object

Bugs will be moved here once resolved.

Post » Fri Feb 28, 2014 3:58 pm

Problem Description
The container isn't checked when using the Set position to object action.

The problem is expected because in acts.SetPosToObject in commonace.js, no container is ever checked.
Also the problem needs a specific situation to really be noticeable.
Because in most cases the SOL filtering and the auto pairing (by IID) kind of mask the issue.

Here is my fix proposition:
Code: Select all
         acts.SetPosToObject = function (obj, imgpt)
         {
                var inst;
            
                if(this.is_contained && obj.is_contained) {
                    for(var i = 0; i < this.siblings.length; i++){
                        var sibling = this.siblings[i];
                        if (sibling.type === obj) {
                            inst = sibling;
                            break;
                        }
                    }
                } else {
                    inst = obj.getPairedInstance(this);
                }

            if (!inst)
               return;


setPositionToObject%26container.capx

Description of Capx
When you click on the bluegray square its boolean "clicked" is set to true
If "clicked" is true for any bluegray square, the associated orange square should be positionned to the corresponding bluegray square


Steps to Reproduce Bug
  • click on the bluegray squares in any order

Observed Result
Various unexpected positionning

Expected Result
Each orange square should go to its corresponding bluegray square because of the container pairing

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

Operating System and Service Pack
Win7 SP1

Construct 2 Version ID
r163
Last edited by Yann on Sun Sep 14, 2014 4:16 pm, edited 1 time in total.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Wed Mar 12, 2014 6:59 pm

Closing as won't fix. It's true the getPairedInstance() call does not match up the correct instances in this case. However it's to do with the fact the action takes an object parameter instead of relying on the normal event engine pairing. If you use either the ordinary 'Set position' and pass Sprite.X, Sprite.Y, the pairing works; alternatively just add 'For each Sprite' above the clicked condition. We won't add that workaround code because it would need to be applied to any action using an object parameter, and applying it to just one action would introduce an inconsistency in the engine.
Scirra Founder
B
387
S
229
G
87
Posts: 24,245
Reputation: 192,160

Post » Wed Mar 12, 2014 7:05 pm

@Ashley
Oh ok, got it, I'd actually never noticed that object parameters weren't "container-aware" (:
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511


Return to Closed bugs

Who is online

Users browsing this forum: BackendFreak and 1 guest