Sporkinator icon

makeRandomObjects

Sporkinator | PRO | 09/27/11 09:43:52 AM UTC | 0 ⭐ | 232 👁️ | Never ⏰ | []
text |

850 B

|

None

|

0 👍

/

0 👎

//Variables
var i, ind, objList;
ind = 0;
//Generate a list of all objects using an array named objList
for (i = 0; i < 1000; i += 1) //check the first 1000 possibilities (1000 is just an arbitrary large number)
{   //check if object resource with index exists, but exclude rose and parent
    if (object_exists(i) && i != object_hidden_parent && i != object_rose)
    {
        objList[ind] = i; //Add the object to the array
        ind += 1; //increment the counter to the next position in the array
    }
}
var me;
repeat(argument0) //repeat many times
{
    //create a random object at a random position
    me = instance_create(irandom(room_width), irandom(room_height), objList[irandom(ind - 1)]);
    //debug message commented below
    //show_message("I am "+object_get_name(me.object_index)+" located at ("+ string(me.x)+","+string(me.y)+")");
}

Comments