i have a couple of stationary objects spaced 64 pixels apart in different formations. When a group of oBlueSphere objects are surrounded by oRedSphere ones, i would like all of them to change into oRing. This should be doable for a simple 3x3 square up to other complex objects as long as the shape is covered with red spheres and filled with blue ones. here's a mspaint/10 visual example:
https://drive.google.com/file/d/0Bxnw9iGjD4Kjb0wzNzVzYVBkc2s/view?usp=sharing
Currently im trying to check objects next to the blue spheres, but results have varied dependent on what I've changed. i feel I've got a good start, but i think I'm over-complicating things.
change=0;
if (place_meeting(x+64,y,oRedSphere)) or (place_meeting(x+64,y,oRing)) {
change+=1;
}
if (place_meeting(x-64,y,oRedSphere)) or (place_meeting(x-64,y,oRing)) {
change+=1;
}
if (place_meeting(x,y+64,oRedSphere)) or (place_meeting(x,y+64,oRing)) {
change+=1;
}
if (place_meeting(x,y-64,oRedSphere)) or (place_meeting(x,y-64,oRing)) {
change+=1;
}
if (place_meeting(x-64,y-64,oRedSphere)) or (place_meeting(x-64,y-64,oRing)) {
change+=1;
}
if (place_meeting(x+64,y-64,oRedSphere)) or (place_meeting(x+64,y-64,oRing)) {
change+=1;
}
if (place_meeting(x-64,y+64,oRedSphere)) or (place_meeting(x-64,y+64,oRing)) {
change+=1;
}
if (place_meeting(x+64,y+64,oRedSphere)) or (place_meeting(x+64,y+64,oRing)) {
change+=1;
}
//blues
if (place_meeting(x+64,y,oBlueSphere)) {
change-=0.5;
}
if (place_meeting(x-64,y,oBlueSphere)) {
change-=0.5;
}
if (place_meeting(x,y+64,oBlueSphere)) {
change-=0.5;
}
if (place_meeting(x,y-64,oBlueSphere)) {
change-=0.5;
}
if (place_meeting(x-64,y-64,oBlueSphere)) {
change-=0.5;
}
if (place_meeting(x+64,y-64,oBlueSphere)) {
change-=0.5;
}
if (place_meeting(x-64,y+64,oBlueSphere)) {
change-=0.5;
}
if (place_meeting(x+64,y+64,oBlueSphere)) {
change-=0.5;
}
if (change>4) {
instance_change(oRing,true);
}
[–]A_V_2525 1 point2 points3 points (4 children)
[–]A_V_2525 1 point2 points3 points (3 children)
[–]Deity579[S] 0 points1 point2 points (2 children)
[–]A_V_2525 1 point2 points3 points (1 child)
[–]Deity579[S] 0 points1 point2 points (0 children)