Problem with Repeating Code - UPDATED [may be bug]

0 favourites
From the Asset Store
Two levels with two sistem Wave. with Source-code (.c3p) + HTML5 Exported.
  • No the event does run because the second condition is true. The problem is with object picking.

    In C2 each event has a selected object list (SOL) that contains all the objects that the actions should act on (AKA the picked objects). The conditions filter that list. If you have an event:

    System: Every tick 
        -> Sprite: Set visible

    it will set all Sprites visible because all the Sprite objects are in the SOL by default.

    If you have a condition that references Sprite objects eg.

    Mouse: Cursor is over Sprite 
        -> Sprite: Set visible

    That condition filters the SOL to only contain Sprites that are under the mouse.

    So the action (Sprite: Set visible) only applies to those Sprites.

    In an OR block, the actions will run if any condition is true BUT the SOL is filtered by all of the conditions. So your event runs when Light_Switch = 1 but your Downlight_1 object isn't picked (because of the first condition) and so it doesn't get set visible.

    I hope that makes sense.

  • That makes sense as far as, I now understand why the script does not work though it's not a genuine OR statement based on my previous programming experiences.

    In normal OR statements, the actions are all performed as long as one of the possible events that can trigger them are true.

    As pointed out the only work around to achieve a true OR statement seems to be creating 2 identical actions but with separate condition events.

    thanks again for the further explanation, I might post a reply in that forum topic that you linked in your post relating to the Or Block and see if they are able to make the following adjustment :

    Traditional OR Block (works as normal or statements do

    Conditional Or Block (works the same way as the current or block)

  • Jax ? Didn't my post fix it ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Jax ? Didn't my post fix it ?Unfortunately it did not, though I do appreciate the effort that you made to help get things up and running. Sadly, we were up against an odd situation that unless you know how the OR Block is meant to function, would not have known why unexpected results were occurring.

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