how do i make ai with multiple sprites per enemy

Get help using Construct 2

Post » Tue May 17, 2016 1:20 am

each enemy in this game i'm working on is made up of about four different sprites. but, when i have multiple copies of the enemy, all the parts like the arms and the head are confused on which body to set their position to. is there a way to make each instance of the enemy independent without having to make a million different sprites?

If this is confusing tell me, and i can try to explain it better.
B
9
S
1
Posts: 6
Reputation: 429

Post » Tue May 17, 2016 2:00 am

Have you tried using containers?
Add all of the sprite that go together in 1 container. That way when you spawn one of those they all come along. You'll need to set the locations for each separately though.
B
16
S
9
G
8
Posts: 38
Reputation: 5,515

Post » Tue May 17, 2016 10:04 pm

is there a tutorial on containers? or do you want to explain containers a little more?
B
9
S
1
Posts: 6
Reputation: 429

Post » Wed May 18, 2016 11:22 am

The manual explains it pretty well: https://www.scirra.com/manual/150/containers

"Containers are for making "composite objects", or objects made out of lots of smaller sprites (such as a turret and tank base making a single tank). Once in a container, picking the base also picks the turret, and vice versa."

For example I have a enemy spaceship that have a lifebar, shield bar, shield and a trail all in a container, I just need to place the spaceship on the layout and all the others show up. I have a everytick that keeps them where they go. If I change the healthbar in an event they update for all the ships with the right values of the ships since they are spawned together.
I never used them before, now after trying them out I use them on everything that have multiple parts.
B
16
S
9
G
8
Posts: 38
Reputation: 5,515

Post » Thu May 19, 2016 5:27 pm

wow, i figured it out, and its pretty great. thanks, you really helped.
B
9
S
1
Posts: 6
Reputation: 429

Post » Thu May 19, 2016 10:20 pm

Great! Thanks!
B
16
S
9
G
8
Posts: 38
Reputation: 5,515


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests