• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to generate collision masks for each sprite part?

S

shadow7692

Guest
For my animations, I'm using a sprite sheet. This means that I use draw_sprite_part() and just change the X and Y to essentially move through each box in the row for it to look animated. I am trying to implement a hitbox and am having trouble generating the collision masks.

I have a separate sprite sheet for my hitboxes, each X and Y 'box' corresponds to the same 'box' as the animation frame. I know that I must create a collision mask but I don't know how to make gamemaker generate one automatically, then assign that hitbox collision mask to the sprite.

Any ideas? I'm not looking for someone to write me code, but rather explain how I should go about this and any useful built-in functions I might need to use. Also links would be really useful too. Thanks in advance!
 

LEGOlars

Member
Why not take advantage of the possibility to add frames? You can easily convert your spritesheet into an animated sprite with seperate frames.

If you want to want to make use of external sprite sheets, so e.g. your players can make their own characters with sprite sheets, you can draw those sprite sheet to a surface and then use sprite_create_from_surface() and then sprite_add_from_surface() to create the sprite's frames during runtime.
 
Top