Pregunta

I want to develop a game like jigsaw where the player will attach pieces of puzzle to match to a sprite.For this I've figured out to do Masking. I even found one class in cocos2d for iphone named CCMask that does this task pretty well. However when I try to port this to the java code for use with cocos2d-android I get Null pointer exception at CCRenderTexture. The class that I am trying to port is here.

Somewhere I read that if I do CCRenderTexture under the layer's onEnter callback the code will not crash and it doesn't crash when I do it like that. But then I don't get any masked sprite either as I have to add the CCMask class as a child to a layer to call the onEnter method.

Can anybody help me with the proper flow of the code or by confirming that it really works for cocos2d-android? This is the link for the library that I am using.

¿Fue útil?

Solución

It seems cocos2d-android development stopped a time ago (according to your link, last port is for cocos2d-iphone 0.99.4), so if you're working with cocos2d 1.x or higher, chances are that cocos2d-android won't work as you expect.

For android game development, I'd highly recommend LibGDX, which still lets you develop natively in java. Anyway, if you want a more straightforward conversion from your current project, cocos2d-x is also a great option.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top