hello i am creating a level edtior and i need to know when i create a rectangle it fills it with instances plz answer this would be awesome to have
Filling a rectangle with instances
Started by Jacepwns21, May 27 2012 08:01 AM
2 replies to this topic
#1
Posted 27 May 2012 - 08:01 AM
#2
Posted 27 May 2012 - 09:26 AM
im gonna asume your rectangle is made from x1,y1,x2,y2
so you just have to xpos=clamp(xpos,x1,x2);
ypos=clamp(ypos,y1,y,2);
you need to do something to pick where u want it in the rectangle, this will just force it to be within
or
xpos=x+random_range(0,(x2-x1));
ypos=y+random_range(0,(y2-y1));
this should create the instances randomly in the rectangle.
if you want the instances to apear automatically you need to use a loop and put this in and instance_create(xpos,ypos,obj);
so you just have to xpos=clamp(xpos,x1,x2);
ypos=clamp(ypos,y1,y,2);
you need to do something to pick where u want it in the rectangle, this will just force it to be within
or
xpos=x+random_range(0,(x2-x1));
ypos=y+random_range(0,(y2-y1));
this should create the instances randomly in the rectangle.
if you want the instances to apear automatically you need to use a loop and put this in and instance_create(xpos,ypos,obj);
#3
Posted 27 May 2012 - 03:30 PM
And yet some part of me has this nagging fear he wants to use this information for something that could much more easily be done with tiles but will instead create a laggy game inundated with useless objects like most level editors. Oh well, I'll keep my fingers crossed until they cramp up.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











