How do I use different variables values in function calls?

0 favourites
  • 3 posts
From the Asset Store
This music pack covers differents situations for visual novels, anime games and many more!
  • I have function spawnEnemies that I use to spawn a wave of enemies. I passing some wave metadata like X, Y, wave size, angle as function params and store it in the local variables. I have to store it in local variables because I use these values in the For Loop. In the loop, I can't access to Function.Param(x).

    Basically, it works well until I call two or more spawnEnemies functions at the same time. In that case, the second call overrides local variables and enemies from the first call will have params from second.

    Is there a way to "lock" values in the function calls?

    Or may another suggest to handle it?

  • The problem stems from the "wait" action you have in there. If I were you, I'd ditch it altogether and create the sprites in a single tick, and deal with the delay with a timer. "Disable" the enemy on creation, and "enable" it with a timer set on creation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nice trick! Work well for me.

    Huge thanks!

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