This repository has been archived on 2025-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
spaceinator/scripts/generate_world.gml
2020-07-23 10:50:27 +12:00

28 lines
828 B
Text

///Generate World Chunks
show_debug_message(obj_controller_world_gen.generated_count);
var xmax = obj_player.x - view_wview[0]/2;
var ymax = obj_player.y - view_hview[0]/2;
for(var xx = 0; xx < view_xview[0]+view_wview[0];xx+=32)
{
for(var yy = 0; yy < view_yview[0]+view_hview[0];yy+=32)
{ var expe = string(xx)+string(yy)
for(var i = 0; i <= obj_controller_world_gen.generated_count; i++)
{
if(obj_controller_world_gen.generated_areas[i] == expe)
{
return 0;
}
}
obj_controller_world_gen.generated_areas[obj_controller_world_gen.generated_count] = expe;
obj_controller_world_gen.generated_count ++;
if(random_range(0,10) > 5)
{
instance_create(xx,yy,obj_asteriod);
}
}
}