Reply to comment

kusoksna's picture

Controls are not ok :) If you

Controls are not ok :) If you press A then D, tank will go right. When you release D tank will stop. Same for other buttons.

I prefer it in a way that if you release D, then tank will go left (as you still press A). Idea is that instead of adding acceleration on button press, you create flags, and change them according to pressed buttons. E.g. mooving left and right.

  directionX = 0;
  if(input.isKeyDown(Input.KEY_A)){
    directionX--;
  }
  if(input.isKeyDown(Input.KEY_D)){
    directionX++;
  }
//so direction could be only -1,0 or 1
  ...
  acceleration = acceleration*directionX; //probably rotation here in tank case

PS: I could explain better if required.

Reply

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.