Set global variable to current animation frame


#1

How do I get the current animation frame from a sprite (as a number)?


#2

Look at the conditions for Sprite objects


#3

Yes I can compare the number of the current animation frame there but that is not what I want to do.
I don’t want to do:
if frame = 1 set var = 1; if frame = 2 set var = 2;… and so on.
If want something like: set var to sprite.anmation.currentFrame()


#4

Look at the Sprite expressions?


#5

What do you mean? I didn’t find a complete documentation with all functions I can call from a sprite or animation object. It is not in the auto completion system either.


#6

You can find them here:


[Solved] Use animation number in an action
#7

@ashtray did you finally achieve it?

I’m trying to do something similar and I’m blocked with your same question

Thank you


#8

Not every expression is listed in every function. You can see it for example in “change position of object” (like in 4ian’s screenshot).

This should do it:

number:

object_name.Sprite()

string:

ToString(object_name.Sprite())