Android에 익숙하지 않아이 문제를 해결할 방법이 확실하지 않습니다.점수 표시를 위해 게임 일시 중지
나는 퐁 게임을 만들고 있는데 점수를받은 후에 게임을 일시 중지하는 동안 점수를 몇 초 동안 표시하고 싶습니다. 나는이처럼 된 onDraw() 메소드를 사용하고 있습니다 :
public void onDraw(Canvas canvas) {
canvas.drawColor(Color.BLACK);
canvas.drawBitmap(_bitmapStore.get(R.drawable.batblue),bluebat.getX() - (_bitmapStore.get(R.drawable.batblue).getWidth() /2),bluebat.getY(),null);
canvas.drawBitmap(_bitmapStore.get(R.drawable.ball),ball.getX() - (_bitmapStore.get(R.drawable.ball).getWidth() /2),ball.getY()-(_bitmapStore.get(R.drawable.ball).getHeight() /2), null);
canvas.drawBitmap(_bitmapStore.get(R.drawable.batred),redbat.getX() - (_bitmapStore.get(R.drawable.batred).getWidth() /2),redbat.getY(),null);
if(drawScore){
canvas.drawBitmap(_bitmapStore.get(R.drawable.user),200,200, null);
canvas.drawBitmap(_bitmapStore.get(R.drawable.cpu),400,200, null);
}
}
내가 그것을 몇 초 동안 점수를 그리려하지만 일시 정지하는 방법을 모르겠어요. 권장하지는 않지만 thread.sleep() 메서드를 사용해 보았습니다. 그러나 경기를 늦추는 것을 제외하고는 아무것도하지 못했습니다.
이미지는 점수가 한 번만 표시되지만 게임은 그 뒤에 계속 실행됩니다.
고마워, 나는 아직도이 모든 것을 배우고있다. 그래서 나는 "올바른"방식이 아닌 일을하고 있어야한다. 내가 뭐라했는지 확인해 보겠다.하지만 그걸 그리는 동안 멈추는 것이 어떻게 도움이 될까? 더 나은 방법은 무엇을 사용하는 동안 중지했다? –