What's the best way to transfer a variable from a sprite to another sprite

0 favourites
  • 2 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • What's the best way to transfer a variable from a sprite to another sprite.

    Hopefully without using a for each loop because they'Re slow, and with many sprites transferring one or multiple variables to another sprite every tick

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm, off the top of my head I can´t really think of a different way other than the mentioned loops, but I´m also not certain what exactly you try to do. You have multiple SpriteA that you want to transfer values to multiple SpriteB (or just a single SpriteB that gets all the values?). Is there also some sort of picking involved so a specific SpriteA is "linked" to a specific SpriteB?

    One thing is always to think if it absolutely has to happen every tick. Maybe you could use a function that you call whenever a synchronization is actually needed. There would be no real benefit to this though if the values are expected to pretty much always change every tick.

    Another story would be if there are so many objects that it would cause lag regardless, simply because it takes longer than a tick to complete. I know there is a plugin that does asynchronous loops in C2, not sure about C3 but I think I´ve read about one somewhere. This would open the problem of the synchronization lagging behind though.

    Other than that... maybe there is a way to do this without having to use loops but I´d say that depends on the exact case.

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