0
내 cocos2d-android 게임 프로젝트에서 목표물의 무작위 수가 우주선의 상면에서 낙하하여 교차 할 때 우주선이 모두 삭제되어야합니다. 그러나 "우주선"은 아닙니다. 삭제 중. CGRect 스프라이트가 삭제되지 않는다는 것입니까? 아무도 이걸 압니까?CGRect sprites cocos2d-android에서
LinkedList<CCSprite> targetsToDelete = new LinkedList<CCSprite>();
for (CCSprite target : _targets)
{
CGRect targetRect = CGRect.make(target.getPosition().x - (target.getContentSize().width),
target.getPosition().y - (target.getContentSize().height),
target.getContentSize().width,
target.getContentSize().height);
CCSprite ship = CCSprite.sprite("ship150.png");
ship.setPosition(CGPoint.ccp(30,200));
ship.setAnchorPoint(CGPoint.ccp(0,0));
ship.setTag(25);
addChild(ship);
// ship.setVisible(false);
CGRect shipRect = CGRect.make(ship.getPosition().x - (ship.getContentSize().width/2),
ship.getPosition().y - (ship.getContentSize().height/2),
ship.getContentSize().width,
ship.getContentSize().height);
System.out.println("ships to delete continue... : " + volume);
if (CGRect.intersects(targetRect, shipRect))
{
System.out.println("ships intersected:)@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... : " + volume);
removeChildByTag(25, false);
}
}
은 _targets의 모든 타겟에 새로운 브랜드의 'ship'을 추가 한 것입니까? – Kreiri
답장을 보내 주셔서 감사합니다. 하나의 우주선과 여러 대상이 있습니다. @Kreiri –
은 parent.removeChild (node, true)와 같은 것입니다. 부여해야합니까? @Kreiri –