如何创建在cocos2d的android 1 cocos2d的粒子效果? [英] how do i create a cocos2d particle effect in cocos2d android 1?
问题描述
我使用cocos2d中的Android版本设在这里:
https://github.com/ZhouWeikuan/cocos2d
我是一个iPhone的人检查出的Android谁已经拥有了熟悉的cocos2d iPhone。理想的情况是我将能够从包/包plist文件中创建粒子。我似乎无法连得premade默认样式粒子即工作CCParticleFireworks(我只试过在模拟器虽然)。我感到失望的是很少有样本code在那里为cocos2d的机器人,所以如果任何人有一个很好的资源对这个我有兴趣为好。我只是学习java以及因此它可能是简单的东西只是在寻找一些code段,我可以使用基本。
行为的IM用我所有的努力看到的只是一个崩溃当我尝试实例化和粒子添加到场景中。我没有太大的调试eclise要么,所以我不能说什么时候该应用程序是奄奄一息。抱歉。我想少犯几次。我把我的code的,但香港专业教育学院尝试了一堆不同的方式,我不想看起来像一个屁股。但在这里不用反正,所以这里就是我认为它应该工作:
公共布尔ccTouchesBegan(MotionEvent事件)
{
。CGPoint位置= CCDirector.sharedDirector()convertToGL(CGPoint.ccp(event.getX(),event.getY()));
CCParticleSystem部分= CCParticleSystem.particleWithFile(0.plist);
part.setPosition(location.x,location.y);
的addChild(部分);
返回true;
}
0.plist是我的资产文件夹,我觉得我需要把它变成一个散列或东西。此外,我觉得有可能是与ccparticlesystem VS ccpointparticlesystem VS ccquadParticleSystem一个问题。
您应该尝试 WiEngine 。这是最好的cocos2d的Java的Android端口。的Cocos2D-机器人甚至没有3D实现的。这些类是有,但空。同样来自安卓市场 检查Wiengine的API演示P>
I'm using the android version of cocos2d located here:
https://github.com/ZhouWeikuan/cocos2d
I'm an iPhone guy checking out android who already has familiarity with cocos2d iPhone. Ideally i would be able to create the particle from a plist file in the package/bundle. I can't seem to even get the "premade" default style particles working ie CCParticleFireworks (I've only tried in the simulator though). I was disappointed that there is very little sample code out there for cocos2d android so if anyone has a good resource on this I would be interested as well. I'm just learning java as well so it may be something simple just looking for some code snippet I can use basically.
The behavior im seeing with all my attempts is just a crash as soon as i try to instantiate and add the particle to the scene. I'm not too great at debugging in eclise either so i can't say exactly when the app is dying. sorry. I'm trying to suck less. I'd put my code in but ive tried it a bunch of different ways and I don't want to look like an ass. but here goes anyway, so here's how i think it should work:
public boolean ccTouchesBegan(MotionEvent event)
{
CGPoint location = CCDirector.sharedDirector().convertToGL(CGPoint.ccp(event.getX(), event.getY()));
CCParticleSystem part = CCParticleSystem.particleWithFile("0.plist");
part.setPosition(location.x, location.y);
addChild(part);
return true;
}
0.plist is in my assets folder, i feel like i need to turn this into a hash or something. also i feel there might be a problem with the ccparticlesystem vs ccpointparticlesystem vs ccquadParticleSystem.
You should try WiEngine . It is the Best Cocos2d java android port. Cocos2d-android don't even have 3d implemented. The classes are there but empty. Also check Wiengine's api Demo from the android market
这篇关于如何创建在cocos2d的android 1 cocos2d的粒子效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!