• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
linux_ios
博客园    首页    新随笔    联系   管理    订阅  订阅

随笔分类 -  ios游戏

cocos2dx 音乐与音效

摘要://根据不同的平台使用的预编译索引不同音频文件#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)#define EFFECT_FILE "effect2.ogg"#elif (CC_TARCET_PLATFORM == CC_PLATFORM_MARMALADE)#define EFFECT_FILE "effect1.raw"#else#define EFFECT_FILE "effect1.wav"#endif#if (CC_TARGET_PLATEFOM == CC_PLATFORM_ 阅读全文
posted @ 2013-04-13 19:49 linux_ios 阅读(3094) 评论(0) 推荐(0)
cocos2dx 圆形碰撞

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCLayerColor* colorLayer = CCLayerColor::create(ccc4(0, 0, 255, 0),480 ,320); addChild(colorLayer); CCLabelTTF * pLabel = CCLabelTTF::... 阅读全文
posted @ 2013-04-13 18:05 linux_ios 阅读(872) 评论(0) 推荐(0)
cocos2dx 矩形碰撞

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCLayerColor* colorLayer = CCLayerColor::create(ccc4(255, 0, 255, 0),480 ,320); addChild(colorLayer); CCLabelTTF * pLabel = CCLabelTTF::creat... 阅读全文
posted @ 2013-04-13 18:03 linux_ios 阅读(1888) 评论(0) 推荐(0)
cocos2dx 多点触屏事件

摘要:CCScene* HelloWorld::scene(){ // 'scene' is an autorelease object CCScene *scene = CCScene::create(); // 'layer' is an autorelease object HelloWorld *layer = HelloWorld::create(); // add layer as a child to scene scene->addChild(layer); // return the scene return scene;}/... 阅读全文
posted @ 2013-04-13 18:02 linux_ios 阅读(1245) 评论(0) 推荐(0)
cocos2dx 触屏事件

摘要:// on "init" you need to initialize your instancebool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCSprite * spr = CCSprite::create("Icon.png"); spr->setPosition(ccp(150, 200)); addChild(spr, 0... 阅读全文
posted @ 2013-04-13 18:01 linux_ios 阅读(454) 评论(0) 推荐(0)
cocos2dx 常见的32种切换场景的动画

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCSize size = CCDirector::sharedDirector()->getWinSize(); CCSprite * sp= CCSprite::create("background1.png"); sp->setPosition(ccp( size.width/2... 阅读全文
posted @ 2013-04-09 18:59 linux_ios 阅读(4065) 评论(0) 推荐(0)
cocos2dx 动画常见的22种特效

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCSize size =CCDirector::sharedDirector()->getWinSize();//获取屏幕大小 CCSprite * sp = CCSprite::create("Icon.png"); sp->setPosition(ccp(200, 200));... 阅读全文
posted @ 2013-04-09 08:32 linux_ios 阅读(5248) 评论(0) 推荐(0)
cocos2dx 自定义动画 手动添加

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } // CCSprite * sp= CCSprite::create("crop1.png");// sp->setPosition(ccp(170, 200));// addChild(sp);// // CCAnimation * animation = CCAnimati... 阅读全文
posted @ 2013-04-08 17:28 linux_ios 阅读(709) 评论(0) 推荐(0)
cocos2dx 自定义动画

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; }//// 添加4个精灵, 每个精灵用来标示一帧// CCSprite * sp1= CCSprite::create("crop1.png");// CCSprite * sp2= CCSprite::create("crop2.png");// CCSprite * sp3= CCSpri... 阅读全文
posted @ 2013-04-08 17:26 linux_ios 阅读(542) 评论(0) 推荐(0)
cocos2dx 常见的49中动作详解

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCSprite * sp= CCSprite::create("Icon.png"); sp->setPosition(ccp(150, 150)); addChild(sp,0,922); //// Action动作// ////CCMoveBy 创建一个移动的动作 参数1... 阅读全文
posted @ 2013-04-06 09:03 linux_ios 阅读(9312) 评论(0) 推荐(2)
cocos2dx CCScrollView 滚动视图

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCSize size = CCDirector::sharedDirector()->getWinSize();// 创建一个layer作为容器 CCLayer * containlayer = CCLayer::create(); CCSprite * sp = CCSprit... 阅读全文
posted @ 2013-04-04 13:42 linux_ios 阅读(1907) 评论(0) 推荐(0)
cocos2dx CCProgressTimer 进度条计时器

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCProgressTimer * pr = CCProgressTimer::create(CCSprite::create("Icon.png")); pr->setPosition(ccp(100,200));// 设置进度条的样式 pr->setType(kCCProgressTi... 阅读全文
posted @ 2013-04-04 11:30 linux_ios 阅读(1522) 评论(0) 推荐(0)
cocos2dx scheduleUpdate 更新函数

摘要:bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCSprite* sp = CCSprite::create("Icon.png"); sp->setPosition(ccp(100,100)); addChild(sp,0,922); // scheduleUpdate();// 自定义更新函数 , 每一帧都调用 sche... 阅读全文
posted @ 2013-04-04 11:06 linux_ios 阅读(1886) 评论(2) 推荐(0)
cocos2dx 获取设备的当前语言

摘要:// 获取当前设备的语言 CCSize size= CCDirector::sharedDirector()->getWinSize();// 这个是显示当前设备 CCLabelTTF * labelLanguage = CCLabelTTF::create("", "", 20); labelLanguage->setPosition(ccp(size.width* 0.5, size.height*0.5)); // 获取语言 ccLanguageType la = CCApplication::sharedApplica... 阅读全文
posted @ 2013-04-04 09:46 linux_ios 阅读(748) 评论(0) 推荐(0)
cocos2dx 绘图Draw

摘要:void HelloWorld::draw(){ CCSize size = CCDirector::sharedDirector()->getWinSize();// 设置颜色 ccDrawColor4B(255, 0, 255, 0);// 设置宽度 glLineWidth(3);// 绘制一条直线 起点到终点的位置 ccDrawLine(ccp(0, 0), ccp(size.width*0.5, size.height*0.5)); ccDrawColor4B(225, 255, 0, 0);// 设置像素尺寸 ... 阅读全文
posted @ 2013-04-04 09:44 linux_ios 阅读(868) 评论(0) 推荐(0)
cocos2dx 字体设置

摘要://设置字体 CCLabelTTF * pLabel1 = CCLabelTTF ::create("hello world !", "Thonburi", 24);// CCLabelTTF * pLabel1 = CCLabelTTF ::create("hello world !", "STKaiti", 24); // pLabel1->setPosition(ccp(100, 100)); pLabel1->cocos2d::CCNode::setPosition(100, 100); add 阅读全文
posted @ 2013-03-30 19:58 linux_ios 阅读(3379) 评论(0) 推荐(0)
cocos2dx CCLayer 常用的两种Layer层

摘要:// 常用的两种Layer层 CCLayer * lay = CCLayer::create();//默认的颜色是黑色 addChild(lay);// 红色 CCLayerColor * layercolor = CCLayerColor::create(ccc4(255, 0, 0, 255)); addChild(layercolor); layercolor->setPosition(ccp(250, 250)); // 蓝色 同时确定位置和颜色 CCLayerColor * layercolor1 = CCLa... 阅读全文
posted @ 2013-03-28 21:59 linux_ios 阅读(575) 评论(0) 推荐(0)
cocos2dx CCSprite 精灵的常用函数

摘要:// 精灵的常用函数 // add "HelloWorld" splash screen"// 创建 CCSprite* sp = CCSprite::create("Icon.png");// 位置 sp->setPosition(ccp(80,100));// 旋转 sp->setRotation(100); //0-360度// 设置放缩 sp->setScale(1.5);//0-1是缩小 大于1 就是放大了 addChild(sp); CCSprite * sp1= CCSprite::cre... 阅读全文
posted @ 2013-03-28 21:27 linux_ios 阅读(1051) 评论(0) 推荐(0)

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3