GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2019-08-08 15:15:32

ClunkyDev
Member
Registered: 2019-08-08
Posts: 1

draw_collision_mask()

I made a script that draws a simple rectangular collision mask of an instance:

/// draw_collision_mask(color)
//
//  Draws a collision mask of an instance as a rectangle
//
//      color       color of drawn mask
//
/// GMLscripts.com/license
{
	var color;
	color = argument0;
    draw_set_color(color);
	draw_set_alpha(0.1);
	draw_rectangle(bbox_left,bbox_top,bbox_right,bbox_bottom,false);
	draw_set_alpha(0.3);
	draw_rectangle(bbox_left,bbox_top,bbox_right,bbox_bottom,true);
	draw_set_alpha(1);
}

Last edited by ClunkyDev (2019-08-08 15:17:34)

Offline

#2 2019-08-08 17:05:18

xot
Administrator
Registered: 2007-08-18
Posts: 1,201

Re: draw_collision_mask()

This could be really useful for debugging and maybe effects too. The only thing I'd add is some code to restore global color and alpha values.

Welcome to the forums and thanks for the script.


Abusing forum power since 1986.

Offline

Board footer

Powered by FluxBB