1 decade ago by Jastro
Hi guys,
I want to create a flying mob, i use the property
i have this, he move so crazy and when take a collision he leaves out of the level. Anyone know how can i do it?
thanks you :)
Sorry for my bad english
I want to create a flying mob, i use the property
gravityFactor: 0 its ok, the mob can fly, but i have a problem i want to move to left to right, taking collisions, but this dont detect collisions.
if( !ig.game.collisionMap.getTile(
this.pos.x + (this.flip ? +4 : this.size.x -4),
this.pos.y + this.size.y+1
)
) {
this.flip = !this.flip;
}
var xdir = this.flip ? -1 : 1;
this.vel.x = this.speed * xdir;
this.currentAnim.flip.x = this.flip;
this.parent();
},
handleMovementTrace: function( res ) {
this.parent( res );
// collision with a wall? return!
if( res.collision.x ) {
this.flip = !this.flip;
}
}
i have this, he move so crazy and when take a collision he leaves out of the level. Anyone know how can i do it?
thanks you :)
Sorry for my bad english
