Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Chaos-game/GML/chaos-game-1.gml
Normal file
31
Task/Chaos-game/GML/chaos-game-1.gml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
offset = 32; //Distance from triangle vertices to edges of window
|
||||
|
||||
//triangle vertex coordinates
|
||||
x1 = room_width / 2;
|
||||
y1 = offset;
|
||||
x2 = room_width - offset;
|
||||
y2 = room_height - offset;
|
||||
x3 = offset;
|
||||
y3 = room_height - offset;
|
||||
|
||||
//Coords of randomly chosen vertex (set to 0 to start, will automatically be set in step event)
|
||||
vx = 0;
|
||||
vy = 0;
|
||||
|
||||
//Coords of current point
|
||||
px = random(room_width);
|
||||
py = random(room_height);
|
||||
|
||||
//Make sure the point is within the triangle
|
||||
while(!point_in_triangle(px, py, x1, y1, x2, y2, x3, y3))
|
||||
{
|
||||
px = random(room_width);
|
||||
py = random(room_height);
|
||||
}
|
||||
|
||||
vertex = 0; //This determines which vertex coords are chosen
|
||||
max_iterations = 8000;
|
||||
step = true; //Used with the interval alarm to change the step speed
|
||||
step_count = 0;
|
||||
interval = 1; //Number of frames between each step. 1 = no delay
|
||||
alarm[0] = interval;
|
||||
34
Task/Chaos-game/GML/chaos-game-2.gml
Normal file
34
Task/Chaos-game/GML/chaos-game-2.gml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
if(step and step_count < max_iterations) //Wait for alarm to finish, or stop completely
|
||||
{ // if the desired number of iterations is hit
|
||||
vertex = choose(1, 2, 3);
|
||||
step = false;
|
||||
alarm[0] = interval;
|
||||
switch(vertex)
|
||||
{
|
||||
case 1:
|
||||
vx = x1;
|
||||
vy = y1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
vx = x2;
|
||||
vy = y2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
vx = x3;
|
||||
vy = y3;
|
||||
break;
|
||||
}
|
||||
|
||||
var dir = point_direction(px, py, vx, vy);
|
||||
var mid_dist = point_distance(px, py, vx, vy);
|
||||
var midx = px + lengthdir_x(mid_dist / 2, dir);
|
||||
var midy = py + lengthdir_y(mid_dist / 2, dir);
|
||||
instance_create_layer(midx, midy, "Instances", Point);
|
||||
|
||||
px = midx;
|
||||
py = midy;
|
||||
|
||||
step_count++;
|
||||
}
|
||||
6
Task/Chaos-game/GML/chaos-game-3.gml
Normal file
6
Task/Chaos-game/GML/chaos-game-3.gml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
if(step_count < max_iterations)
|
||||
{
|
||||
draw_triangle(x1, y1, x2, y2, x3, y3, true);
|
||||
draw_circle(px, py, 1, false);
|
||||
draw_line(px, py, vx, vy);
|
||||
}
|
||||
2
Task/Chaos-game/GML/chaos-game-4.gml
Normal file
2
Task/Chaos-game/GML/chaos-game-4.gml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
step = true;
|
||||
alarm[0] = interval;
|
||||
1
Task/Chaos-game/GML/chaos-game-5.gml
Normal file
1
Task/Chaos-game/GML/chaos-game-5.gml
Normal file
|
|
@ -0,0 +1 @@
|
|||
draw_circle(x, y, 5, false);
|
||||
Loading…
Add table
Add a link
Reference in a new issue