diff --git a/effectNodes-for-cocos2dx-3x/code/shatter/ensShatterNode.cpp b/effectNodes-for-cocos2dx-3x/code/shatter/ensShatterNode.cpp index c95c568..8b65a93 100644 --- a/effectNodes-for-cocos2dx-3x/code/shatter/ensShatterNode.cpp +++ b/effectNodes-for-cocos2dx-3x/code/shatter/ensShatterNode.cpp @@ -43,6 +43,10 @@ bool CshatterSprite::init(const string&texFileName){ int nRow=(int)m_grid.size(); int nCol=(nRow==0?0:(int)m_grid[0].size()); const float halfGridSideLen=0.5*m_gridSideLen; + + int offsetX = this->getTextureRect().origin.x; + int offsetY = this->getTextureRect().origin.y; + for(int i=0;isetTextureRect(CCRect(x-halfGridSideLen,(contentSize.height-y)-halfGridSideLen,m_gridSideLen,m_gridSideLen)); + frag->setTextureRect(CCRect(x-halfGridSideLen+offsetX,(contentSize.height-y)-halfGridSideLen+offsetY,m_gridSideLen,m_gridSideLen)); //set position frag->setPosition(ccp(x,y)); //scale @@ -162,4 +166,4 @@ void CshatterAction::update(float time){//the time actually is percentage, namel -namespace_ens_end \ No newline at end of file +namespace_ens_end