I'm working on a soon to hopefully be zombie survival game.. but I'm getting a weird glitch while trying to rotate the legs to face the direction of input (in a sum and total), so that the legs(sprite) seem like there facing towards the direction you're walking...
I have this for my movement so far..
var velocity = Vector2()
var rotationspeed = 180
var rotdir = 0
rot_dir = 0
velocity = Vector2()
velocity.x += 1
rotation += -90
velocity.x -= 1
rotation += 90
velocity.y += 1
velocity.y -= 1
velocity = velocity.normalized() * speed
the code in bold-italics is me attempting to get rotation to the legs(sprite) movement.. but I see now that the glitch is probably my code attempting to rotate my whole kinematic-body and my body(sprite) is attempting to follow the mouse at the same time.. so I suppose my new question is..
How would I move the legs of my character separately to the body with key input?
(while keeping my body and legs in place of the whole kin-body)
(I'll figure that part out if I can manage to rotate sprite animation with key in put without it effecting my movement)