How to get the head to attach to the body and follow the mouse

ok so im making a game but idk how to attach the head to the top of the body and get the head to follow the mouse

3 Likes

so you want the head to be at the same position as the body and for it to rotate so it’s looking at the cursor?

2 Likes

yes but i just want the head to be following the mouse and yes i want the head to be on the body

2 Likes

Do these steps:

  1. Open the sprite editor for the head and center the head.
  2. In the body, use a once and attacher that is set to the head.
  3. Copy the code below into the head.
  4. Delete the head in the level.

3 Likes

can you make a example @JR_01 because some of these you need the math and i can see it

2 Likes

The expression is:
A<0? A+360:A

2 Likes

hey @JR_01 why is there 2 line on flip and its looking like its going to filter

2 Likes

and its not working can you just make a example to show me

2 Likes

Because its not:
image

Also its not working because you did none of the other steps.

3 Likes

why delete the head?

2 Likes

Because attach spawns a new head to center on the body.

2 Likes

oh ok ill try it but thats for the head where for the body

2 Likes

Just add an attach set to head.

image

2 Likes

oops yea i did ill return it back

2 Likes

so put the greater then 90 and stuff in there?

2 Likes

In the head, that will help make the head not look upside down when looking the other way.

You got it :tada:

2 Likes

ok so how do i put the arm on the body because if you press edit it says name so i put 1 and 2 the 1 arm is the one you pickup stuff with and the 2 arm is the one that is the off hand

1 Like

It’s possible to 2 arms, but its a bit confusing controlling 2 arms with one object.
I suggest making 2 arm objects (left and right) and using attach for both of them in the body.

1 Like

can you put a piture or example

1 Like

I think you should give it a try first…

image