|
Tell me this script but so you cant walk on water!
if (created) {
// Initialize the attributes
showcharacter;
setcharprop #3,head431.gif;
setcharprop #C0,orange;
setcharprop #C1,red;
setcharprop #C2,orange;
setcharprop #C3,orange;
setcharprop #C4,red;
setcharprop #2,no-shield.gif;
setcharprop #8,body4.png;
shieldpower = 1;
dir = 2;
}
if (playerenters || wasthrown) {
// Initialize the this. variables
dirgo = {0,-1,-1,0,0,1,1,0};
timeout = 0.05;
this.walkmode = 1;
if (wasthrown && this.walkmode>1) this.walkmode = 1;
this.x1 = 0;
this.x2 = 63;
this.y1 = 0;
this.y2 = 63;
this.speed = 0.3;
this.mode = 0;
setcharani idle,;
this.runcounter = int(random(10,40));
}
// Walking stuff
if (timeout && this.mode==0) { // WALKING
setcharani walk,;
newx = x + dirgo[dir*2] * this.speed;
newy = y + dirgo[dir*2+1] * this.speed;
this.runcounter--;
if (this.walkmode==1) { // RANDOM
if (this.runcounter>0) {
testx = newx + 1.5 + dirgo[dir*2];
testy = newy + 2+ dirgo[dir*2+1];
if (onwall(testx,testy)) {
dir = (dir+2)%4;
this.runcounter = int(random(0,60));
} else {
x = newx;
y = newy;
}
} else {
this.runcounter = int(random(10,40));
dir = (dir+1+int(random(0,2))*2)%4;
}
} else if (this.walkmode==2) { // LEFTRIGHT
if (dir!=1 && dir!=3) dir = 3;
else {
x = newx;
y = newy;
if ((dir==1 && x<=this.x1) || (dir==3 && x>=this.x2))
dir = (dir+2)%4;
}
} else if (this.walkmode==3) { // UPDOWN
if (dir!=0 && dir!=2) dir = 2;
else {
x = newx;
y = newy;
if ((dir==0 && y<=this.y1) || (dir==2 && y>=this.y2))
dir = (dir+2)%4;
}
} else if (this.walkmode==4) { // RECTANGLE
x = newx;
y = newy;
if ((dir==0 && y<=this.y1) || (dir==1 && x<=this.x1) ||
(dir==2 && y>=this.y2) || (dir==3 && x>=this.x2))
dir = (dir+3)%4;
}
if (this.walkmode>1 && this.runcounter<=0)
this.runcounter = 20;
message;
timeout = 0.05; |