Fill (Bill man) Personal originality. You are welcome to repost it. Please specify the address for reprinting (Bill man) Column addressHttp://blog.csdn.net/bill_man
Cocos2d-xSelf-containedBox2dEngine,Cocos2d-xThere are alsoCocos2d-xFor better researchBox2dFrom this article, I will explain the examples and further studyBox2d
First, the file structure is shown in
TestAre all examples. HFile, allTestBoth inherit fromTest,. HThere are also implementations in the file. From the next one, I will write them one by one.Box2dFor example, I useExample in cocos2d-1.0.1-x-0.11.0 release
Enter box2dtestbedscene, then menulayer, and menulayer to enter box2dview. The initialization function of box2dview is as follows:
Define a call per frameTickIn addition, rewriteDrawFunction.
EachTestAllTestentry type,CodeAs follows:
Each entryTest, ThroughCreateStart.
In additionTestFor example, defining the world and other initialization content.
Then rewrite the required collision function.
This function is called after a collision update. You can change the collision event before the collision is updated.
If there are any errors, I hope you can correct them more.
Next, write down the tumbler example.