[Solved]OR blocks are broken

Bugs will be moved here once resolved.

Post » Fri Jul 03, 2015 1:48 pm

Problem Description
Or blocks are broken.

Attach a Capx
Here

Description of Capx
2 Sprite objects, Events - If Layer 1 is not visible OR Sprite.var=1 - Rotate Sprite and Sprite2, Layer 1 is not visible and Sprite.var=0 from the start.

Steps to Reproduce Bug
  • Open capx
  • Start preview
  • Sprite is not rotating, but Sprite2 is rotating, only half actions happened.

Observed Result
If in OR block, "Sprite.var=1" or any other condition that picking Sprite is not True, then all Sprite instances will be un-picked in the whole OR event and it's subevents.
Layer 1 is not visible, means a condition from or block is true, but not all actions in or block happened, only Sprite 2 is rotating, Sprite is not. All actions happen only if all conditions are true, or only Sprite.var=1 is true, or if i put Pick All Sprite event under OR block, but not if Layer 1 is not visible is true.

Expected Result
It's not right to un-pick all Sprite instances, and don't apply actions for them, if in OR block "Sprite.var=1" condition (or other picking condition for this object) is not True, but other conditions are True. If a picking condition is not True in OR block, this condition should not do anything, not pick any instances, and not un-pick them. Why is this picking 0 instances if "Sprite.var=1" is not true?
Since the event says rotate both sprites if any condition is true, and the 1st condition is true i want it to rotate both sprites.

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

Operating System and Service Pack
Windows 7

Construct 2 Version ID
r209
Last edited by Sisyphus on Fri Jul 03, 2015 10:02 pm, edited 5 times in total.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Fri Jul 03, 2015 2:54 pm

This seems to work as intended though.

Your object compare variable works as a picking variant in combination with the OR.
Seeing how the object does not have the same value as in your event, it just picks the one.


If you change it to a: System, compare 2 variables, it works how you want it to work.
Or
If you change the 1 to 0 in your events (not compare 2 values), it also uses the object with var = 0
Or
IF you copy your lightblue sprite, and give it var = 1 it will rotate too.



I think this stems from a misunderstood expectancy.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Fri Jul 03, 2015 4:06 pm

I think that you could reasonably argue that if the OR block returns True then both of the sprite objects should be rotated - there should be no picking unless the True condition was also an object filter...

:/
A big fan of JavaScript.
B
76
S
20
G
73
Posts: 2,241
Reputation: 45,956

Post » Fri Jul 03, 2015 4:11 pm

Colludium wrote:I think that you could reasonably argue that if the OR block returns True then both of the sprite objects should be rotated - there should be no picking unless the True condition was also an object filter...

:/



Its combined in this situation, normally, if you use the event by itself, object.var =1, then the object would not get selected and not rotate either.

The correct method of use would be to use the system compare two values, to avoid the object selection.

The expectancy here is that the object.var = 1 should work as a compare function ... which it is not.
There is a clear, compare two values, option for that.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Fri Jul 03, 2015 4:32 pm

@lennaert Yeah, i see that this is a problem with picking, not with or blocks itself, but the problem is

Your object compare variable works as a picking variant in combination with the OR.
Seeing how the object does not have the same value as in your event, it just picks the one.


It doesn't pick anything at all, and replacing the "compare with object picking" with "system - compare two values" is not always a workaround, think if i need to fire an event if 1 object overlaps 2 OR 3 object overlaps 4, "Is overlapping" is the picking condition.

Edit: Try to add event like simple Layer 1 is visible - Rotate Sprite, It will pick all Sprite instances, if we use OR block with picking condition it will not pick anything unless there's a pick-condition that is true.
Last edited by Sisyphus on Fri Jul 03, 2015 5:42 pm, edited 1 time in total.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Fri Jul 03, 2015 4:38 pm

@lennaert, I agree with your analysis, I just think it's not an intuitive OR function. I just re-read the manual page on this to be sure of my facts (it's been a while), and all it says is the condition filters instances for subsequent events - and the OR block is certainly a condition. It's just that, in this case, it's just filtering in a way I personally wouldn't expect. It's one for the user to be wary of (and I'm not convinced it's a bug)....
A big fan of JavaScript.
B
76
S
20
G
73
Posts: 2,241
Reputation: 45,956

Post » Fri Jul 03, 2015 4:41 pm

@Sisyphus - the manual page specifically describes system conditions (like layer visibility) as not filtering for subsequent events; whereas a condition with an object will, by definition, filter subsequent objects - it's just not clear there that ALL condition lines in the OR block will filter, even if some of them are not True.
A big fan of JavaScript.
B
76
S
20
G
73
Posts: 2,241
Reputation: 45,956

Post » Fri Jul 03, 2015 4:44 pm

@Colludium At least if it's a feature, the feature like not picking all objects inside OR block without true picking condition, must be stated in manual with workaround.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Fri Jul 03, 2015 4:44 pm

Its a picking variant, not really picking.

I did not mean to replace it with an actual picking event, such as pick by comparison.

I suggested to replace your object compare with a (system), Compare 2 values.

Its more of a filter perhaps then a picking variant, but the result is the same.
Its like, when you use an objects compare function, you end up with the objects having the same value.

ie
100 objects, 10 have var = 1

Event:
Objects.var = 1
For each


Placing it in this order, would only make the for each loop through all the objects with a var = 1, and not use the objects var <> 1
(Loop = 10 objects big)


unlike

Event
for each object
object.var = 1

Where it loops through all objects and only uses the object where var = 1
(loop = 100 objects big)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Fri Jul 03, 2015 4:55 pm

@lennaert I got your point, but as i said above, in my game i have an event like - If "Wheel" Overlaps "Ground" OR "Second Wheel" Overlaps "Ground" - do something with both wheels, but if one wheel is overlapping ground, something will be done only with that one wheel, because the second wheel will not be picked. That's a little not a thing that i expect by this OR block.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest