Re-use animations? (solved)

Get help using Construct 2

Post » Mon Feb 20, 2012 3:55 pm

Hi guys.

Ive almost finished my demo but Im struggling trying to re-use animations for my enemies. I just cant seem to figure out how to set a copies of an object (my animation object) to 2 items at once (two different enemies).

Here is an example cap.

http://dl.dropbox.com/u/13312935/Animation%20Example.capx

Im guessing that i need to use instance variables but im not sure...

Anyone have any ideas? I'll keep trying but im stuck at the moment.GenkiGenga2012-02-20 17:55:37
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Mon Feb 20, 2012 4:11 pm

I am sorry, but I do not understand, what you are trying to do...even by looking at you CAPX, Maybe you have another way to explain to me, what you are to achive
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Mon Feb 20, 2012 5:26 pm

Thanks for the help Wei,

What im trying to do is make 2 objects share the same animation sequences. In my cap.x i have my player sprite and two seperate enemy sprites. I am attempting to set my single animation "arrow" to both objects, (thats why there is two copies of the arrow sprite in the layout).

If i have two copies of the 'same' enemy it works, but when one of the copies does something that calls for an animation - all of the copies play the animation as well.

My goal is to save file space by not needlessly using duplicates of my animations.

hopefully i was more clear in this post?
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Mon Feb 20, 2012 5:28 pm

so, what you are saying is, taht you have two instances of one spreit, and they should play different animations at the same time?

Take a look at this CAPXWeishaupt2012-02-20 17:34:19
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Mon Feb 20, 2012 5:32 pm

Ahh your the best Weishaupt! Thanks man! :)

Ive just updated my original cap.x if anyone wants to learn from it. (Wohooo!)





GenkiGenga2012-02-20 17:45:52
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Mon Feb 20, 2012 5:34 pm

Like this?
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Mon Feb 20, 2012 5:35 pm

picking problem (:
picking.capx
Last edited by Yann on Sun Sep 14, 2014 9:32 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon Feb 20, 2012 5:53 pm

ha - i took 10 minutes to figure out the picking in Wei's cap i didnt even see your post @Yann. Cheers.

Its impressive but how does the "instance: Enemy.IID" know which enemy to go to?

ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Mon Feb 20, 2012 9:48 pm

well there's some hiddent trick
in the first event, each instance of enemy is matched with each instance of arrow by their IID
But in the comparaison you have to pick the proper arrow else you influecne all of them.Yann2012-02-20 21:48:19
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests