• 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!

Is it possible to scale a sprite that is used as a collision mask on an Object from code?

wilmer

Member
Hello everybody:

I have the object of my Character and assign as a collision mask a sprite that measures almost the same as my character, but there is an animation where my character must crouch (I do not know if it is the most recommended), in this case I would need the sprite of collision mask will scale to a smaller size. How can I do it?
 

Slyddar

Member
You can assign another mask using the mask_index variable. Just assign it to whatever sprite has the mask you need when you need it.

Also you can draw the mask over the sprite by adding this to a draw event, which is handy for ensuring it is working.
Code:
//normal draw
draw_self();

//Draw bounding box mask
draw_set_alpha(0.3);
draw_rectangle_colour(bbox_left,bbox_top,bbox_right,bbox_bottom,c_red,c_red,c_red,c_red,false);
draw_set_alpha(1);
 
Top