the Repeat condition

This forum is currently in read-only mode.
  • I have used "repeat 2 times", but it keeps on creating the object, without stopping.

    I would want to have:

    • do something
    • wait x seconds
    • repeat this x times

    So I used the "repeat"-condition. Good or bad use?

    System: Repeat 3 times
      System: Every 1500 milliseconds
      > System Create object Red1 on layer 1 at (905, 605)[/code:1co6vdkk]
    Screenshot:
    <img src="http://img340.imageshack.us/img340/2554/repeat.jpg">
  • That's not right, 'every' doesn't make sense under a 'repeat' condition.

    Try:

    • do something
    • use the function object to call a function after a delay
    • in the function add a 'repeat 2 times' condition
  • Try:

    - do something

    - use the function object to call a function after a delay

    - in the function add a 'repeat 2 times' condition

    Doesn't work properly.

    In the 3rd step, it does the repetition without delay.

    I also tried to let the function call itself, after a delay, which didn't work.

    I've tried the While-statement, but I can't get it work properly.

    I think this is a very simple problem, but I have no idea.

    I would like to have Construct do this:

    • create sprite at 600, 900
    • wait 1500ms
    • repeat this process x times

    This is something else I tried, that doesn't work:

    <img src="http://img44.imageshack.us/img44/9911/while.jpg">

    It would be nice if Construct would have a "delay/wait"-action, instead of reaching out to functions, just to use the delay.

    I've spent an hour doing what Construct is n?t about: ignoring game design and trying to see how logics work

  • Use a timer? attach it to something hidden, that might work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use a timer? attach it to something hidden, that might work.

    By "timer", do you mean the object "profiler"? Or the System condition "compare time"?

    I don't understand, I think.

  • > Use a timer? attach it to something hidden, that might work.

    >

    By "timer", do you mean the object "profiler"? Or the System condition "compare time"?

    I don't understand, I think.

    The behavior timer. Make a sprite, add the timer behavior, create an event, lets say, start of layout. Select the sprite and then timer, create a timer and setup your options (it has repeat if you need it too) and then another event for on timer, and use that to create your object. It should work and do what you're wanting to do.

  • The behavior timer. Make a sprite, add the timer behavior, create an event, lets say, start of layout. Select the sprite and then timer, create a timer and setup your options (it has repeat if you need it too) and then another event for on timer, and use that to create your object. It should work and do what you're wanting to do.

    I followed your instruction, but it gives an error. I did:

    start layout: start timer "Timer" with length 1500, don't repeat, don't destroy.

    (I've tried here also "repeat" and "destroy").

    Event:

    On timer "Timer"

    create sprite at x, y

  • just do every 1500ms - create object at ...

    you could limit the creation by count of object or by a global var,

    every 1500ms

    sprite.count < 10

    • create object at ...

    or

    every 1500ms

    global('count') > 0

    create object at ..

    substract 1 from global('count')

  • >

    > The behavior timer. Make a sprite, add the timer behavior, create an event, lets say, start of layout. Select the sprite and then timer, create a timer and setup your options (it has repeat if you need it too) and then another event for on timer, and use that to create your object. It should work and do what you're wanting to do.

    >

    I followed your instruction, but it gives an error. I did:

    start layout: start timer "Timer" with length 1500, don't repeat, don't destroy.

    (I've tried here also "repeat" and "destroy").

    Event:

    On timer "Timer"

    > create sprite at x, y

    Download: cap

    Works for me, try that see if it works your end.

  • Aphex, thanks a lot for your sollution, which was the simplicity I was looking for.

    I didn't know sprite.count was possible...

    Lost My Keys, thanks (even more) for replying thrice and supplying a .cap. Unfortunately I can't open the cap. Error message: abnormal program termination.

  • Aphex, thanks a lot for your sollution, which was the simplicity I was looking for.

    I didn't know sprite.count was possible...

    Lost My Keys, thanks (even more) for replying thrice and supplying a .cap. Unfortunately I can't open the cap. Error message: abnormal program termination.

    Hmm, sounds like there's something up with your install if it's giving errors using the timer and wont run this cap, or it's an older version?

  • > (...)

    > Lost My Keys, thanks (even more) for replying thrice and supplying a .cap. Unfortunately I can't open the cap. Error message: abnormal program termination.

    >

    Hmm, sounds like there's something up with your install if it's giving errors using the timer and wont run this cap, or it's an older version?

    I'm using v0.99.62.

    I'll install Construct again, just in case.

  • >

    > > (...)

    > > Lost My Keys, thanks (even more) for replying thrice and supplying a .cap. Unfortunately I can't open the cap. Error message: abnormal program termination.

    > >

    >

    > Hmm, sounds like there's something up with your install if it's giving errors using the timer and wont run this cap, or it's an older version?

    >

    I'm using v0.99.62.

    I'll install Construct again, just in case.

    Yeah I'm using the latest version, that's why it didn't load the cap. But I dunno why your timer gave you the error.

  • >

    > I'm using v0.99.62.

    > I'll install Construct again, just in case.

    >

    Yeah I'm using the latest version, that's why it didn't load the cap. But I dunno why your timer gave you the error.

    I'm glad my problem is solved.

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