Well, it kinds of depends on your setup, if you are using a BrainManager with a "StandardBase", it's very easy.
Just set the direction like this:
Code:
this:SetFacing(C_FACING_LEFT);
(Or use SetFacingTarget() if you want the character to actually rotate/turn towards the direction instead of instantly change)
And if you have a visual profile setup, it will automatically use the correct animation for the active direction.
Or, if you're doing things in vector math and don't want to mess with the direction constants, you can do it like this:
Code:
this:SetFacing(VectorToFacing(Vector2(0,1)))
(0,1 means "down" in a unit vector, 0 on the x axis, and 1 on the Y axis)
If you are not using a StandardBase brain (or no brain, that's ok too), but still want the ease of use of visual profiles, manually set things every time there is a change like this:
Code:
this:SetVisualState(C_VISUAL_STATE_IDLE);
this:SetFacing(C_FACING_LEFT);
this:SetSpriteByVisualStateAndFacing();
Bookmarks