UPDATE: Or block System picking objects bug found

0 favourites
  • 6 posts
From the Asset Store
Fantasy Game includes more than 600 sound effects inspired by hit computer games like World of Warcraft and Diablo.
  • UPDATE: Check the second post for project file and image of issue, and the fourth post for a description of the issue/potential bug.

    Hi, from my tests, I'm seeing that the OR block is picking objects even when one of the conditions in the OR fails.

    For instance,

    Tiger == Red

    OR

    Tiger == Green

    OR

    Tiger == Silver

    If the tiger is Silver, it won't trigger because it is picking the red tigers in the first condition, and when there are no red tigers (only silver tigers), then the SOL is empty because of the failed first condition.

    For reference, the actual condition I'm testing is the new System Pick overlapping condition, so maybe that's where the problem is.

    I've isolated the OR block as to where the problem is lying. If I separate out each condition into separate events, it works. It only fails in this OR block.

  • Okay okay, I'll post a project file example and image:

    CAPX: iu.box.com/s/erbqmp2jffivlzwrbu0y

    Screenshot from project:

    <img src="http://cannedessence.com/Construct2Screens/OrBlockTest.png" border="0" />

    The event fails to trigger, even though the blue point is overlapping the sprite. If you disable the redpoint check condition, then it works.

    If you insert a System Pick All Sprite condition in between the redpoint and bluepoint checks, then it works too.

    Is this intended behavior? If so, I disagree that it should be that way. I don't think that conditions that fail in an OR block should be picking objects.

  • That's a tough one.

    I know this works;

    Sprite | Overlap Red

    -or-

    Sprite | Overlap Blue

    So I'm thinking it has to do with "System Picking" maybe? Does calling a System Pick break the rules?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I figured it out.

    It almost certainly is a bug.

    The problem is that OR blocks with the System object picking another object are functionally the same as AND blocks.

    If you do

    System: Pick Sprite by evaluating 0 //this is automatically false

    OR

    System: Pick Sprite where Sprite.UID = 0

    Then nothing is picked, even though there is a sprite with UID as 0. This shouldn't be the case.

    If you do

    System: 0 = 1

    OR

    System: Pick Sprite where Sprite.UID = 0

    Then it successfully picks the sprite whose UID is 0. This is working as it should.

    If you do

    System: Pick all Sprite

    OR

    System: Pick Sprite where Sprite.UID = 0

    it will select only the one sprite whose UID is 0. This is a design decision, but I consider it a poor one if it is intentional. It should pick all the instances of Sprite, because an OR block should stop evaluating the other conditions once it finds something that is true.

    The argument would be that for example System 0 = 0 OR System pick Sprite.UID = 0 will keep the full Sprite instance list. Even so, that IMO should be how Construct operates. They can handle the picking in a sub-event if a non-picking OR condition is true.

  • Yeah, I never really had a good grasp on this. As a result, I only ever use -or- when I'm not picking objects and implement -or- when picking by creating separate events. It would be nice to know what's happening under the hood here.

  • CannedEssence

    If you think its a bug you should make a bug report.

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