cocos2d-x-3.0

How to get Sprite pixel alpha information in cocos2d js/c++

人走茶凉 提交于 2020-01-07 03:15:09
问题 I am working on a scratch and win game, I used clipper node for this. But I want to know the event when whole sprite is clippe? Is there any other way to know it, plz help me 回答1: I solved this issue by using following method:- I create one rendure texture and add an sprite on it. I found answer here:- http://discuss.cocos2d-x.org/t/render-texture-get-percentage-of-transparent/21123 here is the code:- var WINDOW_WIDTH = cc.director.getWinSize().width; var WINDOW_HEIGHT = cc.director

Can't use effects in Cocos2d-x 3.0 alpha 2

删除回忆录丶 提交于 2020-01-06 09:59:05
问题 Using of any effect for any sprite/layer/scene always causes this assertion in CCActionScript.cpp: void GridAction::cacheTargetAsGridNode() { _gridNodeTarget = dynamic_cast<NodeGrid*> (_target); CCASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid"); } So, this code won't work because of Sprite or any other primitive are inherited from Node (not from NodeGrid). In other words, sample application won't work too: CCSprite* sp = CCSprite::create("title.jpg"); sp->setPosition(ccp(240,

Where should system initialization methods be placed in Cocos2d-x?

五迷三道 提交于 2020-01-03 03:24:06
问题 I've developed a number of applications using Cocos2d-x on the iOS platform. I have always placed the loading of resources, preloading of audio, and initialization of system components into the AppDelegate::applicationDidFinishLaunching() function, or had it call the initialization routine from there. This was because this is the place where the first main scene for the application is selected and loaded into the CCDirector. Recently, one of my tutorials was ported to Windows and it appears

how to declare label in global class (helloworld.h) with cocos2d-x v3.2?

大城市里の小女人 提交于 2020-01-02 15:04:21
问题 I'm creating a 2d platform game with cocos2d-x v3.2 (c++) and i'm using label. cocos2d-x v3.0 (c++) declared like cocos2d::LabelTTF* currentScore; cocos2d-x v2.2.2 (c++) declared like cocos2d::CCLabelTTF* currentScore; cocos2d-x v3.2(c++) how to declare label in global class(helloworld.h) i have try like HelloWorld.h class HelloWorld : public cocos2d::LayerColor { public: virtual bool init(); cocos2d::LabelTTF* currentScore; //semantic issue(LabelTTF deprecared) }; #endif HelloWorld.cpp bool

how to declare label in global class (helloworld.h) with cocos2d-x v3.2?

北战南征 提交于 2020-01-02 15:03:19
问题 I'm creating a 2d platform game with cocos2d-x v3.2 (c++) and i'm using label. cocos2d-x v3.0 (c++) declared like cocos2d::LabelTTF* currentScore; cocos2d-x v2.2.2 (c++) declared like cocos2d::CCLabelTTF* currentScore; cocos2d-x v3.2(c++) how to declare label in global class(helloworld.h) i have try like HelloWorld.h class HelloWorld : public cocos2d::LayerColor { public: virtual bool init(); cocos2d::LabelTTF* currentScore; //semantic issue(LabelTTF deprecared) }; #endif HelloWorld.cpp bool

How to debug cocos2d-x 3 native code on android device

♀尐吖头ヾ 提交于 2019-12-29 03:12:27
问题 I could not find any cookbook/tutorial how build in debug build a cocos2d-x 3.1 project for Android and how to debug it directly on device. Please help by pointing out steps. What I do and what problems I have: cd proj.android cocos compile -p android -m debug --ndk-mode NDK_DEBUG=1 (to build with debug info) cocos run -p android -m debug to deploy on device run app on the device cd jni ndk-gdb And I get this error: Nareks-MacBook-Pro:jni Narek$ ndk-gdb jni/Android.mk:67: *** Android NDK:

How to debug cocos2d-x 3 native code on android device

ε祈祈猫儿з 提交于 2019-12-29 03:12:14
问题 I could not find any cookbook/tutorial how build in debug build a cocos2d-x 3.1 project for Android and how to debug it directly on device. Please help by pointing out steps. What I do and what problems I have: cd proj.android cocos compile -p android -m debug --ndk-mode NDK_DEBUG=1 (to build with debug info) cocos run -p android -m debug to deploy on device run app on the device cd jni ndk-gdb And I get this error: Nareks-MacBook-Pro:jni Narek$ ndk-gdb jni/Android.mk:67: *** Android NDK:

C++ Cannot get value of global variable in cocos2d-x

谁说胖子不能爱 提交于 2019-12-25 02:42:47
问题 I have a problem when working with CCArray in cocos2d-x. I declare CCArray *arrCs, on the top, in init() function I set value for arrCs, but after I get value from it in touch event, it has nothing. Please help me, thank all. In MainGame.cpp int radius= 32; float scaleImage= 0.5; int nItem= 60; float pMargin= 5; int limitTime= 70; float timeWaiting= 8; bool opTouch= true; int lastIndex= -1; Size visibleSize; CCArray *arrCs; bool MainGame::init(){ arrCs= CCArray::create(); int xx= pMargin+

setContentSize is not working in cocos2dx3.0

孤者浪人 提交于 2019-12-25 02:41:56
问题 setContentSize is not working i am new in cocos2dx and i want to add layer from another class to my main Splashscreen class but setContentSize use device width and height. i want to set layer size along with my sprite size. see my code Gadget.cpp #include "Gadget.h" #include "math.h" int nCount = 100; static CCPoint Circle [100]; // vertex array Gadget* Gadget::create(int type) { Gadget *pRet = new Gadget(); if (pRet && pRet->init(type)) { pRet->autorelease(); return pRet; } else { delete

Can't execute setup.py (Error 5 - Access Denied)

别等时光非礼了梦想. 提交于 2019-12-25 02:29:59
问题 I ran into a problem creating a new project in Cocos2d-x 3.1.1 (or 3.0 - it happens at both versions). When I'm running the build script in console (Windows 8 - console with admin privileges) an WindowsError pops up (check the image below). http://i.imgur.com/Ixg4jEE.png I can set up the COCOS_CONSOLE_ROOT manually, but it does not help with the Error 5 . I tried setting the 777 priviligies an all cocos2d-x folder and subfolders, but it does not help. Anybody had the same problem? Any