1 decade ago by lucastimmons
Hi there,
I am building a teleport type system based on triggers. I'd like a character to step on the teleport pad and press the up key (open). When they do I'd like the EntityPlayer entity to be removed but not killed and a new EntityPlayer spawned at the new point.
The trigger works, but the outcome is not as desired. The new EntityPlayer is created in the correct position, but the old EntityPlayer does not disappear. Is there something wrong with my remove.Entity( EntityPlayer );? Code below.
I am building a teleport type system based on triggers. I'd like a character to step on the teleport pad and press the up key (open). When they do I'd like the EntityPlayer entity to be removed but not killed and a new EntityPlayer spawned at the new point.
The trigger works, but the outcome is not as desired. The new EntityPlayer is created in the correct position, but the old EntityPlayer does not disappear. Is there something wrong with my remove.Entity( EntityPlayer );? Code below.
check: function( other ) { // Iterate over all targets for( var t in this.target ) { var ent = ig.game.getEntityByName( this.target[t] ); if(ig.input.pressed('open')){ ig.game.removeEntity( EntityPlayer ); ig.game.spawnEntity( EntityPlayer, 20, 20); } } }