그래서 나는 flappy 새 복제품을 만들고 있습니다. 것은 내가 자바와 libgdx로 프로그래밍 할 때 새롭다는 것이고 당신의 도움을 요청하고 싶습니다. 전 화면을 클릭하는 대신 특정 영역 (단순한 직사각형 모양)에서 터치 감지를하고 싶습니다.Flappy 새 클론의 특정 영역에서 터치 감지
public class InputHandler implements InputProcessor {
private Bird myBird;
private GameWorld myWorld;
// Ask for a reference to the Bird when InputHandler is created.
public InputHandler(GameWorld myWorld) {
// myBird now represents the gameWorld's bird.
this.myWorld = myWorld;
myBird = myWorld.getBird(); }
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
if (myWorld.isReady()) {
myWorld.start();
}
myBird.onClick();
if (myWorld.isGameOver() || myWorld.isHighScore()) {
// Reset all variables, go to GameState.READ
myWorld.restart();
}
return true;
}
@Override
public boolean keyDown(int keycode) {
return false;
}
@Override
public boolean keyUp(int keycode) {
return false;
}
@Override
public boolean keyTyped(char character) {
return false;
}
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
return false;
}
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
return false;
}
@Override
public boolean mouseMoved(int screenX, int screenY) {
return false;
}
@Override
public boolean scrolled(int amount) {
return false;
}
}
누군가가 조각을 채우기를 기대하기보다는 자습서를 따라하면 더 나을 것입니다. 모두 제일 좋다. – nikhil