Cocos2d-x 3.0 物理引擎小demo


Make a physics game use cocos2d-x 3.0(part 1)

They packed Chipmunk into Cocos2d-x 3.0. I don’t make a physics game before, but I think physics game is more interesting than others. Let’s go!(ps: I want to practice my English so it is in English…)

Runtime

  • Cocos2d-x 3.0
  • Windows 7
  • Python 2.7.5
  • Visual studio 2012(for windows)

Create A new Project 

         Please google  or baidu “how to create a project in cocos2d-x 3.0” 

  Here is my project :

          

Create A Pyhsics World

Following codes created a scene withphysics world and pass on child layer. Add codes in HelloWorldScene.h 


Andadd following codes to createScene method 

 

Create Pyhsics Boundary

In this version,everything need a node,following code show create physics boundary around the screen


Create a Ball

now,let's create a football in this world:


Run


ok,this demo is finished, if you want create more interesting objects,you can use thePhysicsEditor tools.





  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值