Two players on the same keyboard

Started by Jack, March 31, 2013, 20:46:03

Previous topic - Next topic

Jack

Hi. 8)
I'm trying to display two object moved by different keys (different players)... I've a class "Player" which contains:
public void pollInput() 
	{	
		
		while (Keyboard.next()) 
		{
			if (Keyboard.getEventKeyState()) 
			{
				if(Keyboard.getEventKey() == kRight) { 
					//
				} else if(Keyboard.getEventKey() == kLeft) {
					//
				}else if(Keyboard.getEventKey() == kUp) {
					//
				} else if(Keyboard.getEventKey() == kDown) {
					//
				} else {
					//
				}
			} else {
				///
			}
		}


and the class that should display all which contains:
public void start() 
	{	
		
		//...

		while(!Display.isCloseRequested()) 
		{
			
			//....
			
			player[0].pollInput();
			player[1].pollInput();
}


the first player works fine, but the second player's object doesn't move... Any idea to solve the problem? Thx..  ;D