Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------
- When I say "put shapewrite(); or put path_shape();, you have to put the arguments, you can't leave them blank
- SCRIPTS ARE AT THE BOTTOM
- -----------------
- Guide for w/ a path
- 1. Create blank room (preferably in a new engine/blank GMK file)
- 2. Make a path [Refer to bottom if you're doing this without a path]
- 3. Make object that uses this path with path_shape(); in create event
- 4. Place the object in the room and make sure it's what you want
- 5. After that, go back into the object that does path_shape();
- 6. Go into the create event and add "alarm[0]=2" without quotations
- 7. Create an alarm0 event and put shapewrite(); in it
- 8. Make sure you know where your gm81/gmk file is located and run the game
- 9. After running it, a text file should appear in there
- 10. That is the script for the shape you have created
- Notes--
- path_shape(); does NOT have to be used, it's there for convenience
- if you don't want to place cherries individually in the room
- if you use path_shape();, when you go to make shapewrite();, argument0
- is the exact same number you used for argument1 in path_shape();
- ^argument1 in path_shape(); is total number of cherries in shape^
- if you do not use path_shape, i'm afraid you'll have to count how many
- cherries you placed, if you do not put the correct amount, your shape
- will not be created all of the way and a portion will be missing
- i have no idea what happens if you place an arbitrary number^
- you put alarm[0]=2; into the code to prevent it from writing blank cherries
- (this does not happen if you don't use path_shape(); because it takes time
- for the path to be created [1 step])
- Guide for w/o a path
- 1. Create blank room (preferably in a new engine/blank GMK file)
- 2. Place cherries in the room the way you like (remember, the center of the shape is 400,304)
- 3. Create an object and in the create event, put shapewrite(); in it
- 4. Place the object in the room
- 5. Make sure you know where your gm81/gmk file is located and run the game
- 6. After running it, a text file should appear in there
- 7. That is the script for the shape you have created
- -----------------
- shapewrite();
- -----------------
- // shapewrite();
- // argument0 = number of fruit
- // argument1 = object
- // argument2 = name of text file (put quotes!!!)
- file=file_text_open_write(argument2+".txt") // name of the textfile you're writing to
- for(i=1; i<=argument0; i+=1){
- 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)));
- file_text_writeln(file);
- 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)));
- file_text_writeln(file);
- file_text_writeln(file);
- }
- file_text_write_string(file, "steps=1;");
- file_text_writeln(file);
- file_text_write_string(file, "frame=argument2;");
- file_text_writeln(file);
- file_text_write_string(file, "repeat("+string(i-1)+"){");
- file_text_writeln(file);
- file_text_write_string(file, "b=instance_create(argument0,argument1,argument4);");
- file_text_writeln(file);
- file_text_write_string(file, "b.direction=variable_local_get("+'"'+"dire"+'"'+"+string(steps))+argument3;");
- file_text_writeln(file);
- file_text_write_string(file, "b.speed=variable_local_get("+'"'+"length"+'"'+"+string(steps))/frame;");
- file_text_writeln(file);
- file_text_write_string(file, "steps+=1;");
- file_text_writeln(file);
- file_text_write_string(file, "}");
- file_text_writeln(file);
- file_text_writeln(file);
- file_text_write_string(file, "// argument0 = shape center x");
- file_text_writeln(file);
- file_text_write_string(file, "// argument1 = shape center y");
- file_text_writeln(file);
- file_text_write_string(file, "// argument2 = length objects are on screen");
- file_text_writeln(file);
- file_text_write_string(file, "// argument3 = angle");
- file_text_writeln(file);
- file_text_write_string(file, "// argument4 = object");
- file_text_writeln(file);
- file_text_writeln(file);
- file_text_write_string(file, "// --- IGNORE ---");
- file_text_writeln(file);
- file_text_write_string(file, "// gamemaker is broken with text writing so i have to put these here");
- file_text_writeln(file);
- file_text_write_string(file, "// this is filler space");
- file_text_writeln(file);
- file_text_write_string(file, "// gamemaker why");
- file_text_writeln(file);
- file_text_write_string(file, "// why do i have to put these here just to wrte all of the code dsfdsfds");
- file_text_writeln(file);
- -----------------
- path_shape();
- -----------------
- // This script creates objects along a specified path
- // argument0 = path name
- // argument1 = number of objects to be used in shape
- // argument2 = angle of path/shape
- // argument3 = size of the shape (1 is original size)
- // argument4 = object used in the shape
- for(i=1; i<=argument1; i+=1){
- a = instance_create(x,y,argument4);
- with(a){
- b = path_start(argument0,0.00000000000000000000001,1,false);
- b.path_orientation = argument2;
- b.path_scale = argument3;
- }
- a.path_position = i/argument1;
- }
- -----------------
- That is it, enjoy
- -----------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement