2014年11月8日
摘要: 添加一个精灵, 让它从高处落下boolHelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !Layer::init() ) { return false; } #if CC_ENABLE_BOX2D_INTEGRATION log("启用... 阅读全文
posted @ 2014-11-08 16:27 <懒洋洋> 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 在层的头文件定义一个变量和一个方法class HelloWorld : public cocos2d::Layer{public: ... //physics world cocos2d::PhysicsWorld *m_physicsWorld; void setPhysicsWorld(cocos2d::PhysicsWorld *physicsWorld){m... 阅读全文
posted @ 2014-11-08 15:47 <懒洋洋> 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 修改项目的Preprocessor Macros, 将Debug & Release 的CC_ENABLE_CHIPMUNK_INTEGRATION=1 改为CC_ENABLE_BOX2D_INTEGRATION=1检查是否启用Box2d引擎的方法#if CC_ENABLE_BOX2D_INTEGRATION log("启用了Box2d");#endif 阅读全文
posted @ 2014-11-08 15:14 <懒洋洋> 阅读(135) 评论(0) 推荐(0) 编辑
  2014年11月5日
摘要: 1. 从官方网站下载最新的版本http://www.lua.org/download.html2. 解压缩下载的文件是lua-5.2.3.tar.gz, 将它解压缩3. 编译打开终端,输入lua源码所在的位置, 例如:$ cd /Users/Alan/Downloads/lua-5.2.3在命令行输入, 开始编译$ make macosx4. 安装$ sudo make install... 阅读全文
posted @ 2014-11-05 11:01 <懒洋洋> 阅读(213) 评论(0) 推荐(0) 编辑
  2014年11月4日
摘要: 谈到地图不少人都说要做地图编辑器了,但是我暂时绕过这一步,如果不用寻路地图就不能移动?寻路就是会绕过障碍物的算法。我做了一个简单的地图的思想,就是地图分层3层:背景层、可行区域层、遮罩层,但是地图就不寻路了,通过设置可行区域层来实现地图障碍物的方法。下面看一个视图,我把地图详细的分层了:OK,有了这个思路,大家应该也知道我要怎么做了?代码实现上怎么处理呢?重点:可行区域层原理是根据点击屏幕上的坐... 阅读全文
posted @ 2014-11-04 22:04 <懒洋洋> 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 游戏开发中常遇到资源保护的问题。目前游戏开发中常加密的文件类型有:图片,Lua文件,音频等文件,而其实加密也是一把双刃剑。需要安全那就得耗费一定的资源去实现它。目前网上也有用TexturePacker工具来加密的,不过针对性还是不够强。分析一下原理为:1,转格式:将需要加密的文件转为流的方式;2,加... 阅读全文
posted @ 2014-11-04 21:52 <懒洋洋> 阅读(947) 评论(0) 推荐(0) 编辑
摘要: TexturepackerThe sprite sheet creator turns chaos into orderhttp://www.codeandweb.com/texturepacker作用:图片打包和资源优化。把散乱的图片打包成大图片,进行资源优化。PhysicseditorEdit your physics shapes with easehttp://www.codeandwe... 阅读全文
posted @ 2014-11-04 21:40 <懒洋洋> 阅读(201) 评论(0) 推荐(0) 编辑
  2012年7月23日
摘要: - (CCAnimation*) animationWithFile:(NSString*)name frameCount:(int)frameCount delay:(float)delay { //动画帧文件集 NSMutableArray* frames = [NSMutableArray arrayWithCapacity:frameCount]; // ... 阅读全文
posted @ 2012-07-23 09:52 <懒洋洋> 阅读(145) 评论(0) 推荐(0) 编辑
摘要: // 获取Resources目录下的文件夹路径, 例如: Resources/FolderName NSString *bundlePath = [[[NSBundle mainBundle] pathForResource:@"FolderName" ofType:nil] retain]; // 读取文件 NSString *FilePath = [bundlePath string... 阅读全文
posted @ 2012-07-23 09:24 <懒洋洋> 阅读(980) 评论(0) 推荐(0) 编辑
  2012年7月19日
摘要: switch (expression){ case value1: program statement program statement ... break; case value2: ... 阅读全文
posted @ 2012-07-19 15:37 <懒洋洋> 阅读(555) 评论(0) 推荐(0) 编辑