Flip Enemy towards walking direction

2D Mobile Game

Objective: Flip Moss Giant to left when walking left and to right when walking right.

First of all create a reference to the Sprite renderer of the sprite where we can flip the player in x/y axis; in this case x-axis.

Then create a condition which check the target destination of the enemy and flip according to the direction. Be sure to place it above the condition where you change the target to make sure that the player doesn’t flip before idle animation.

And this is the final result.




Unity Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Is Outsourcing Testing Services the New Future?

Production Stability Updates

Get Started with CloudFormation the Easy Way

A Helper App for Smite Duelists — Part 1, Wireframes

How To Interact With AWS Using AWS Data Wrangler

Weekly Development Update

Mollector Staking Event Announcement

Ruby Iterators

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Niraj Karki

Niraj Karki

Unity Developer

More from Medium

Adding Shield Strength And Color Change When Damaged And Tying It To UI Sprite Sheet

Galaxy Shooter 2D — Boss (Part 1 -taken damage)

Creating Character Animations in Timeline and Tackling Some Known Issues

Quick tip — Upgrading your Unity project to High Definition Render Pipeline (HDRP)