Can gamesalad do for loop?

100062114100062114 Member Posts: 13

There is some more complex data structure in my game,
so I need for loop.
But there seems to be no for loop behavior in gamesalad.
How can I create for loop in the other way?

Comments

  • zweg25zweg25 Member Posts: 738

    There is a loop behavior (Maybe not for windows)

  • 100062114100062114 Member Posts: 13

    Window Pro version has loop behavior?

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    Hi @100062114 - personally I've no experience with the Windows version of GSC but I'd be surprised if a Loop Behaviour was made a Pro feature only, in it...

    The loop Behaviour is a relatively new addition to the Mac version of GSC so maybe the Windows loop will appear some time in the future.

    For the while, you can create different types of loops in a couple of ways using your existing behaviours and Rules. The following is a few examples :

    A never-ending loop:

    Rule: When MyLoop is false
    - your behaviour
    - -your extra behaviour, etc
    Timer: After ? seconds --- not always needed
    Change Attribute MyLoop to true
    
    Rule: When Attribute MyLoop is true
    Change Attribute MyLoop to false
    

    A conditional loop:

    Same as above, except nest it in another Rule, something like:

    Rule: When GoLoop is true
    Rule --nested--: When MyLoop is false
        - your behaviour 
    

    -- same as above, etc

    There's a few others but hopefully that's enough to get you started.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • 100062114100062114 Member Posts: 13
    edited July 2014

    I want to create a for loop which will be started after a butten is pressed.
    Now, in my code, the for loop can work by itself, but it can't work with button.
    My rule is like the fllowing:

    Rule:
    when all of the flowing are happening:
    touch is pressed

    Rule:
    when all of the flowing are happening:
    if game.loop<5
    do

    timer:
    every 0.1second

    change attribute:
    set game.loop to game.loop+1

    How can I fix this problem?

  • colandercolander Member Posts: 1,610

    Read this thread http://forums.gamesalad.com/discussion/44707/timers-are-for-chumps-gs-optimization-tips it will help you or you could use the Loop group. Some behaviours will not work in a Loop group read its description to find out.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    @100062114 You have already started a thread concerning your loop problem - please don't don't make multiple threads on the same question/subject in future as it causes confusion, amongst other things. I'll merge that thread with this one now.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.