Can I reuse the same code for two different sprites?

From the Asset Store
Footsteps SFX Two contains 450 sounds of steps and jumps on different surfaces.
  • Hi everyone.

    I wanted to ask you if it is possible to clone a sprite and have the clone use the same events as the original.

    What I want to know is if it is necessary that for each sprite there is an event or if two different sprites can use the same events.

    From what I could see, each sprite has a UID, which makes it different from another sprite, so apparently a series of events destined for a specific sprite cannot be repeated in a clone, since they have different Uids. I did the copy and clone test, but the sprite stays still, while the original works fine.

    What I want to avoid is repeating the same code for each different enemy. I hope you understand what I am explaining. Thanks!

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you are referring to actual cloned object type so you have 2 different sprite objects then you would need to do separate events unless you use 'Families' which groups different objects so you can use one event. You may be talking about 2 instances of the same 1 object which can be used with one event where you pick the instances you want to target with conditions.

    It sounds like you may have 2 different enemy objects though so instead of targeting for example Goblin and Slime with 2 different events you can use a Family here called 'Enemies' and you run the event on only 'Enemies' which applies to both Goblin and Slime at once.

  • Hi, thanks for your response. Yes, from what I've been figuring out I should use families, but I can't because I'm using the free version of construct ...

    Greetings.

  • Yes you must subscribe to use Families, or you can use separate events but I imagine you would quickly run out of events. Buy it! :D

  • Yes! That's why I wanted to know how to unify an event with several sprites, because otherwise my game will have 1,000,000 lines LOL. As soon as I can, I'm going to buy it. Thanks!

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