cocos2d-x

Decreasing FPS while adding obstacles

二次信任 提交于 2019-12-12 01:31:14
问题 I am new to cocos2d-x and I am developing a game in x-code using cocos2d-x.In my game i have a menu scene and game scene. In my game scene after adding the obstacles FPS is decreasing to 10 So my game performance is very low. Following is the code which i used to add obstacles in my game. and i have eight obstacles in my game. I created all the obstacles in one function and call that function by scheduler from init().Please help me solve this problem. time = time + 1; int i=arc4random()%9;

cocos 2d-x automation testing tool for mobile games

我是研究僧i 提交于 2019-12-11 19:44:34
问题 Is there any tool or methods to do automation testing for games developed in cocos2d-x? FYI: Appium and other tools try to find Android and IOS elements, I don't use them in the games. 回答1: I highly recommend you to use Image Recognition for Mobile App Game Testing, Appium too supports Image recognition. You can use applitools for doing automatic image comparison with Appium. In fact Applitools automates not only the capturing of the screenshot, but also it's validation, and has sophisticated

To make a sprite of one char from string

有些话、适合烂在心里 提交于 2019-12-11 18:58:43
问题 I am just trainning cocos2d-x. I am trying to make a sprite of one char using CCLabelBMFont. I wrote the code as follows string str = "I like an apple"; CCLabelBMFont *label = CCLabelBMFont::create(str.c_str() , "font.fnt"); How should I write the code to make a sprite of one char from string. It is a feeling such as follows that I image. ex) CCSprite *spr = 'I'; CCSprite *spr2 = '\n'; CCSprite *spr3 = 'l'; CCSprite *spr4 = 'i'; CCSprite *spr5 = 'k'; CCSprite *spr6 = 'e'; ... 回答1: A string is

cocos2d-x设计模式发掘之一:单例模式

这一生的挚爱 提交于 2019-12-11 18:52:23
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 作者 : firedragonpzy 原地址: http://www.firedragonpzy.com.cn/index.php/archives/1781 本系列文章我将和大家一起来发掘 cocos2d-x 中所使用到的设计模式,同样的,这些模式在 cocos2d-iphone 中也可以找到其身影。 声明:这里发掘模式只是我的个人爱好,通过这个过程,我希望能加深自己对于设计模式运用的理解。关于模式的学习,市面上已经有许多非常好的书籍了。比如《 Head First 设计模式》、 GoF 的设计模式,还有《研磨设计模式》等。如果读者对于设计模式完全不了解的话,建议先阅读上面至少一本书籍,了解设计模式之后再阅读本系列文章。这样大家才会有相互交流的共同语言。 为什么要发掘设计模式呢?因为设计模式本身就是人们在一些面向对象的软件系统里面发掘出来的,在一定的场景之下可以重用的解决方案。通过对模式的挖掘,我可以借此机会学习一下这些优秀的设计思想。因为我觉得,一个好的开源游戏框架除了能给我们开发者带来开发效率的提升以外,还应该被我们吸收其设计思想,这样它的价值才能完整。 本系列文章将按照如下思路进行模式挖掘: 1. 找出某个设计模式的应用场景(类、类结构、对象结构,必要时结合 UML 类图) 2. 分析为什么要使用此模式

How to perform drag and drop operation on sprite fetched from array and present on screen ?

北城以北 提交于 2019-12-11 18:13:10
问题 I want to perform drag and drop operation on these image. How can i make it possible with the following code. void storeLocation::changescene() { this->removeAllChildren(); //CCDirector::sharedDirector()->replaceScene(storeLocation::scene()); CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin(); //CCScene* scene=CCScene::create(); storeLocation *layer = storeLocation::create(); CCSprite *k=CCSprite::create(

Cocos2d-x Background image is not displaying properly

主宰稳场 提交于 2019-12-11 18:08:26
问题 i am new to Cocos2dx 3.0 alpha and converting my game from Corona SDK to Cocos2d-x 3.0 alpha . I am displaying a background image like this. auto sprite = Sprite::create("bg.png"); sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); this->addChild(sprite, 0); But the image is distorted in iOS simulator. I also get these 3 warnings in console. May be 1 warning for each image, as i am displaying 3 images. libpng warning: iCCP: known incorrect sRGB

OpenSSL Security Alert Mail from Google Play for android apps [duplicate]

社会主义新天地 提交于 2019-12-11 16:50:23
问题 This question already has answers here : Google Play and OpenSSL warning message (5 answers) Closed 5 years ago . I am developing android apps in AndEngine and Cocos2dx. I have received a mail today from Google Play, that says: "One or more of your apps is running an outdated version of OpenSSL, which has multiple security vulnerabilities. You should update OpenSSL as soon as possible. ..." I download an app called bluebox testing(HeartBleed Scanner). What i found was, apps build using

android obb/zip music & sounds loading (cocos2dx)

心已入冬 提交于 2019-12-11 13:43:21
问题 I'm using this answer: https://stackoverflow.com/a/18739812/2904688 to split my android app into an APK and ZIP and it works like a charm. Although the app launches properly all sounds are not playing. Cocos2dxMusic.java & Cocos2dxSound.java seem to not be able to read the sound files in the zip. All assets (images, animations, etc) load correctly but the sounds (music & SFX) seem to not load. The relative to the assets.zip path is correct as given by the logs. Any clues? I am using cocos2d-x

chipmunk collision too soft

风格不统一 提交于 2019-12-11 13:16:14
问题 I'm new to physics in cocos2d. I'm using chipmunk, and when two object collide, its just to "soft", like they where made of sponge or rubber. My code: cpInitChipmunk(); space = cpSpaceNew(); space->gravity = cpv(0, 0); schedule(schedule_selector(HelloWorld::step), 1.0f/60.f); astroBody = cpBodyNew(100, INFINITY); astroBody->p = cpv(512,384); cpSpaceAddBody(space, astroBody); int num2 = 8; cpVect vertsAstro[] = { cpv(-17.0f, -44.9f), cpv(-29.5f, -33.2f), cpv(-32.9f, -13.1f), cpv(-24.0f, 11.7f)

Got Opengl error 0x505 while texture cache statistic is low

时光总嘲笑我的痴心妄想 提交于 2019-12-11 11:26:45
问题 I am developing an android game using cocos2dx 2.2 + lua. While testing,I got a lot of 'opengl error 0x505' from logcat. According to opengl doc, this means 'out of memory'. Hence, I print out texture cache every 3 seconds using cocos2d::CCTextureCache::sharedTextureCache()->dumpCachedTextureInfo(); The output of dumpCachedTextureInfo() shows that the highest texture cache is 70M, but no 'error 0x505' occurs. 'error 0x505' come out while the cache is low, e.g. ~35M. My question is, isn't