Jump to content


DarkEraSky

Member Since 10 Sep 2011
Offline Last Active Jun 18 2012 05:59 PM

Topics I've Started

fill_section_with_objects

05 June 2012 - 09:26 PM

fill_section_with_objects(x,y,border_object,filler_object,xseperation,yseperation)

if !instance_position(argument0,argument1,argument2)
{
if !instance_position(argument0,argument1,argument3)
{
instance_create(argument0,argument1,argument3)
}
/////////////////////////////////////////////////////////
if !instance_position(argument0+argument4,argument1,argument2)
fill_section_with_objects(argument0+argument4,argument1,argument2,argument3,argument4,argument5)
if !instance_position(argument0-argument4,argument1,argument2)
fill_section_with_objects(argument0-argument4,argument1,argument2,argument3,argument4,argument5)
if !instance_position(argument0,argument1+argument5,argument2)
fill_section_with_objects(argument0,argument1+argument5,argument2,argument3,argument4,argument5)
if !instance_position(argument0,argument1-argument5,argument2)
fill_section_with_objects(argument0,argument1-argument5,argument2,argument3,argument4,argument5)
}

Like the title states, this code fills an entire section with the object filler_object.

set x and y to the position where this code should start creating objects.

border_object is the object that you don't want filler_object to create
anything on or past(so it acts just like if filler_object was a character and border_object was a wall).

this code will create filler_object until all position's it can acess, have been filled with filler_object.

set xseperation and yseperation to how much you want the next creation to shift over.
(commonly use the width of the sprite and the height of the sprite of filler_object )
sprite_get_height(ind)
sprite_get_width(ind)


Oh yes, i put this code to a CPU speed test, and it's looking good.
(when used right)