Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
hyperPad

hyperPad Forum

  1. Home
  2. Help and Support
  3. Best way to set up behaviors?

Best way to set up behaviors?

Scheduled Pinned Locked Moved Help and Support
10 Posts 4 Posters 1.5k Views 2 Watching
  • 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.
  • iTap DevelopmentI Offline
    iTap DevelopmentI Offline
    iTap Development
    wrote on last edited by
    #1

    Is there any reason to use one or the other of the two setups in the screen shot?0_1510515851046_87141109-CCA5-4ECC-A0F5-C8EF364638F7.png

    D 1 Reply Last reply
    1
    • iTap DevelopmentI iTap Development

      Is there any reason to use one or the other of the two setups in the screen shot?0_1510515851046_87141109-CCA5-4ECC-A0F5-C8EF364638F7.png

      D Offline
      D Offline
      Deeeds
      wrote on last edited by
      #2

      @iTap-Development As I understand it, for duration based activities, the example on the left will activate actions based on those durations.

      So if you want to:

      • move up 10 metres during 1 second
        then
      • move down 10 metres during 1 second

      If you use the layout on the right, the object won't appear to move to up as that behaviour will be overridden by the immediate call of the move to go down.

      iTap DevelopmentI 1 Reply Last reply
      0
      • D Deeeds

        @iTap-Development As I understand it, for duration based activities, the example on the left will activate actions based on those durations.

        So if you want to:

        • move up 10 metres during 1 second
          then
        • move down 10 metres during 1 second

        If you use the layout on the right, the object won't appear to move to up as that behaviour will be overridden by the immediate call of the move to go down.

        iTap DevelopmentI Offline
        iTap DevelopmentI Offline
        iTap Development
        wrote on last edited by
        #3

        @Deeeds oh I didn’t even think about that, but I tested and that is the case. With the exception of the interrupt movement toggle being on on the second behavior, in which case the second behavior will run. But the first one won’t run regardless of the toggle being on or off on either.

        Aidan_FireA 1 Reply Last reply
        0
        • iTap DevelopmentI iTap Development

          @Deeeds oh I didn’t even think about that, but I tested and that is the case. With the exception of the interrupt movement toggle being on on the second behavior, in which case the second behavior will run. But the first one won’t run regardless of the toggle being on or off on either.

          Aidan_FireA Offline
          Aidan_FireA Offline
          Aidan_Fire
          wrote on last edited by
          #4

          @iTap-Development I think if you use the one on the right it will all happen faster.

          Jack de WildeJ 1 Reply Last reply
          0
          • Aidan_FireA Aidan_Fire

            @iTap-Development I think if you use the one on the right it will all happen faster.

            Jack de WildeJ Offline
            Jack de WildeJ Offline
            Jack de Wilde
            wrote on last edited by
            #5

            @Aidan-Oxley why? They look exactly the same?

            D 1 Reply Last reply
            0
            • Jack de WildeJ Jack de Wilde

              @Aidan-Oxley why? They look exactly the same?

              D Offline
              D Offline
              Deeeds
              wrote on last edited by Deeeds
              #6

              @Jack8680 Theoretically, the one on the right should be able to initiate and issue a bunch of math operations before the results come back. But that depends a lot on what's going on inside cocos2D in terms of managing this sort of rapid fire activity, and how hyperPad lads have done things, too, how iOS plays with it, how many cores you have, etc etc...

              If you were doing this through arrays, and trying to operate on a bunch of things, I'd use the technique on the right just in case you get speed advantages, because that's definitely where you're going to get them.

              The one on the left is going to wait for the result from each math operation before continuing... I think. Probably. That would be the safest way it could be programmed, since subsequent operations for the one on the left might be relying on results further up the branch to operate on.

              iTap DevelopmentI Jack de WildeJ 2 Replies Last reply
              0
              • D Deeeds

                @Jack8680 Theoretically, the one on the right should be able to initiate and issue a bunch of math operations before the results come back. But that depends a lot on what's going on inside cocos2D in terms of managing this sort of rapid fire activity, and how hyperPad lads have done things, too, how iOS plays with it, how many cores you have, etc etc...

                If you were doing this through arrays, and trying to operate on a bunch of things, I'd use the technique on the right just in case you get speed advantages, because that's definitely where you're going to get them.

                The one on the left is going to wait for the result from each math operation before continuing... I think. Probably. That would be the safest way it could be programmed, since subsequent operations for the one on the left might be relying on results further up the branch to operate on.

                iTap DevelopmentI Offline
                iTap DevelopmentI Offline
                iTap Development
                wrote on last edited by
                #7

                @Deeeds why would you get speed advantages on the right?

                1 Reply Last reply
                0
                • D Deeeds

                  @Jack8680 Theoretically, the one on the right should be able to initiate and issue a bunch of math operations before the results come back. But that depends a lot on what's going on inside cocos2D in terms of managing this sort of rapid fire activity, and how hyperPad lads have done things, too, how iOS plays with it, how many cores you have, etc etc...

                  If you were doing this through arrays, and trying to operate on a bunch of things, I'd use the technique on the right just in case you get speed advantages, because that's definitely where you're going to get them.

                  The one on the left is going to wait for the result from each math operation before continuing... I think. Probably. That would be the safest way it could be programmed, since subsequent operations for the one on the left might be relying on results further up the branch to operate on.

                  Jack de WildeJ Offline
                  Jack de WildeJ Offline
                  Jack de Wilde
                  wrote on last edited by
                  #8

                  @Deeeds The behaviours on the right can still use the outputs from previous behaviours though, and they will activate in order. For example replacing 'add values4' with a loop that runs loads of times, the loop will finish before 'divide values2' (next to it) will activate.

                  I set up a project to test which runs faster and they seem to be around the same. For a moment the left one seemed slightly faster, but switching the behaviours in the two objects around reversed the result, so it's impossible to tell exactly which is faster, they were both within a few percent of each other, I'm guessing something in the engine itself affects it slightly.

                  I'm assuming it compiles the behaviours into 1 dimensional code, and that the two will be identical. When a behaviour has a duration the left one waits for it to finish, while the right one probably performs a step each frame, while still continuing with the behaviours next to it. For multiply, add, divide though, there's no noticeable difference.

                  iTap DevelopmentI 1 Reply Last reply
                  0
                  • Jack de WildeJ Jack de Wilde

                    @Deeeds The behaviours on the right can still use the outputs from previous behaviours though, and they will activate in order. For example replacing 'add values4' with a loop that runs loads of times, the loop will finish before 'divide values2' (next to it) will activate.

                    I set up a project to test which runs faster and they seem to be around the same. For a moment the left one seemed slightly faster, but switching the behaviours in the two objects around reversed the result, so it's impossible to tell exactly which is faster, they were both within a few percent of each other, I'm guessing something in the engine itself affects it slightly.

                    I'm assuming it compiles the behaviours into 1 dimensional code, and that the two will be identical. When a behaviour has a duration the left one waits for it to finish, while the right one probably performs a step each frame, while still continuing with the behaviours next to it. For multiply, add, divide though, there's no noticeable difference.

                    iTap DevelopmentI Offline
                    iTap DevelopmentI Offline
                    iTap Development
                    wrote on last edited by
                    #9

                    @Jack8680 so if I added another add values to the right one, would the divide run before the second add values?

                    1 Reply Last reply
                    0
                    • iTap DevelopmentI Offline
                      iTap DevelopmentI Offline
                      iTap Development
                      wrote on last edited by iTap Development
                      #10

                      @Murtaza or @Hamed what way would you recommend?

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Search