Comunidad Game Maker

Ayuda => Desarrollo de Scripts => Mensaje iniciado por: bygdle en Diciembre 05, 2015, 10:12:06 PM

Título: Dibujar Cuadrícula
Publicado por: bygdle en Diciembre 05, 2015, 10:12:06 PM
Autor: NiuWeb
Versión GM: GM8 : GMS
Descripción: Dibuja una cuadrícula/tabla en la pantalla [Evento Draw]
Código:
[gml]
///draw_grid(x,y,cell_w,cell_h,tile_w,tile_h);
//Author: NiuWeb
//Licence: Free to use for anyone, also for comercial games. Give credits to the author when publishing your game :D
var xx, yy, cell_w, cell_h, tile_w, tile_h, i, e;
xx = argument0;
yy = argument1;
cell_w = argument2;
cell_h = argument3;
tile_w = argument4;
tile_h = argument5;

//rows
for(i=0;i<tile_h;i+=1)
draw_line(xx,yy+(i*cell_h),xx+(tile_w*cell_w),yy+(i*cell_h));
//Columns
for(e=0;e<tile_w;e+=1)
draw_line(xx+(e*cell_w),yy,xx+(e*cell_w),yy+(tile_h*cell_h));
//Fill grid
draw_line(xx,yy+(cell_h*tile_h),xx+(cell_w*tile_w),yy+(cell_h*tile_h));
draw_line(xx+(cell_w*tile_w),yy,xx+(cell_w*tile_w),yy+(cell_h*tile_h));
[/gml]

Argumentos:

Espero les ayude. No olviden dar créditos si desean :D