Facing direction of the mouse

For questions about using Classic.

Post » Sun Oct 04, 2009 9:08 pm

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?
B
2
G
3
Posts: 68
Reputation: 986

Post » Sun Oct 04, 2009 11:20 pm

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!
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Mon Oct 05, 2009 8:15 am

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
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Oct 05, 2009 7:18 pm

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
B
2
G
3
Posts: 72
Reputation: 994

Post » Mon Oct 05, 2009 8:32 pm

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.
B
2
G
3
Posts: 68
Reputation: 986

Post » Mon Oct 05, 2009 8:50 pm

global('FASTMODE')

not sure about your interface problems though
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Oct 05, 2009 8:51 pm

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
B
2
G
3
Posts: 72
Reputation: 994

Post » Mon Oct 05, 2009 10:22 pm

I don't have a system icon, lol.
B
2
G
3
Posts: 68
Reputation: 986

Post » Mon Oct 05, 2009 11:24 pm

[quote="Farmrush":2njc0gvf]I don't have a system icon, lol.[/quote:2njc0gvf]
Au contraire :wink: 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.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Oct 05, 2009 11:42 pm

I don't see a parameter page.
B
2
G
3
Posts: 68
Reputation: 986

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests