씬이 수정되는 동안 스프라이트의 스케일을 증가시키기 위해 씬 업데이트 핸들러를 돌리고 있습니다. 사용자가 손가락을 떼면 멈추지 만 내 행동은 결코 등록되지 않습니다. 스프라이트는 스크린이 다시 터치 될 때까지 크기가 계속 증가합니다. 그 시점에서 오래된 스프라이트가 멈추고 새로운 스프라이트가 시작됩니다. 어떤 아이디어?작업을 등록하지 않는 이유는 무엇입니까?
scene.registerUpdateHandler(new IUpdateHandler() {
@Override
public void reset() {
}
@Override
public void onUpdate(float pSecondsElapsed) {
if(fillerNum>-1){
if(filler[fillerNum].active){
mPhysicsWorld.unregisterPhysicsConnector(mPhysicsWorld.getPhysicsConnectorManager().findPhysicsConnectorByShape(filler[fillerNum].sprite));
mPhysicsWorld.destroyBody(filler[fillerNum].body);
filler[fillerNum].sprite.setScale(filler[fillerNum].scale+=pSecondsElapsed*.5);
filler[fillerNum].body = PhysicsFactory.createCircleBody(mPhysicsWorld, filler[fillerNum].sprite, BodyType.DynamicBody, FIXTURE_DEF);
mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(filler[fillerNum].sprite, filler[fillerNum].body, true, true));
}
}
}
});
@Override
public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
if(this.mPhysicsWorld != null) {
if(pSceneTouchEvent.isActionDown()) {
createFiller(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
return true;
}
if(pSceneTouchEvent.isActionUp()){
//Never executed
Log.e("Action UP", Boolean.toString(filler[fillerNum].active));
createStationaryFiller();
}
}
return false;
}
필러 번호는 무엇입니까? –
fillerNum은 어떤 스프라이트가 활성 상태이고 얼마나 많은 스프라이트가 장면에 있는지 추적하는 데 필요한 참조 (정수)입니다. – rphello101