feature request : retreiving sprite animtion name at a index

Discussion and feedback on Construct 2

Post » Mon Sep 22, 2014 4:20 am

Problem Description

my problem can have many solution, i'm not C2 js sdk developer or i would make the changes myself.
i want to pick the sprite animation name using index and not only the current animation name. or let us at least set animation with index or let us name the animation frame with text and get the animation name in a given index.

Expected Result
get animation name at a given index.
B
12
S
6
Posts: 118
Reputation: 1,466

Post » Mon Sep 22, 2014 4:45 am

If you want to do it with events you can give the animations number names like (1,2,3,...). Or even better numbers in combination with a word like (run1,run2,run3...). Then you can use the set animation action with the expression "run"&n where n is an index.

If you want to do it in a plugin with the javascript sdk then look here:
https://www.scirra.com/manual/29/object-type
If the object has animations you can use something like type.animations[i][0] to get the name at index i. You can glean more info about it by looking at the sprite object's source.
B
92
S
32
G
109
Posts: 5,290
Reputation: 70,991

Post » Mon Sep 22, 2014 7:30 am

Interesting, what's the use case?

I had made a plugin which could load all frames of all animation in an action. I could try to make something to retrieve animations.
B
108
S
26
G
271
Posts: 4,471
Reputation: 151,777

Post » Mon Sep 22, 2014 8:43 am

Here, I've made a behavior for the sprite plugin quickly.
https://dl.dropboxusercontent.com/u/139 ... s/anId.zip
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Tue Sep 23, 2014 8:47 am

hey, i already found a solution to my problem , the idea is complex but the code is very minimised and short , you wont beleive how easy it was. the goal of my request was , i have many instance of the same sprite each one will be showing a different animation , whene i press i butoon i want them all to show a specifique other animation for each sprite ,


thank you guys ^^
B
12
S
6
Posts: 118
Reputation: 1,466


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 13 guests