So, shortly...
My mini game:
When I press a 'Space bar' key - the first ball (A) stops moving, and the second ball (B) starts moving.
The problem: How to make the second ball (B) stop moving with a same (Space bar) key?
What i need: 1st time 'Space bar' pressed - first ball stops. 2nd time 'Space bar' pressed - second ball stops.
How to do that?
I manage to make them both stop if i set that balls stop moving after different keys pressed. But I don't need that.
public void run() { while(running){ if(BallA.ballMoves) BallA.move(); if(!BallA.ballMoves){ BallB.move(); } @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_SPACE){ BallA.ballMoves = false; }
Sorry, if I'm writing in a wrong sub-forum...