The Devil Bugs
Posts 54
Added by The Devil about 1 year ago

Hi,
First of all, a big thank-you to everyone who helped port this.
Second, while using cocos2d-x for XNA, I have come across some issues (at lease I think they are) as follows:
1) On removing a child from CCSpriteBatchNode, it gets drawn on the screen again from the next draw call onwards. (Have not yet found any solution. Please help)
2)In CCMenu::menuWithItem(), the cocos2d-x internally appends a null to it before calling CCMenu::menuWithItems(). This cause the code to crash. Removing the null that is getting added in the function, fixes the bug.
3)If we make a particle effect with the help of Particle Designer( http://particledesigner.71squared.com/index.php ) , it cause the code to crash again. This is because the emitter type, is stored as a float in the plist file and it is parsed as an integer when the file is being read. Changing the parsing to a float parse fixes the issue.
4) When using the action CCFadeOut on a sprite, it cause the screen to go fade to a blue color temporarily as if we have done a fade to blue. Have not found a fix for this yet, as am not familiar with DirectX. Any help is appreciated.

Thanks.

shivalingesh nashipur RE: Bugs
Posts 19
Added by shivalingesh nashipur about 1 year ago

are you removing the correct one by removechild like this?

public void spritemovefinished(SelectorProtocol sender) {
CCSprite sen = (CCSprite)sender;
this.removeChild(sen, true);
}
or what ,i did faced the same problem..

The Devil RE: Bugs
Posts 54
Added by The Devil about 1 year ago

I am directly removing the sprite as it is stored in a class variable. It disappears for one cycle and then in the next cycle is visible near the bottom left of the screen.

Thanks

shivalingesh nashipur RE: Bugs
Posts 19
Added by shivalingesh nashipur about 1 year ago

i didnt catch you , i am a beginner i straight away give my lines which faced ,
i hope it helps......... if you used actionmove or sequence,,

CCCallFunc actionMoveDone = CCCallFuncN.actionWithTarget(tSprite,spritemovefinished); 
/////////////////////************************here tsprite is the sprite am using you can use ur class object to pass and remove that in sprite movefinished method
tSprite.runAction(CCSequence.actions(actionmove,actionmove1,actionMoveDone));
//Here i called runaction with tsprite ucan call object.yoursprite.runaction or whatever...............

public void spritemovefinished(SelectorProtocol sender) {
CCSprite sen = (CCSprite)sender;
this.removeChild(sen, true);
}

RongHong Huang RE: Bugs
Posts 171
Added by RongHong Huang about 1 year ago

hi, Nidhi Ajwani, about your questions:
1) On removing a child from CCSpriteBatchNode, it gets drawn on the screen again from the next draw call onwards. (Have not yet found any solution. Please help)

i don't reproduce the problem, could you give the sample code here.
and i have create an issue to trace this problem, see http://www.cocos2d-x.org/issues/1011

2)In CCMenu::menuWithItem(), the cocos2d-x internally appends a null to it before calling CCMenu::menuWithItems(). This cause the code to crash. Removing the null that is getting added in the function, fixes the bug.

this is not a bug, the node doesn't allow to add a null child.

3)If we make a particle effect with the help of Particle Designer( http://particledesigner.71squared.com/index.php ) , it cause the code to crash again. This is because the emitter type, is stored as a float in the plist file and it is parsed as an integer when the file is being read. Changing the parsing to a float parse fixes the issue.

this is a problem to a certain extent. 
the emitter type should be integer, when the value is float(in fact, it is unreasonable), it crashes.
but now we will deal with integer and float together, issue 1012(http://www.cocos2d-x.org/issues/1012) is created for this.

4) When using the action CCFadeOut on a sprite, it cause the screen to go fade to a blue color temporarily as if we have done a fade to blue. Have not found a fix for this yet, as am not familiar with DirectX. Any help is appreciated.

i don't catch you here, could you paste a screenshot here.
CCFadeOut acts well in actions tests now
The Devil RE: Bugs
Posts 54
Added by The Devil about 1 year ago

Hi,
1) My code is as follows:
@
if (batchNode.children.Contains(_cannonBall.sprite)) {
System.Diagnostics.Debug.WriteLine("ball remvoved from sprite batch in resetball");
batchNode.removeChild(_cannonBall.sprite, true);
}
_cannonBall.destroyBall();
_cannonBall = null;

2) in the cocos2d-x code, this is what happens:
@
public static CCMenu menuWithItem(CCMenuItem item) {
return menuWithItems(item*,null*);
}
@

which cause the code to crash. If I change it to this
@
public static CCMenu menuWithItem(CCMenuItem item) {
//TheDevil
return menuWithItems(item);
//
}
@

it works.

4) My code is
@

switch (number)
           {
case 1://try again
one = CCSprite.spriteWithSpriteFrameName("nopressure.png");
break;
case 2://try harder
one = CCSprite.spriteWithSpriteFrameName("youcandoit.png");
break;
case 3://excellent
one = CCSprite.spriteWithSpriteFrameName("excellent.png");
break;
case 4://good shot
one = CCSprite.spriteWithSpriteFrameName("goodshot.png");
break;
default:
break;
}
one.position = new CCPoint(240, 200);
this.addChild(one);
one.runAction(CCSequence.actions(CCFadeOut.actionWithDuration(1.5f),
CCCallFunc.actionWithTarget(this, this.removeSelf)));

1.png (236.6 kB)

The Devil RE: Bugs
Posts 54
Added by The Devil about 1 year ago

More screenshots

2.png (236.1 kB)

3.png (174.9 kB)

4.png (182.9 kB)

RongHong Huang RE: Bugs
Posts 171
Added by RongHong Huang about 1 year ago

yep, about menuWithItem(CCMenuItem item), this is a bug, i have corrected it

george t RE: Bugs
Posts 6
Location Seattle
Added by george t 10 months ago

Regarding the first problem reported by Nidhi and tracked by issue #1011 (http://www.cocos2d-x.org/issues/1011), it is caused by code commented out in the framework.
For me it was happening only occasionally and I tracked down the repro steps to using z-order when adding a sprite.
To fix, it replace the removeQuadAtIndex function inside CCTextureAtlas.cs with the following:

public void removeQuadAtIndex(int index)
{
Debug.Assert(index < m_uTotalQuads, "removeQuadAtIndex: Invalid index");
if (index == m_uTotalQuads - 1) {
m_pQuads[index] = null;
}
else {
for (int i = index; i < m_uTotalQuads - 1; i++) {
m_pQuads[i] = m_pQuads[i + 1];
}
m_pQuads[m_uTotalQuads - 1] = null;
}
m_uTotalQuads--;
#if CC_USES_VBO
m_bDirty = true;
#endif
}

It solved the problem for me. Hope it helps!

Jacob Anderson RE: Bugs
Posts 179
Location Totally Evil Entertainment - San Diego
Added by Jacob Anderson 10 months ago

On #3.

CCParticleSystem.cs, line 983 in current repo:

m_nEmitterMode = ccUtils.ccParseInt(ChangeToZeroIfNull(valueForKey("emitterType", dictionary)), NumberStyles.AllowDecimalPoint);

This should work for you now. If you are still getting an error with your custom particle system, please let us know.


(1-9/9)