1 decade ago by sleenee
Ok I have been looking at this and I thought it should work but I'm missing something I guess.
I modified the handleMovementTrace in the non-playable entity in order to make him stop for walls but it's not working out.
the movementtimer is something I put in there to make him change direction. Every 5 seconds he needs to reconsider wether he wants to change direction and the timer resets every time he stands still. However, he never stands still since the handlemovementtrace is not working in my case.
I buy a beer to the one who solves it, I've been looking at it for hours, tried a lot of stuff and now I'm frustrated and will go drawn my brain in alcohol in order to forget about it.
thanks in advance,
Sleenee
I modified the handleMovementTrace in the non-playable entity in order to make him stop for walls but it's not working out.
handleMovementTrace: function(res) {
this.parent(res);
// collision with a wall? stop!
if (res.collision.x && this.vel.x > 0) {
this.vel.x = 0;
this.movementtimer = new ig.Timer();
}
if (res.collision.y && this.vel.y > 0) {
this.vel.y = 0;
this.movementtimer = new ig.Timer();
}
},
the movementtimer is something I put in there to make him change direction. Every 5 seconds he needs to reconsider wether he wants to change direction and the timer resets every time he stands still. However, he never stands still since the handlemovementtrace is not working in my case.
I buy a beer to the one who solves it, I've been looking at it for hours, tried a lot of stuff and now I'm frustrated and will go drawn my brain in alcohol in order to forget about it.
thanks in advance,
Sleenee
