How do I set 1 sprite onto multiple instances of an enemy?

Get help using Construct 2

Post » Sat Apr 19, 2014 3:38 pm

Ok, I saw your answer after I posted mine. Glad you figured it out :)

As for the mirroring, either use an extra action to mirror the spawned object (Sptrite5) or add both the ForestCow and the Sprite5 in to a family and add the movement and the mirroring to the family object!
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Sat Apr 19, 2014 3:43 pm

I should explain further, when the player goes near the enemy, i want a sprite to appear on the enemy. In this case, it is an animated head that tries to bite the player. If the player is not near then the added sprite dissapears and the enemy looks normal again.

^^^^^ This we have achieved but without the "set position to" the added sprite stayed in the same place and did not move with the enemy. Without the pin behaviour i had the same thing. With both of them, the added sprite pins to image point 1 (the enemys head) and moves along as the enemy moves left. When the enemy moves right, the added head sprite stays on the position af it was moving left.

I'll try the Sine behaviour (not used this one before :D) and see how it gets on :) I will update in a few minutes!
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Post » Sat Apr 19, 2014 3:44 pm

Ooops just saw your reply too! Sorry hahaha.

I tried the extra actions for mirroring but it didnt work. Will try the family thing now :)
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Post » Sat Apr 19, 2014 3:53 pm

What method do you use to move the enemy? This is important concerning the mirroring. The Sine Behavior doesn't have a condtition to check if you are moving towards the right or left, so I don't think it will help...

If you like, send me your capx and let me see if I can help directly within your project.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Sat Apr 19, 2014 4:04 pm

I'll add the capx if it would make things easier but here is a screenshot of the movement and attack for the Forest Cow enemy for now:

sdefbwerb.png


I tried adding in extra actions to mirror the Sprite5 in both parts and with sub events as well and they didnt work.
You do not have the required permissions to view the files attached to this post.
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Post » Sat Apr 19, 2014 4:07 pm

Wait...
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Sat Apr 19, 2014 5:13 pm

Ok, this is the best I can do...

http://www.eli0s.com/Tests/BarkingHeads.capx

I removed the pin behavior as it doesn't inherit the mirroring of its parent, instead I used the every tick set position to an image point and mirroring actions for the heads.

The enemies move randomly left and right with the platform behavior (if you only need them to do small movements that do not jump or follow uneven ground, then the Platform is an overkill) and when the player is in range they follow him/her, barking (hopefully) facing the right way...

Use the arrow keys to move the player around (default controls).
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Sat Apr 19, 2014 7:53 pm

Ive added/modified the necessary parts to work on my project and the Sprite5 now follows the enemy head! This is amazing!

The only thing wrong now is that even though the Sprite5 is created on layer1 (my top layer), it is still appearing behind the enemy. I feel bad asking for more help considering how much you have given so im gonna try figure this one out but if you have any tips i wouldnt turn them down ;)

Either way, you my friend, are a star! Thank you for everything :)
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Post » Sat Apr 19, 2014 8:11 pm

Thank you for your kind words!

Since you create the Sprite5(s) at run time, it shouldn't be behind the enemies. Are you sure that both objects (the enemies and the Sprite5s) exist in the same layer and/or that the layer1 is the top-most one?

If they are on the same layer, after the "Create object Sprite5 on layer1..." action, add the "Move to Top" action on the Sprite5 (is in the Z Order Category). This should fix it anyway.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Sat Apr 19, 2014 8:36 pm

It works! It works it works it works!

Thank you so much.
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests