Advertisement
Sandsky0

complex shapes w/o stupid math

Sep 4th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.12 KB | None | 0 0
  1. -----------------
  2. When I say "put shapewrite(); or put path_shape();, you have to put the arguments, you can't leave them blank
  3. SCRIPTS ARE AT THE BOTTOM
  4. -----------------
  5.  
  6. Guide for w/ a path
  7.  
  8. 1. Create blank room (preferably in a new engine/blank GMK file)
  9.  
  10. 2. Make a path [Refer to bottom if you're doing this without a path]
  11.  
  12. 3. Make object that uses this path with path_shape(); in create event
  13.  
  14. 4. Place the object in the room and make sure it's what you want
  15.  
  16. 5. After that, go back into the object that does path_shape();
  17.  
  18. 6. Go into the create event and add "alarm[0]=2" without quotations
  19.  
  20. 7. Create an alarm0 event and put shapewrite(); in it
  21.  
  22. 8. Make sure you know where your gm81/gmk file is located and run the game
  23.  
  24. 9. After running it, a text file should appear in there
  25.  
  26. 10. That is the script for the shape you have created
  27.  
  28. Notes--
  29.  
  30. path_shape(); does NOT have to be used, it's there for convenience
  31. if you don't want to place cherries individually in the room
  32.  
  33. if you use path_shape();, when you go to make shapewrite();, argument0
  34. is the exact same number you used for argument1 in path_shape();
  35. ^argument1 in path_shape(); is total number of cherries in shape^
  36.  
  37. if you do not use path_shape, i'm afraid you'll have to count how many
  38. cherries you placed, if you do not put the correct amount, your shape
  39. will not be created all of the way and a portion will be missing
  40.  
  41. i have no idea what happens if you place an arbitrary number^
  42.  
  43. you put alarm[0]=2; into the code to prevent it from writing blank cherries
  44. (this does not happen if you don't use path_shape(); because it takes time
  45. for the path to be created [1 step])
  46.  
  47. Guide for w/o a path
  48.  
  49. 1. Create blank room (preferably in a new engine/blank GMK file)
  50.  
  51. 2. Place cherries in the room the way you like (remember, the center of the shape is 400,304)
  52.  
  53. 3. Create an object and in the create event, put shapewrite(); in it
  54.  
  55. 4. Place the object in the room
  56.  
  57. 5. Make sure you know where your gm81/gmk file is located and run the game
  58.  
  59. 6. After running it, a text file should appear in there
  60.  
  61. 7. That is the script for the shape you have created
  62.  
  63. -----------------
  64. shapewrite();
  65. -----------------
  66.  
  67. // shapewrite();
  68.  
  69. // argument0 = number of fruit
  70. // argument1 = object
  71. // argument2 = name of text file (put quotes!!!)
  72.  
  73. file=file_text_open_write(argument2+".txt") // name of the textfile you're writing to
  74.  
  75. for(i=1; i<=argument0; i+=1){
  76. file_text_write_string(file, "dire"+string(i)+"="+string(point_direction(instance_find(argument1,i-1).x,instance_find(argument1,i-1).y,400,304)));
  77. file_text_writeln(file);
  78. file_text_write_string(file, "length"+string(i)+"="+string(point_distance(instance_find(argument1,i-1).x,instance_find(argument1,i-1).y,400,304)));
  79. file_text_writeln(file);
  80. file_text_writeln(file);
  81. }
  82.  
  83. file_text_write_string(file, "steps=1;");
  84. file_text_writeln(file);
  85. file_text_write_string(file, "frame=argument2;");
  86. file_text_writeln(file);
  87. file_text_write_string(file, "repeat("+string(i-1)+"){");
  88. file_text_writeln(file);
  89. file_text_write_string(file, "b=instance_create(argument0,argument1,argument4);");
  90. file_text_writeln(file);
  91. file_text_write_string(file, "b.direction=variable_local_get("+'"'+"dire"+'"'+"+string(steps))+argument3;");
  92. file_text_writeln(file);
  93. file_text_write_string(file, "b.speed=variable_local_get("+'"'+"length"+'"'+"+string(steps))/frame;");
  94. file_text_writeln(file);
  95. file_text_write_string(file, "steps+=1;");
  96. file_text_writeln(file);
  97. file_text_write_string(file, "}");
  98. file_text_writeln(file);
  99. file_text_writeln(file);
  100. file_text_write_string(file, "// argument0 = shape center x");
  101. file_text_writeln(file);
  102. file_text_write_string(file, "// argument1 = shape center y");
  103. file_text_writeln(file);
  104. file_text_write_string(file, "// argument2 = length objects are on screen");
  105. file_text_writeln(file);
  106. file_text_write_string(file, "// argument3 = angle");
  107. file_text_writeln(file);
  108. file_text_write_string(file, "// argument4 = object");
  109. file_text_writeln(file);
  110. file_text_writeln(file);
  111. file_text_write_string(file, "// --- IGNORE ---");
  112. file_text_writeln(file);
  113. file_text_write_string(file, "// gamemaker is broken with text writing so i have to put these here");
  114. file_text_writeln(file);
  115. file_text_write_string(file, "// this is filler space");
  116. file_text_writeln(file);
  117. file_text_write_string(file, "// gamemaker why");
  118. file_text_writeln(file);
  119. file_text_write_string(file, "// why do i have to put these here just to wrte all of the code dsfdsfds");
  120. file_text_writeln(file);
  121.  
  122. -----------------
  123. path_shape();
  124. -----------------
  125.  
  126. // This script creates objects along a specified path
  127.  
  128. // argument0 = path name
  129. // argument1 = number of objects to be used in shape
  130. // argument2 = angle of path/shape
  131. // argument3 = size of the shape (1 is original size)
  132. // argument4 = object used in the shape
  133.  
  134. for(i=1; i<=argument1; i+=1){
  135.  
  136. a = instance_create(x,y,argument4);
  137.  
  138. with(a){
  139. b = path_start(argument0,0.00000000000000000000001,1,false);
  140. b.path_orientation = argument2;
  141. b.path_scale = argument3;
  142. }
  143.  
  144. a.path_position = i/argument1;
  145.  
  146. }
  147.  
  148. -----------------
  149. That is it, enjoy
  150. -----------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement