Skip to content

How to get the action object that is currently running? #1852

Closed Answered by rh101
rudiHammad asked this question in Q&A
Discussion options

You must be logged in to vote

Multiple actions can run on a target at the exact same time, and each of those actions can be sequenced, being made up of many other actions, so what you are after wouldn't really help you.

There are many ways to do what you're trying to achieve, with a few examples below.

You can create a sub-class of Sprite, for example class PlayerSprite public ax::Sprite, and add the state variables to that, to track what state the player is currently in.

You can also create a separate PlayerState class, such as class PlayerState : public ax::Ref (ensure it inherits from ax::Ref), and add it as a a user object to the player sprite, via Node::setUserObject(Ref* userObject). You would then just do this:

a…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by rudiHammad
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants