Ember

Initialize

May 16th, 2011
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //This code will use all the spawn point objects in the room to create an array of spawn points
  2.  
  3. //First, declare the variables (global variables too)
  4. globalvar i, spawn;
  5. var object;
  6. i = 0;
  7. object = noone;
  8.  
  9. //Now to initilize the array
  10.  
  11. //First, set the initialze variable to the number of spawn points the array will contain
  12. spawn = instance_number(P1_coin_spawn);
  13.  
  14. //Now to set the actual array values
  15. repeat(spawn)
  16. {
  17.     //First get the spawn object
  18.     object = instance_find(P1_coin_spawn,i);
  19.    
  20.     //Now set the array to the object's position
  21.     spawn[i,0] = object.x;
  22.     spawn[i,1] = object.y;
  23.    
  24.     //Now to increment i by one
  25.     i += 1;
  26. }
  27.  
  28. //And all done!
Advertisement
Add Comment
Please, Sign In to add comment