when you turn the cursor, the head was rotated, and when you turn 45° the body was turned how to do

this is what I wanted to do as I wanted to do