Skip to main content

L 8

got a pretty decent algorithm for creating land, but haven't been able to add any form of consistency.

randomize()

if genstage = 0 {
while (cposx < room_width && cposy < room_height) {
failure = distance_to_point(centerx,centery);
success = distance_to_object(obj_land)
chance = (irandom_range(0,failure));
if(chance < 50) {
instance_create_depth(cposx,cposy,0,obj_land);
cposx += 64;
show_debug_message(failure);
show_debug_message(success);
show_debug_message(chance);
}
else {
instance_create_depth(cposx,cposy,0,obj_ocean);
cposx += 64;
}
if (cposx == room_width && cposy != room_height) {
cposy += 64;
cposx = 0;
}
else {
genstage = 2;
}
}
}

here is a photo of the finished product


Comments