kureoni
Member
I'm programming a boss that spawns areas of damage across the map, but right now some areas spawn in the same place or too close to each other,
thats the code for the spawning in an alarm event, it uses random ranges to define the y and x of the damage areas, of course that there is nothing in this code that set any spacing, so, how can i change this code to:
1- spawn the areas of damage randomly in a pre-defined area
2- set a space between the areas so them will be well spread across the map
the image shows how they are spawning rn
thats the code for the spawning in an alarm event, it uses random ranges to define the y and x of the damage areas, of course that there is nothing in this code that set any spacing, so, how can i change this code to:
1- spawn the areas of damage randomly in a pre-defined area
2- set a space between the areas so them will be well spread across the map
GML:
if(instance_exists(obj_player)) && life >0{
xis1=irandom_range(375,1200)
yps1=irandom_range(220, 570)
xis2=irandom_range(375,1200)
yps2=irandom_range(220, 570)
xis3=irandom_range(375,1200)
yps3=irandom_range(220, 570)
xis4=irandom_range(375,1200)
yps4=irandom_range(220, 570)
xis5=irandom_range(375,1200)
yps5=irandom_range(220, 570)
with(instance_create_layer(xis1, yps1,"Instances", obj_thirdblaze_bullet)){
depth=200
}
with(instance_create_layer(xis2, yps2,"Instances", obj_thirdblaze_bullet)){
depth=200
}
with(instance_create_layer(xis3, yps3,"Instances", obj_thirdblaze_bullet)){
depth=200
}
with(instance_create_layer(xis4, yps4,"Instances", obj_thirdblaze_bullet)){
depth=200
}
with(instance_create_layer(xis5, yps5,"Instances", obj_thirdblaze_bullet)){
depth=200
}
alarm[0]=120
}
Attachments
-
214.3 KB Views: 3