Hello,

Apologies, this is probably a super simple thing to do. I'm new to Unity in general. I've been doing the ORK Framework tutorial bit by bit, then applying what I've learned into a top-down 2D project using both ORK and Makinom.

I have made a 2D character controller with Makinom that moves my player sprite right, left, up and down. My sprite is a simple fish with 4 sprites. I have a right, left, up and down facing sprite. Default is right sprite and the character moves perfectly. All I want to accomplish is to change the sprite to match whichever of the 4 directions it's facing and leave the most recent facing sprite when the character isn't moving.

Can I do this in my Makinom player controller? Or should I make a different schematic? I have 1-frame animations built in my project for each of the facing directions, but not sure how to apply them when moving a certain direction.

Any help is appreciated. Thanks!
  • You can either do that directly in your control schematic or use a 2nd schematic that just monitors the game object's state and plays the relevant animation.

    For a simple solution, just add playing those animations (after having them set up in Mecanim or legacy animation system) when moving into a direction.

    In case you want to add more animations later down the line, it could be a good idea to create a 2nd schematic that only handles the animations and keep control and animation separate.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks so much for the response and advice!

    I'm most of the way there now. I added the mecanim animations to my Makinom PlayerMover schematic. The correct animations play while I'm moving, but then my sprite returns to its default position as soon as it stops. In mecanim, I'm using a blend tree to set the animation according to the simple 2D directional movement and X and Y parameters. For example, Up plays when X = 0 and Y = 1 and so on.

    I'm thinking it might be a good idea to split up my player mover and animation into 2 schematics as you suggested. That might be an easier way to get my sprite to keep facing the direction it was going when it stops. Still having trouble figuring out how to achieve that. I've seen online videos of people doing it in code, but I'm still new to Unity and am hoping I can use Makinom to handle playing this animation. But I'm still shaky on interpreting that code into how to do it in a schematic.

    I'll keep researching and trying to figure it out, but if you or anyone on here has any helpful advice for a newbie in that regard, I'm all ears :)

    Take care!
  • To keep it on the sprite you want, you'll need to have a looping animation or set up the animator controller in a way that it'll stay on that state. Otherwise the animator will just return to another animation which probably has your default sprite/direction in it.

    Alternatively, you can also change sprites in schematics :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you so much for all the help!

    With that and some more research online, I managed to get it working how I want and also figured out how to add a 'run' button to boost speed while pressed. Simple stuff, but I'm getting a better feel for how everything works the more I use Unity. It's a great feeling when something you've been trying to achieve finally works in your game :)
Sign In or Register to comment.