Sporkinator

makeRandomObjects

Sep 27th, 2011
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. //Variables
  2. var i, ind, objList;
  3. ind = 0;
  4. //Generate a list of all objects using an array named objList
  5. for (i = 0; i < 1000; i += 1) //check the first 1000 possibilities (1000 is just an arbitrary large number)
  6. { //check if object resource with index exists, but exclude rose and parent
  7. if (object_exists(i) && i != object_hidden_parent && i != object_rose)
  8. {
  9. objList[ind] = i; //Add the object to the array
  10. ind += 1; //increment the counter to the next position in the array
  11. }
  12. }
  13. var me;
  14. repeat(argument0) //repeat many times
  15. {
  16. //create a random object at a random position
  17. me = instance_create(irandom(room_width), irandom(room_height), objList[irandom(ind - 1)]);
  18. //debug message commented below
  19. //show_message("I am "+object_get_name(me.object_index)+" located at ("+ string(me.x)+","+string(me.y)+")");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment