[PAPER2D] How to make a sprite follow the mouse cursor properly?

I made some coding with our project making a sprite follow a mouse. I did it but its movement is limited with only a small portion of the screen. So how do I code it so that the sprite follows the mouse cursor to every part of the screen on different screen sizes?

Inside of your Controller you have the node “Get mouse position” (or “get cursor position”… I always forget which).

This will simply return the current position of your cursor on the screen in pixels which will therefore work for every screensize.

If you have a 3Dish level you could also do a “Get Hit Result under Cursor” to get the location inside of the level.

I hope this helps a little.

Cheers

ok ill try this one and get back to you thanks

I used Get Mouse Position but it limited the movement of the sprite that was following my mouse by half since the x axis would not go below zero, so instead of get mouse position I found and used convert mouse location to world space node. it worked wonderfully. thanks for the answer anyway it lead me to this

Could you please post pictures? Mine is acting weird