logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Basic logic help

    Scheduled Pinned Locked Moved
    Help and Support
    3
    7
    289
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • AcebossA
      Aceboss
      last edited by

      I’m a bit confused over the order of the IF and Boolean behaviours.

      For instance, if I want this logic:

      IF NOT (Collision with Object A OR Collision with Object B)
      Do Something
      ELSE
      Do something else

      Could someone please provide or point me to an example? Thanks

      RobinsonXR 2 Replies Last reply Reply Quote 0
      • RobinsonXR
        RobinsonX @Aceboss
        last edited by RobinsonX

        @Aceboss The Collision Event behavior is event based and is supposed to be used to trigger behavior(s) when:

        • An object started colliding with another object
        • An object stopped colliding with another object
        • While an object is colliding with another object

        They work like the Started, While and Stopped Touching behaviors. Although, the Boolean behavior is not event based, it's used as a check (outputting 0 or 1) in conjunction with the If behavior (check if equal to 1 or 0).

        AcebossA 1 Reply Last reply Reply Quote 0
        • RobinsonXR
          RobinsonX @Aceboss
          last edited by

          @Aceboss 09C7A958-A03F-46E0-877F-E5B62F617D6B.jpeg

          Here is an example of what you're trying to do. I have a variable isColliding? and it is set to 1 once A has started colliding with B. It is set back to 0 once A stops colliding with B.

          Now I coded it such that when I start touching the object, it triggers another behavior only if A is not colliding with B.
          You can plug another if behavior under to only trigger when multiple conditions are met. You can also invert the condition by changing Is Equal To to Is Not Equal To.

          1 Reply Last reply Reply Quote 0
          • AcebossA
            Aceboss @RobinsonX
            last edited by

            @RobinsonX

            Thanks. I am gathering there’s no inherent ELSE behaviour for an IF, and if you want to emulate that you’d need to have an “IF (variable) == 1”
            behaviour and another “IF (variable) != 1” behaviour next to it, is that right?

            MurtazaM 1 Reply Last reply Reply Quote 0
            • MurtazaM
              Murtaza Admin @Aceboss
              last edited by

              @Aceboss If you add a second if and put it beside the first if. It will snap together and turn into an ELSE

              AcebossA 1 Reply Last reply Reply Quote 0
              • AcebossA
                Aceboss @Murtaza
                last edited by

                @Murtaza Thanks, I must have missed that in the manual, my apologies. It seems though this is an elseif rather than just an else, I guess under the elseif condition I can put something like 0 equals 0 to always force it to true and become an else. Pls advise if I am incorrect.

                RobinsonXR 1 Reply Last reply Reply Quote 0
                • RobinsonXR
                  RobinsonX @Aceboss
                  last edited by

                  @Aceboss Yeah, for an else if, you can make it a condition that's always true so it'll just act like an else.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post