[r122] loopindex call error after wait action

0 favourites
  • 6 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • Link to .capx file (required!):

    http://www.mediafire.com/?i68888z615g2udl

    (simplized one for this report.)

    Steps to reproduce:

    make event like this. and test (preview) it.

    Condition : Start of layout (for not looping endless)

    Sub Event :

    __ Condition : (system) Repeat (Any...? count. Didn't test)

    __ Action1 : (system) wait loopindex * 20

    __ Action2 : (system) (system) create some object at (loopindex * 10, 0)

    Observed result:

    error message on test game. Node-js exported one freezes.

    Expected result:

    spawn some object gradually (in time and position)

    Browsers affected:

    Chrome: not checked, but node-js exported one freeze.

    Firefox: yes

    Internet Explorer: yes

    Firefox give me an error message.

    -----------------------------------------------------

    Javascript error!

    TypeError: this.runtime.getCurrentLoop(...) is undefined

    localhost/system.js, line 1400 (col undefined)

    This is either a bug in Construct 2 or a problem in a third party plugin or behavior - please report it to the developer!

    -----------------------------------------------------

    Operating system & service pack:

    Win 8 Pro K, x64

    Construct 2 version:

       

    r122 (beta)

  • Thanks, should be fixed in the next build. Note these events still won't do what you expect, because by the time you wait 0.1 seconds the loop has finished so loopindex won't be set to anything.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's sad, okay, thank you for information.

  • - I am trying to do something similar. I am doing a loop, waiting loopindex seconds to stagger when a sprite appears, then using loopindex to get the correct sprite out of an array. Doesn't work because of what Ashley says above. Did you come up with a solution?

  • Create "Spawner" object for values. It soundw weird, but can be one of solutions, because "Wait" action does not save values, but remembers picked objects. You can access instance's value (instead of loopindex) via that spawner object. (and it's needed adding 1 to the value to spawner object.)

    I don't know other ways for removing this bothersome object and actions.

    Construct 2 is still intuitive, but some cases Event system was not fit for something I wanted. like object in same family picking (for overlap based z-index sorting.) ... That might be just my lack of knowledge. haha

    *( I'm not native and some english might weird. plz understand. :D )

  • Okay, thanks for the information. I was able to figure out a solution to my problem using regular straight forward logic versus smaller logic in a loop. I think I understand the wait action now, but it is deceptively tricky in loops, especially when accessing indexes in array.

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