Code:

numzones = 0;
gravx = {};
gravy = {};
gravw = {};
gravh = {};
grava = {};
distchecker = 12;
function addZone(x,y,width,height,angle)
numzones = numzones + 1;
gravx[numzones] = x;
gravy[numzones] = y;
gravw[numzones] = width;
gravh[numzones] = height;
grava[numzones] = angle;
end
function resetZones()
gravx = {};
gravy = {};
gravw = {};
gravh = {};
grava = {};
numzones = 0;
end
function moveEnemy(id,velocity)
objx = mmf.Object.GetX(id);
objy = mmf.Object.GetY(id);
angle = mmf.Object.GetValue(id,24);
if mmf.Object.GetFlag(id, 27) then
zone = -1;
else
zone = checkZones(objx,objy);
end
if zone > -1 then
angle = zone + 90;
end
if mmf.Object.GetFlag(id,25) then
truth = true;
else
testx = objx + math.cos(math.rad(angle-90)) * 8;
testy = objy - math.sin(math.rad(angle-90)) * 8;
truth = mmf.Collisions.BackdropTestPoint(testx,testy,2);
end
if truth then
angle = getEnemyAngle(id,angle,velocity,objx,objy);
objx = objx + math.cos(math.rad(angle)) * velocity;
objy = objy - math.sin(math.rad(angle)) * velocity;
mmf.Object.SetX(id,objx);
mmf.Object.SetY(id,objy);
angle = angle + (29 / velocity);
if mmf.Object.GetFlag(id,26) then --disable it with flag 26
--Nothing!
else
angle = correctAngle(objx,objy,angle); --this is the fixer code. Might be bad?
end
if zone > -1 then
angle = zone + 90;
end
mmf.Object.SetValue(id,24,angle);
else
for i=0,128 do
testx = objx + math.cos(math.rad(angle-90)) * i;
testy = objy - math.sin(math.rad(angle-90)) * i;
if mmf.Collisions.BackdropTestPoint(testx,testy,2) then
j = i - 1;
testx = objx + math.cos(math.rad(angle-90)) * j;
testy = objy - math.sin(math.rad(angle-90)) * j;
mmf.Object.SetX(id,testx);
mmf.Object.SetY(id,testy);
return;
end
end
angle = angle + 45; --if no solid ground is found, rotate!
mmf.Object.SetValue(id,24,angle);
return;
end
end
function getEnemyAngle(id,inputangle,inputvelocity,objx,objy)
pusher = 0;
angle = inputangle;
basex = objx;
basey = objy;
velocity = inputvelocity;
if velocity == 0 then
return angle;
end
if velocity > 0 then
if velocity < 1 then
velocity = 1;
end
mmf.Object.SetFlag(id,4,true);
pusher = 3;
end
if velocity < 0 then
if velocity > -1 then
velocity = -1;
end
pusher = -3;
mmf.Object.SetFlag(id,4,false);
end
newx = basex + math.cos(math.rad(angle)) * velocity;
newy = basey - math.sin(math.rad(angle)) * velocity;
if mmf.Collisions.BackdropTestPoint(newx,newy,2) then
for i=0,45 do
angle = angle + pusher;
newx = basex + math.cos(math.rad(angle)) * velocity;
newy = basey - math.sin(math.rad(angle)) * velocity;
if mmf.Collisions.BackdropTestPoint(newx,newy,2) then
--nothing!
else
mmf.Object.SetFlag(id,25,true);
return angle;
end
end
mmf.Object.SetFlag(id,25,false);
else
for i=0,45 do
angle = angle - pusher;
newx = basex + math.cos(math.rad(angle)) * velocity;
newy = basey - math.sin(math.rad(angle)) * velocity;
if mmf.Collisions.BackdropTestPoint(newx,newy,2) then
mmf.Object.SetFlag(id,25,true);
return angle + pusher;
end
end
mmf.Object.SetFlag(id,25,false);
end
return angle;
end
function checkZones(x,y)
for i=1,numzones do
if x > gravx[i] then
if x < gravx[i] + gravw[i] then
if y > gravy[i] then
if y < gravy[i] + gravh[i] then
return grava[i];
end
end
end
end
end
return -1;
end
function correctAngle(x,y,angle)
angleless = angle + 90;
anglemore = angle + 90;
dist = distchecker;
angleless = leftAngle(x,y,angleless,dist);
anglemore = rightAngle(x,y,anglemore,dist);
xl = x + math.cos(math.rad(angleless)) * dist;
yl = y - math.sin(math.rad(angleless)) * dist;
xr = x + math.cos(math.rad(anglemore)) * dist;
yr = y - math.sin(math.rad(anglemore)) * dist;
dx = xr - xl;
dy = yr - yl;
res = 180 - math.deg(math.atan2(dy,dx));
return res;
end
function leftAngle(x,y,angle,dist)
tangle = angle;
for i=0,45 do
testX = x + math.cos(math.rad(tangle)) * dist;
testY = y - math.sin(math.rad(tangle)) * dist;
truth = checkPoint(testX,testY);
if truth then
return tangle;
else
tangle = tangle - 4;
end
end
return tangle;
end
function rightAngle(x,y,angle,dist)
tangle = angle;
for i=0,45 do
testX = x + math.cos(math.rad(tangle)) * dist;
testY = y - math.sin(math.rad(tangle)) * dist;
truth = checkPoint(testX,testY);
if truth then
return tangle;
else
tangle = tangle + 4;
end
end
return tangle;
end
function checkPoint(x,y)
if mmf.Collisions.BackdropTestPoint(x,y,2) then
return true;
else
return false;
end
end

if you really want to take a look at the code to see if you can divine any differences I can shoot you a PM