Receiver.detach()

Use this method to force the currently attached controller to detach. In essence you are 'kicking the user'. This method returns the receiver. 

Don't confuse this method with "onDetach", with which you can set a callback for after the user detaches. 

 

Example

In the following example, a developer is building a multiplayer fighting game. When one of the players loses, he gets detached so another player can attach and play against the winner.

var receivers = [
         PLUGPIN.createReceiver({ 'name' : 'Fatal Kombat - Player 1' })
    ,    PLUGPIN.createReceiver({ 'name' : 'Fatal Kombat - Player 2' })
];

function onDie( playerIndex )
{
    receivers[ playerIndex ].detach();
};

 

Contact us


Talk to us!
Tell us anything you want to and please add your contact information.




Our contact info
tel. +31 (0) 20 2170013
info@plugpin.com

Groenhoedenveem 28
1019 BL Amsterdam
The Netherlands

News letter


Enter your e-mail address to stay informed on everything PlugPIN!