Loop -> Repeat: HOW TO?

  • How do I use this, and have it actually repeat something 10x?

  • Imagine the simplest possible thing: two Set Colour behaviours to operate sequentially, one to black, the other to white. One has a duration of 0, the other of half a second fading back to the other.

    I want to run this 10x, a flashing of black, white, black, white, etc...

    For some strange reason, how to do this in hyperPad is not at all obvious, nor explained in any manner that I understand.

    Granted, I could be dense, but having tried all the variations of ways to do this that I can think of, I'm also out of ideas... for what should be amazingly simple to do.

  • @Deeeds loops run as fast as possible, they don't work with behaviours that have a duration. What you'd need to do is make your own loop, something like this:

  • @Jack8680 Can't thank you enough for this.

    I have tried EVERY CONCEIVABLE arrangement I could come up with using the loop feature. I never, in my wildest dreams, imagined a visual programming editor with only naive loops... particularly when one of them is called "REPEAT".

    Perhaps even more baffling is that the Sequencing behaviour doesn't do sequencing, and the Bundle doesn't do it in a way that would be expected of it. Something feels very half baked about the entire conditional and looping arrangement.

    The blatant bug in the conditionals for looping only serves to reinforce this notion. And that only the two of us have noticed it scares me even more.

  • Admin

    Loop behaviours perform everything in a single time step, so you can't really use it with duration based behaviours.

    When you trigger a duration based behaviour before that behaviour has a chance to finish, it will cancel the previous action, and run a new action. This has the effect of only triggering the duration based behaviour on the final iteration.

  • @Hamed Is there any form of sequencing, grouping and repeating of actions planned?

    If not, take a look at how SpriteKit manages this, as it's a natural progression from how cocos2D consider things, and consistent with where you're probably headed for this sort of thing.

    They are actions that run actions, that run actions. etc. Which creates wonderful possibilities for nesting behaviour, no pun intended.

    Blocks of Sequences, Blocks of Groups and the ability to repeat any of them (or individual actions) as per their own timings or an arbitrary timing for the repeat cycle, and reverse them, are all ways of collating and operating actions.

    It's clean, efficient, effectively, easily communicated and friendly to timelines, explanations and nodal coding.

  • @Hamed I still don't have an answer to this question: How do I create sequentially occurring, repeating actions?

  • Admin

    You could do it with @Jack8680's way,

    Or you could connect your bottom behaviour to the place where you want it to repeat. Eg.

    Behavour Bundle -> Set Colour - > Set Colour 2 -> Connect it back to Set Colour

Log in to reply