YUYE'Tutorials(What kind of the tutorial do you want to learn and we'll make it for you)

Hi Yuye! Thanks for awesome tutorials! I learned how to do most of the stuff through your tutorials :wink:

I only have one question, what IDE do you use for Android development?

It has been two weeks that I am trying to make my Eclipse ADT work with Cocos2dx but NO success so far :frowning:

Thanks to your tutorials, I learned how to modify the code and and how to run the “build_native.py” and then deploy to the android device. But there is no CODE COMPLETION on Eclipse :frowning: Can you please tell me what IDE you use?

@kindlysendme
there is 2 ways to accomplish that
1-you can download last version of ADT Bundle that also has CDT, convert your project to c++ and disable all warning and error from preference for editor
then whenever you want to run the app, First run build_native.py and then run as android application

**Also if you have just problem for completion,first convert your project to c++ and go to project properties then in c++ General ---->path and variables -->GNU C++ in include tab add the path of cocos2d-x and sub folders in this case the completion must work **

2-use Visual studio 2012 or 2013 and coding,testing for win32 platform, finally when your project is ready or you think it must test in android go to android folder edit android.mk and add c++ file name for compilation and then run build_native.py from command com and for running use cocos run -p android (use help switch for more info) to test the app in your phone

that’s it

@farid

Have you done method #1 yourself with V3.0 on Eclipse?

I am pretty sure that my steps are somehow correct as I can get Eclipse to work with V2.2.3 pretty good. Everything is fine, code completion works, complier works - but for V3.0 everything gets messed up – adding the folders to “include tab” didn’t solve it.

I have uploaded my steps here:

@kindlysendme
Yes, I’m using method 1 and 2 together

I saw your video, you know where is your problem ?
you must let the GCC Compiler decides about your code not the IDE so the solution:

Go to project properties ----------->C/C++ General---------->Code Analysis and **select use project setting radio button then deselect all below setting **

apply it and ok so you must not see any more red error annotation

everything is ok so run the app as android application

pls find the attached pic

Also in video, i did not see anything about running build_native.py so after your new project has created run build_native.py for making shared library to be available in the app
for completion you just need link the header files in include section as before said

any have any problem or questions, do not hesitate

@kindlysendme if u use the c++ to develop game. I suggest u use eclipse.but if u use lua or javascript.

you must try Cocos IDE

you can reference my topic://www.cocos2d-x.org/forums/11/topics/51172

and what is the problem happaned when u use eclipse. can you give me a screenshoot here for error

@farid thank u for answer it(/)

@mochichama

auto sprite = Sprite::create("bg.png");

// position the sprite on the center of the screen
sprite->setPosition(VisibleRect::center());

// add the sprite as a child to this layer
this->addChild(sprite, 0);


auto cache = SpriteFrameCache::getInstance();
cache->addSpriteFramesWithFile("Attack.plist");

//
// Animation using Sprite BatchNode
//
Sprite * sprite1 = Sprite::createWithSpriteFrameName("attack1.png");
sprite1->setPosition(VisibleRect::center());

auto spritebatch = SpriteBatchNode::create("Attack.pvr.ccz");
spritebatch->addChild(sprite1);
addChild(spritebatch);

Vector<SpriteFrame*> animFrames(15);

char str[100] = {0};
for(int i = 1; i < 56; i++)
{
    sprintf(str, "attack%d.png", i);
    auto frame = cache->getSpriteFrameByName( str );
    animFrames.pushBack(frame);
}

auto animation = Animation::createWithSpriteFrames(animFrames, 0.1f);
sprite1->runAction( RepeatForever::create( Animate::create(animation) ) );

Thank you guys for your help! :slight_smile:

I have bumped into another problem just recently. Is there anyway to do any of these things:

  • Dynamically change visible region of a sprite?
  • Make a layer bounded such that if any part of any sprites that belong to that layer is out of the boundary, then that part is not drawn.

This is what I am trying to achieve: [see attached]

basically I have a background and I have an overlay layer with a few sprite in it. I don’t want the sprite to be shown when they are out of the border.

I found GL_SCISSOR as a solution for cocos2d-iphone. But I can’t figure it out for cocos2d-x.

Hi,I had a problem when I adding admob SDK on the IOS platform with cocos2dx 3.0.
In cocos2dx 2.x, I use such code to add the admob SDK,
“[[CCEAGLView sharedEGLView] addSubview: view];”,
and now I’m using the cocos2dx 3.0 but I can’t find the right method.
I hope for your help, Thank you!

@yuye

“EDIT: as advised by dev.loop.2d, I feel I must spend more time and thoroughly go through API and examples… So, as of now, you may ignore my below request”

Hi there. Its been a while since you posted this on forum. But I wanted to share something.
If you can spare the time for making tutorials for us, then here is my kind request.

I started learning basics of game dev. by using Unity engine. I learned and found it easier.
After 2 months of understanding game dev and developing a few games, I wanted to shift to open source community so that I’ve better and root level control of what I am developing. So, I found Cocos2d-x, and found it to be ultra amazing and better than Unity in few aspects for 2D games.
In Unity(both 2D and 3D games), I found it easy to use because there was higher level of abstraction of classes like method Start()(for initializing the game scene), method Update()and FixedUpdate() for regularly updating the game scene and calling different functions.

It has been nearly 3 months but I am struggling a bit in order to have confidence in building my own games. I’ve read the documentation(haven’t gone through API part much). But I am actually able to gain the knowledge of what the different functions do, not the flow control. I’ve read some 2-3 source codes, but I am not able to have a clear idea of it. If you are entertaining any further requests, here is my wish :slight_smile:
Can you explain me the cocos2d-x v3.0 scripting architecture by making flow chart of “program flow control in a game” by taking an example of any very very simple game with atleast following components:
1)2 scenes and atleast 1 scene having 2 layers.
2) What are substitutes of Start and Update methods. I am not sure whether init() works is for Start() or works in addition to just Start()
3)Touches.

Note 1: I know how to make use of touch events but don’t understand from where it is getting called again and again. So, in flowchart, you may explain it that what is calling this touch method.
Note 2: I am aware of that who is child of who(Like Scenes,Layers are child of Node,etc) as it is given in documentation.

So, for Unity’s basic 2D game, if I were to explain the control flow, it would be something like: (Without picture): Game is started with a scene(which is explicitly set as main/first scene). The objects in this game scene is initialized through Start(). After it, Update()/FixedUpdate() method is auto called and auto updates the game objects in the current scene by calling different classes and its functions, and by making transitions to other scenes using a particular method. Layers in a particular scenes are actually set through GUI in the ‘layers’ and the objects on the same layer do not collide. We may set z-order of the game objects on the same layer.

I seriously don’t know if my request is worth while. Or else, can you guide me through another way instead of what I requested. I am very much interested in learning and sticking to cocos2d-x.

Thanks for reading so long request. I hope your guidance will take me understand properly.

Thanks again.

@catch_up Actually, I think that this information can be obtained if sufficient detail to study the examples and api. But I think that charts would be clearer and faster to learn.

@dev.loop.2d

Thanks for the reply… I am gonna read the API asap and examples too.
Can you please tell that what are the ‘charts’, that you mentioned? Are they same as flow chart that I requested for!! :wink:

Thanks :slight_smile:

@catch_up Yes, it’s the same thing. And I like your idea. :slight_smile: