I don't understand why there does not have to be anything blocking in the way, yet it keeps returning blocking...
Does onwall not work serverside / in a class?
Currently I have it commented off as shown below or it would just keep turning around.
PHP Code:
function onTimeout(){
if (this.mode == WALK) {
if (players.size() > 0) {
setTimer(.1);
}
else {
setTimer(0);
}
this.to_check = findnearestplayer(this.x, this.y);
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;
//}
}
PHP Code:
function checkBlockedTile(xValue, yValue) { //Check if tile is not walkable
if (onwall(xValue, yValue) || onwater(xValue, yValue)) {
this.chat = "test";
return true;
}
else {
//this.chat = "not blocking";
this.chat = "yesy";
return false;
}
}