Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> A question about sprite rotation in GM
United States
Project_MK
Posted: Apr 9 2009, 07:02 PM
Quote Post


Wayward Vagabond
[*][*][*][*]

Group Icon
Group: Members
Posts: 1763
Member No.: 3159
Joined: 7-January 07

Status: (0d) [--]


Is it possible to make a sprite rotate on a fixed point? If so, how?
Thank you to anyone who helps :]


--------------------

user posted image
Click banner for reference.
PMEmail PosterAOLYahooMSN
Top
Australia
mirror
Posted: Apr 9 2009, 07:14 PM
Quote Post


Derp
[*][*]

Group Icon
Group: Members
Posts: 317
Member No.: 6148
Joined: 3-April 09

Status: (0d) [--]


It really depends where you want it, for setting where you want it, edit the x and y origins. (I presume you mean using the image_angle code?)


--------------------
PMEmail PosterMSN
Top
United States
Project_MK
Posted: Apr 9 2009, 07:37 PM
Quote Post


Wayward Vagabond
[*][*][*][*]

Group Icon
Group: Members
Posts: 1763
Member No.: 3159
Joined: 7-January 07

Status: (0d) [--]


QUOTE (mirror @ Apr 9 2009, 06:14 PM)
It really depends where you want it, for setting where you want it, edit the x and y origins. (I presume you mean using the image_angle code?)

okay, let me get more in-depth;
I want a sprite that is 16x24 pixels to rotate following the mouse in a 360o style with the fixed pixel to be at (13,3). I'm not too sure how to do this, but the command you mentioned (image_angle) certainly came to mind.

This post has been edited by Project_MK on Apr 9 2009, 07:38 PM


--------------------

user posted image
Click banner for reference.
PMEmail PosterAOLYahooMSN
Top
Australia
mirror
Posted: Apr 9 2009, 07:42 PM
Quote Post


Derp
[*][*]

Group Icon
Group: Members
Posts: 317
Member No.: 6148
Joined: 3-April 09

Status: (0d) [--]


set the x origin to 8 and the y origin to 12, if you use the image_angle code it will spin on the spot.


--------------------
PMEmail PosterMSN
Top
Japan
Soiyeruda
Posted: Apr 9 2009, 07:55 PM
Quote Post


Because retarded looking women is fun. :S
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 3589
Member No.: 5004
Joined: 6-March 08

Status: (0d) [--]


Turns out, there's this nifty function called point_direction, which basically sets the angle from one point to another.

Make this code in your object's step event.

CODE
image_angle=point_direction(x,y,mouse_x,mouse_y)


May have to tweak around with it a little (I had to), but that's the closest thing I could find.
PMEmail Poster
Top
United States
Project_MK
Posted: Apr 9 2009, 09:03 PM
Quote Post


Wayward Vagabond
[*][*][*][*]

Group Icon
Group: Members
Posts: 1763
Member No.: 3159
Joined: 7-January 07

Status: (0d) [--]


QUOTE (Soiyeruda @ Apr 9 2009, 06:55 PM)
Turns out, there's this nifty function called point_direction, which basically sets the angle from one point to another.

Make this code in your object's step event.

CODE
image_angle=point_direction(x,y,mouse_x,mouse_y)


May have to tweak around with it a little (I had to), but that's the closest thing I could find.

Thank you! Vedy much!


maybe now tobin'll shut up...


--------------------

user posted image
Click banner for reference.
PMEmail PosterAOLYahooMSN
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0462 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 2.14 ]