Quote:
Originally Posted by DustyPorViva
I didn't use testx for a reason, newx would have sufficed lol. The only position you need to check is its intended(new) position.
|
Either way it has mad cow and keeps changing directions. D:
PHP Code:
temp.newx = this.x + vecx(this.dir) * this.mov_speed;
temp.newy = this.y + vecy(this.dir) * this.mov_speed;
//this.chat = this.x SPC this.y SPC "New is" SPC new_x SPC new_y;
this.count--;
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(newx,newy,3,4)) {
this.x = newx;
this.y = newy;
}
else if (dir == 1 && !onwall2(newx,newy,5,4)) {
this.x = newx;
this.y = newy;
}
else if (dir == 2 && !onwall2(newx,newy,3,4)) {
this.x = newx;
this.y = newy;
}
else if (dir == 3 && !onwall2(newx,newy,5,4)) {
this.x = newx;
this.y = newy;
}
else{
this.dir = (this.dir + 2) % 4;
}
}
Quote:
Originally Posted by DustyPorViva
I feel this is an instance of you using preexisting code and hacking it up but not actually being aware of what any of it does. Examine what you're doing logistically and this sort of stuff will make sense.
|
I feel the exact same way since there really isn't any other way to learn onwall..
Honestly I didn't even know why one would use the function for onwall check when you could do it in the original code, but either way it would not work so I kept the original baddy format.
If I knew how to do serverside onwall support my pet system would have been finished 6 months ago.
Since onwall was the only thing missing.
Anyway, all I wanted was the random walking and wall check. Apparently that doesn't work sadly and so far nothing has fixed it, once again like my pet system, I'll leave it alone for a while. x.x;;
Oh sorry, yeah I missed a part, I know what is going on up until why it keeps thinking it hits a wall. I've tried debugging it and onwater and onwall keep going off over and over and over.
I mean I haven't had it check the tiles and have it chat which tiles are being checked, but I also feel I should not have to go that far.. D: