How do I Create multiple objects without changing the others

Get help using Construct 2

Post » Thu Oct 15, 2015 11:26 am

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:
Image

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.!
B
10
S
4
G
3
Posts: 169
Reputation: 2,519

Post » Thu Oct 15, 2015 11:34 am

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!
B
10
S
4
G
3
Posts: 169
Reputation: 2,519

Post » Thu Oct 15, 2015 11:38 am

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
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: kainrazial and 20 guests