안드로이드 개발 질문/답변
(글 수 45,052)
private void GameOver(Canvas can){
can.drawColor(Color.BLACK); // 캔버스 초기화
Paint tmp=new Paint(); // 글자 출력을 위한 Paint
tmp.setTextSize(30);
tmp.setTextAlign(Align.LEFT);
tmp.setColor(Color.WHITE);
if(AppManager.getInstance().highscore<score){ // 하이스코어라면
can.drawText("HIGHSCORE!", width/4, (height/4)+340, tmp); // HIGHSCORE!를 띄우고
AppManager.getInstance().highscore=score; // 하이스코어를 갱신한다.
}
can.drawText("TOUCH TO RESTART", width/4, (height/4)+260, tmp); // 터치로 재시작하라고 보여줌
can.drawText("SCORE : "+Integer.toString(score), width/4, height/4+300, tmp); //점수 보여줌
}
SurfaceView를 관리하는 스레드에서,
게임오버가 되면 Canvas를 인수로 넣으면서 이 함수를 실행시킵니다.
그런데 분명 하이스코어는 갱신되고,
TOUCH TO RESTART와 SCORE:는 뜨는데
HIGHSCORE! 라는 말은 뜨지 않네요.
이게 어찌된 일일까요...ㅠㅠ
말 그대로.. AppManager.getInstance().highscore<score 가 false 라서 그런것 같네요..
AppManager의 highscore 메소드와, score 변수값 변경을 하는 구문을 분석해보심이..
올리신 소스의 일부로는 답변이 힘들것 같네요.