retrieving viariabe with same name as current animation?

For questions about using Classic.

Post » Wed Jul 22, 2009 1:56 pm

I everyone,

I'm trying to work out a slow motion effect for Specific on screen enemies at specific times.
I wish there was a way to retrieve "the default speed of any given animation" but since that doesnt seem to be possible, I'vew created private variables with names exactly matching the names of the animations which are being used to store the original or default speed of those animations.

My problem is the syntax for a single line of code(event) that will set the animation speed to the value of the private variable which shares the same name of the current animation playing.

So far, nothing works. :(

I'd imagine it would be something like this:

enemy_0_skin.Value('enemy_0_skin.AnimName')

but that of course tries to create a new singe variable called "'enemy_0_skin.AnimName"

any suggestions?

thanks
B
2
S
2
G
4
Posts: 124
Reputation: 1,698

Post » Wed Jul 22, 2009 2:30 pm

Have you gone over the Ghost Shooter tut?
> SpriteSet animation speed to Sprite 0 .Value('variable name')
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Wed Jul 22, 2009 2:44 pm

i dont think you can do that, but if you can, it's without the quotes
enemy(animname), not enemy('animname')
if that doesnt work, you can use a hashtable
they are accessed with regular strings i believe

work out a system where you can use only one hashtable for everything if possible, because picking a hashtable without groups is nearly impossible if i remember correctly
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Jul 22, 2009 2:56 pm

unfortunately it does not work even if the quotes are removed. :(

would this technically be considdererd a bug that it doesnt work, or more of a feature request for it to work?

another solution would be if I there was an expression to retriev the default speed of a given animation. The data is there, it would sure be handy If i could just retrieve it instead of jumping through hoops. :(
B
2
S
2
G
4
Posts: 124
Reputation: 1,698

Post » Wed Jul 22, 2009 3:29 pm

a feature request
most languages dont't let directly access variables by name using a string like that, though this isn't a language exactly

you should try a hastable though, its not really jumping thru hoops. just as easy as using private vars really

its made for this kinda thing
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Jul 22, 2009 8:25 pm

thanks much for your patience and siggestions, Lucid.

I'll give hashtable a shot as soo as I get the chance.
B
2
S
2
G
4
Posts: 124
Reputation: 1,698


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests