GML [SOLVED] Rotate Sprite Not Possible When Using draw_sprite_part_ext???

F

FYVE

Guest
Hey,

Is it not possible to rotate a sprite if it's drawn using draw_sprite_part_ext?

image_angle doesn't seem to be working.

Thanks,

J.D
 
F

FYVE

Guest
Next problem... I'm only drawing a section of a larger sprite but the x and y origin location is always 0, 0, of the frame I have sectioned off. How to I alter the x and y offset to be bottom centre?
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Next problem... I'm only drawing a section of a larger sprite but the x and y origin location is always 0, 0, of the frame I have sectioned off. How to I alter the x and y offset to be bottom centre?
You would use lengthdir_x/lengthdir_y - two for horizontal offset (X offset for length, used angle for direction) and two for vertical offset (Y offset for length, used angle - 90 for direction).
 
F

FYVE

Guest
That sounds kind of confusing. My fame_width = 32 and frame_height = 64. Could you give me an example of the code using those dimensions?
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
That sounds kind of confusing. My fame_width = 32 and frame_height = 64. Could you give me an example of the code using those dimensions?
Code:
var tx = 32, ty = 32;
var td = point_direction(x, y, mouse_x, mouse_y) - 90;
draw_sprite_general(spr, 0, 32,32,64,32,
    x - lengthdir_x(tx, td) - lengthdir_x(ty, td - 90),
    y - lengthdir_y(tx, td) - lengthdir_y(ty, td - 90),
    1, 1, td, c_white, c_white, c_white, c_white, 1);
live demo
 
F

FYVE

Guest
Code:
draw_sprite_general(spr_crops, 0, growth_stage*frame_width, crop_type*frame_height, frame_width, frame_height, xx, yy, .5, .5, image_rot, c_white, c_white, c_white, c_white, 1);
That's what I have already in my draw_sprite_general. It's drawing different sections of a bigger sprite... Growth stage is left to right and crop type is top to bottom.

Still not quite getting it. I guess it's over my head... I wish I could just set the x and y offset after I draw the section of the sprite. I've tried that but it stays at 0, 0.

Thanks for you help regardless. I appreciate it
 
Top