Set the objects position, bellow of a loop, who i had used to create that objects

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Look my code:

    When I do this, the "pre_effect" objects do not set the new position using "for each object" in this function.

    I tried defining using another function by forcing the "for each object" out of the old function, and it doesn't work.

    Tagged:

  • You need to allow one tick of execution for newly created objects to actually be created and so that a loop/sub-event could pick and apply/get values to/from those instances (such as their X/Y).

    In your case, I'd suggest, in event 174 to set global variables to the value of X/Y you are creating your object's instance at. You could then create your pre_effect instance using those global variable values.

    Then, in event 175, instead of referring to the newly created pre_effect.x, you would refer to the global variable as well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, thank you for your answer, but i prefer to create a new array, who work with this numbers, i prefer use that:

  • Well, in this new excerpt your array creates elements to the same position, seeing it is based on global variables which value do not change, since it is out of the loop that makes their value change.

  • I put the "for each array x element" in the same layer of "direcao" variable comparison and it work.

    Thank you again for your answer.

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