x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[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?

Product Version: Not Selected
Tags:
more ▼

asked Jan 11 '15 at 08:45 AM in Blueprint Scripting

avatar image

LouizEchi
11 2 3 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Jan 12 '15 at 01:42 PM

avatar image

Erasio
5.9k 291 86 293

avatar image LouizEchi Jan 14 '15 at 07:22 AM

ok ill try this one and get back to you thanks

avatar image LouizEchi Jan 14 '15 at 09:54 AM

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

avatar image oppne Jan 23 '17 at 10:01 AM

Could you please post pictures? Mine is acting weird

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question