Hey!
I am creating an adventure game, with a platformer game controls. I use CUSTOM MOTION CONTROLLER, and I do not use any ANIMATION ENGINE (I am using the standard unity animator system). Now I want the player to move to a marker, whenever I click the hotspot, detected by player vicinity. I do not want to use a "Character : Move to point", because of these reasons
I would like to create my custom action, which will include animation playing, player flipping (whether the marker is on the right, or on the left), changing the x position of the player until he reaches the marker (an empty object). I tried to search through your tutorials on how to make an Action, but you covered only the disposable action (like change one parameter), but this Action requires the looping of it until it reaches the point, which I didn't figure out on how to do it.
I would be delighted if you could just help me with this Action because I really need this feature to make my game work.
Thank you really much for your response!
WOLF FLARE
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
If you would like to the "Animation engine" field to change to "Automatic" whenever the Player moves along a path, you can do so by hooking into the OnCharacterSetPath / OnCharacterEndPath custom events:
In the latest AC release, this is now set to whatever the Rigidbody 2D's Gravity Scale is originally set to.
See the comments inside the provided ActionTemplate script. To have an Action last more than a frame, your Run function needs to return the duration before it is next run.
If this is non-zero, the Run function will continue to be invoked until isRunning is False, and you return zero.
To have an Action wait just one frame repeatedly, so that the Run can check each frame if something has been completed (like an Update) function, return "defaultPauseTime". This is a typical pattern for that kind of behaviour: