Advanced Draw Sprite Part Function ?

Imperial

Member
Hello buddies

I was wondering if you can guide me or give me any tips on how to achive this effect

I just want to draw a part of sprite, I know there is a function called draw_sprite_part but it draws the part in a rectangular shape

Is there any way to draw the part in a polygon shape (multiple points) ?

do I need to use and draw on surfaces ?

thank you for support
 

CMAllen

Member
Hello buddies

I was wondering if you can guide me or give me any tips on how to achive this effect

I just want to draw a part of sprite, I know there is a function called draw_sprite_part but it draws the part in a rectangular shape

Is there any way to draw the part in a polygon shape (multiple points) ?

do I need to use and draw on surfaces ?

thank you for support
For that, you'd need to handle drawing things a little differently. The underlying code for drawing sprites in GMS operates under the assumption that all sprites are rectangles. But you can work around that limitation by using GMS's draw_primitive functions. You'd need to get the ID of the texture page you want to draw from, and then work out the UV coordinates on that texture page for the parts you want to draw.

Note that drawing in this way will interrupt GMS's batching process, which can slow things down, so it should be used sparingly.

For some additional info: draw_primitive tutorial video

Another way is dynamic masking, which has some limitations and requires drawing things in particular ways.
Dynamic Render Masks
 
Last edited:
Top