How do I Create multiple objects without changing the others

0 favourites
  • 3 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi,

    I have a issue and for a few days now i can't seem to fix it.

    I've looked up some stuff on creating multiple instances of 1 single object but yet i can not fix it.

    The issue is the following:

    I have multiple enemies which are getting spawned over time. Each enemy will walk around and once into a specific area ( a sprite ) it will start to attack.

    The attack is simply a: Create object on enemy. This attack is a animation ( a slash ). Now this works but for some reason i can't get multiple targets to attack in the specific range. To destroy the "Slash" i use > On animation finished > Destroy. I think this actually destroys all the animations..

    This is what I've done:

    The result is that if multiple enemies are in range ( overlapping the "attackRange" sprite ) only 1 will attack. So it seems. All sword will become invisible and visible though. Only 1 slash animation shows at a time.

    What i need is that every enemy will simply attack and has it's own Slash animation.

    I can't upload my .capx since it's a part of a whole game.

    Thanks in advance.!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Alright this is very akward but i just tried "Spawn another object" instead of "Create object" and that works somehow.

    I wish i knew why. Any one here having a explanation why spawning the object works instead of creating it?

    Would be good info for my learning curve! Thanks!

  • This is a simple picking problem.

    You are not referencing the Enemysword1 in your first event, so all are selected..

    You probably have a way to keep enemysword1 attached to each enemy, so you should be able to pick the right sword in the event..

    So the event should be something like:

    Enemy is overlapping

    Pick attached enemy sword

    set enemy sword invisible

    spawn slash at enemy.x,enemy.y

    enemyslash On animation finished

    Pick right enemy / enemysword

    set enemy sword visible

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