How to move arms and head of my character to look at mouse in 2d game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By p7f

Hi,
I have a 2d character with ranged weapon. I want it to aim to the position of the mouse (like for example, aiming in worms game, but with mouse). My question is, how can i make arms and head look at mouse but remain rest of the body on idle?

I was thinking in adding 4 sprites to my kinematicbody2d, one for each arm, one for head, and one for the rest… then aply rotation to arms and head acording to mouse position. Is this the correct way to do so?

I’m new to godot engine.

Thanks

:bust_in_silhouette: Reply From: MysteryGM

The arms wouldn’t really need collisions but yes the idea is that the arms would be separate from the body; at least if you want a worms style game.

Take a look at the Godot 2D movement overview to get some idea of what your options are for rotating the arms.

You could also use animations and many other tricks.

Thanks a lot!
I’ll go with sepparate parts for the body then… i just wanted to know if it was a good idea or not! Thanks!

p7f | 2018-11-09 17:30