Destroy object doesn't work on OR block

Bugs will be moved here once resolved.

Post » Wed Sep 03, 2014 9:24 am

If the blue circle is outside layout, 1 blue circle is picked and 0 red circles are picked, so there are no red circles to destroy. Isn't that correct?
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Sep 03, 2014 9:37 am

codah wrote:If the blue circle is outside layout, 1 blue circle is picked and 0 red circles are picked, so there are no red circles to destroy. Isn't that correct?

I'm confused now, I thought it should be 1 blue circle picked and all red circle picked (regardless outside or onscreen)? Seems, that's the way it works if the block is a singular condition because condition picking only consider blue circle? Red circle is pick all since no condition pre-pick it, and by default all were selected?
B
28
S
8
G
4
Posts: 553
Reputation: 4,914

Post » Wed Sep 03, 2014 9:50 am

I'm not saying I'm right, just an idea, but I would think the condition Red:Is Outside Layout has to pick the objects that fit the condition, and in this case 0 Red objects, so that in the action you don't have all Red objects picked, you have none.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Sep 03, 2014 10:22 am

My fundamental understanding on how it works is at stake now, :shock: @codah can you assist on dissecting the capx provided and give some insight what is truly going on? The ORblock is really bothering me now.

SingularBlock.JPG

ORblock.JPG


red-n-blue-error4.capx


Lol, my brain is totally in garbage state now, I'll rest for a while to get back my sanity and cuteness.
You do not have the required permissions to view the files attached to this post.
B
28
S
8
G
4
Posts: 553
Reputation: 4,914

Post » Wed Sep 03, 2014 11:15 am

I would rather defer to higher authorities :) But what I think is:

In the first case, no Red objects are involved in picking, so that ALL red objects are picked, and so when blue goes outside layout, ALL red objects are destroyed (all 1 of them).

In the second case, it's as I said above. 0 Red objects are picked because 0 Red objects are outside the layout, so 0 Red objects are destroyed.

Just my understanding and I'm happy to stand corrected.

Edit: I'd be interested if you could say, in words, what you expect to happen in each case, and why. Also out of interest, add a few more Red objects on the layout.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Sep 03, 2014 5:39 pm

0 Red objects are picked because 0 Red objects are outside the layout, so 0 Red objects are destroyed.


I think you're right. That's why the red object is not destroyed. As well as we expect that only one black bar is destroyed when we click on it.

It's not a bug, it's just a feature.

Thanks a lot.
B
5
S
1
Posts: 29
Reputation: 718

Post » Wed Sep 03, 2014 6:36 pm

ORBollocks.JPG

Hmmm I'm still having a logic dilemma.


My understanding is that the if ORblock is true, because one condition is met (blue circle outside layout), so all actions will run regardless, the "true" condition of blue will pick the blue met with true condition, then the red will.....mess...with...my...head.. again.... :cry:

This is either still a bug or the manual needs updating. I guess using customized picking all the time should be the safe route.
You do not have the required permissions to view the files attached to this post.
B
28
S
8
G
4
Posts: 553
Reputation: 4,914

Post » Wed Sep 03, 2014 7:06 pm

@DuckfaceNinja

The OR blockhas two conditions : Blue is outside layout, red is outside layout, one needs indeed to be true for the action to occur, however, when it occurs, it will pick the objects that meet the whole condition(the blue outside of the layout, and the red outside of the layout), since there are no red outside, none are destroyed, basically, everyone is picked unless a picking is done in the conditions.

If the"Red is outside of layout" was not there, red instances would not be filtered by it, and so all would be picked, and so destroyed.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Wed Sep 03, 2014 11:02 pm

If you want your code to behave as desired, just put a sub-event that picks all red and blue objects, under the 'or' block. It's also why the 'function' solution worked, because in a new event, all objects are again picked.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Sep 04, 2014 4:55 pm

The example in this report is working correctly. I believe there is merely confusion about how OR blocks work.

OR blocks are unusual in that they are allowed to run with zero instances picked for an object type. In a normal event, the event would be false and not run in that case. Your event looks like this:

Red: is outside layout
- or -
Blue: is outside layout

There is a red object inside the layout, and a blue object outside the layout. The event is run as such:

Red: is outside layout? Zero instances meet this condition. However since this is an OR block, a later condition may be true, so we keep running it; however 'Red' has zero instances picked (which is unusual but perfectly allowed/correct in this case).

Blue: is outside layout? One instance meets this condition, so we have determined that the actions will indeed run.

Now we run the following actions. Remember that as per usual, actions only run on instances that were picked by the event's conditions, and that the actions only affect the specific instances meeting the event.
Red: destroy - there are zero red instances picked, so this does nothing.
Blue: destroy - destroys the blue instance picked by 'Is outside layout', since it's outside the layout

I guess it's possibly confusing, but it is in fact completely logical. No 'Red' instances are outside the layout, so no 'Red' instances are destroyed. If the Red object was actually destroyed, that would be quite a counterintuitive result: the action ran on an instance which did not meet the event condition.

Closing as not a bug!
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,250

PreviousNext

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest