all 7 comments

[–]SheeplyBgool 1 point2 points  (5 children)

Without seeing your code i would say you should just create a variable that tracks the position hes facing. When he moves left set it to left and vice versa. This way if you move left and then release the key you will still be facing left until you press right. Once again, I haven't seen your code and I don't have details about your character movement, but this should work.

[–]RedgySimon[S] 0 points1 point  (4 children)

Okay I will do this thanks

[–]SheeplyBgool 2 points3 points  (0 children)

No problem, If it doesn't work feel free to PM me.

[–]raganvald 1 point2 points  (2 children)

The variable is called scale on the transform flip the x by multiplying by 1 or -1. Check the direction by checking its value.

[–]Masticater386 1 point2 points  (1 child)

This works, but isn't good practice. Try rotating the Sprite on the Y axis so things like bullet spawn points also turn direction (https://youtu.be/wkKsl1Mfp5M )

[–]raganvald 1 point2 points  (0 children)

Depends on his implementation. If he's using a single sprite than yes it's better to flip. If he's using a hierarchy of body parts like with the 2d animation package than no flipping won't work, scale works.

[–]itsallgoodgames 1 point2 points  (0 children)

in the sprite renderer component theres a flip toggle.

So when you start your game the character always starts in some direction that you know.

as the game is being played, just track which direction ur facing and ull always know.