Facing direction of the mouse

This forum is currently in read-only mode.
  • I'm trying to have my sprite face the direction of the mouse. This is relatively simple and I've just set it to [Always] face the direction of MouseX, MouseY, but for some reason this is off by some degrees. It rotates with the mouse, but doesn't face directly at the mouse. Any ideas?

  • It's impossible to know what you're doing wrong if you don't post a .cap. My first guess would be that the image of your sprite is off. if the angel is 0 the sprite is facing to the right, so if you've painted it facing for example straight up it would be 90 degrees off.

    If you want help, allways try to privide a .cap. like 2 of 3 posts here in the help section follows a strict pattern:

    1: Help! ~random problem~

    2: Post a .cap to get help.

    3: Ok. ~.cap~

    4:~solution~

    5: Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • sprites have to be facing toward the right

    that is 0 degrees

    so if you had a sprite of an arrow like this ---->

    that would follow the mouse with the actions you said

  • well if its of by only a couple pixels, its likely to be the hotspot of your sprite is not exactly at the centre, so it points a bit more to one side

  • Yeah, I realized what I did. I feel kind of dumb, haha. Anyways I'm having another issue.

    In my resources tab on the ribbon there is no "Manage Global Variables" option. I also seem to be missing some other small things from the interface; I only have "Animator" and "Layers" in the bottom right. I haven't modified the interface so why is this?

    Also, how do I reference a global variable in my code? Say I want to increase the player speed by a global variable called FASTMODE, moving the player by "Player.X - ((200 + FASTMODE) * TimeDelta)" doesn't work. It says FASTMODE cannot be referenced or something similar so I'm assuming the error is with my syntax.

  • global('FASTMODE')

    not sure about your interface problems though

  • home tab - press project button

    you can manage it in the projecttree

    to get a global var, go to system icon - there's the get global var

  • I don't have a system icon, lol.

  • I don't have a system icon, lol.

    Au contraire It just was described in short. Here is the long part:

    When on the parameter page, you see fields for all the parameters and in the lower part of the window is a list of icons. They represent the expressions related the repective objects. When entering one of the fields, you may either type by hand (and then use, what lucid wrote) or you select the system icon via doubleclick, then in the new window with the system expressions select the system tab and afterwards "Get global variable". Click on Finish, and you will see a "global('Variable name')" inserted into the parameters field. Now just replace 'Variable name' with 'FASTMODE'.

    In this case, it doesn't make much sense, because it's faster to type it, but you do not always know exactly the syntax of an expression, and there it comes in handy.

  • I don't see a parameter page.

  • I reinstalled and everything seems fine now. Thanks.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)