1 decade ago
by Aenopix
I have an entity that its type.A and player entity its Type.A, i dont want them to collide, no matter what checkAgainst: ig.Entity.TYPE.B or collides: ig.Entity.COLLIDES.PASSIVE are. How to achieve it?
If I understood your question correctly then you should make all other entities of Type.NONE!
1 decade ago
by Aenopix
but i still want the other entities, like enemies, etc to collision with the object entity.
Got apple entity, i want apple to collision with enemies entities, but not with player entity, meaning tjat the player can go through apple, and dont move it, etc.
Also i want player to collision with enemies, so i cant give them type.NONE.
How i can make apple collision with enemy, but not with player.
If player is TYPE.A and enemy is TYPE.B then make apple TYPE.A. As I guess that player and enemy should be able to collide as well, put enemy's checkAgainst TYPE.A.
1 decade ago
by Arantor
So make the apple TYPE A, the player TYPE A, enemies TYPE B, player collides with TYPE B only, enemy collides with TYPE A, and in the enemy entity, in the check() function, check what other is an instance of, whether it's an instance of the player or of the apple and deal with it accordingly...
e.g. the enemy should have something like:
check: function(other)
{
// If we've collided with a player, damage them
if (other instanceof EntityPlayer)
{
other.receiveDamage(1, this);
}
else if (other instanceof EntityApple)
{
// do whatever it is you'd do with an enemy colliding with an apple
}
1 decade ago
by Aenopix
I already did that, the ting is that the playeralso collide with the apple, and both move away, i want the player to be able to go throught the apple without doing anything.
Also it is possible to make an entity invisible?
1 decade ago
by Arantor
Not sure it is set right if it's still handling the collision like that...
Sure it is possible to make it invisible, depends exactly what you're trying to do with it as to how to do that...
Page 1 of 1
« first
« previous
next ›
last »