Quote:
Originally Posted by DustyPorViva
PHP Code:
if (!onwall2(newx,newy,3,4)) { // proceed with walking }
Onwall2 width and height is in tiles. Just adjust the 3 and 4 to the specific size of the cow, especially for each direction where the NPCs proportions change.
|
Alright! I shall see if this works, thank you for now!
I've tried both ways with no luck.. testx and y, and newx and y
I can now understand why Zodiac doesn't have wall checking. x.x;;
PHP Code:
if (this.count > 0) {
if (this.ani != "sl_animal_cow-walk") {
setcharani("sl_animal_cow-walk",null);
}
temp.testx = newx + 1.5 + vecx(this.dir);
temp.testy = newy + 2 + vecy(this.dir);
/*
if (checkBlockedTile(testx,testy)){
this.dir = (this.dir + 2) % 4;
}
else {
this.x = newx;
this.y = newy;
}
*/
if (dir == 0 && !onwall2(testx,testy,3,4)) {
this.x = newx;
this.y = newy;
}
else if (dir == 1 && !onwall2(testx,testy,5,4)) {
this.x = newx;
this.y = newy;
}
else if (dir == 2 && !onwall2(testx,testy,3,4)) {
this.x = newx;
this.y = newy;
}
else if (dir == 3 && !onwall2(testx,testy,5,4)) {
this.x = newx;
this.y = newy;
}
else{
this.dir = (this.dir + 2) % 4;
}
}