摘要:
Test6::Test6(){ CCSprite* sp1 = CCSprite::create(s_pPathSister1); CCSprite* sp11 = CCSprite::create(s_pPathSister1); CCSprite* sp2 = CCSprite::create(s_pPathSister2); CCSprite* sp21 = CCSprite::create(s_pPathSister2); sp1->setPosition(ccp(100,160)); sp2->setPosition(ccp(380... 阅读全文
摘要:
Test5::Test5(){ CCSprite* sp1 = CCSprite::create(s_pPathSister1); CCSprite* sp2 = CCSprite::create(s_pPathSister2); sp1->setPosition(ccp(100,160)); sp2->setPosition(ccp(380,160)); CCRotateBy* rot = CCRotateBy::create(2, 360); CCActionInterval* rot_back = rot->reverse(); CCAc... 阅读全文
摘要:
Test4::Test4(){ CCSprite *sp1 = CCSprite::create(s_pPathSister1); CCSprite *sp2 = CCSprite::create(s_pPathSister2); sp1->setPosition( ccp(100,160) ); sp2->setPosition( ccp(380,160) ); addChild(sp1, 0, 2); addChild(sp2, 0, 3); //在第二秒的时候执行delay2函数 schedule( schedule_sel... 阅读全文
摘要:
void Test2::onEnter(){ TestCocosNodeDemo::onEnter(); CCSize s = CCDirector::sharedDirector()->getWinSize(); CCSprite *sp1 = CCSprite::create(s_pPathSister1); CCSprite *sp2 = CCSprite::create(s_pPathSister2); CCSprite *sp3 = CCSprite::create(s_pPathSister1); CCSprite *sp4 = CCSp... 阅读全文
摘要:
#ifndef _DRAW_PRIMITIVES_TEST_H_#define _DRAW_PRIMITIVES_TEST_H_////----#include "cocos2d.h"#include "../testBasic.h"class DrawPrimitivesTest : public CCLayer{public: DrawPrimitivesTest(); virtual void draw();//必须重写这个函数,画图要在这函数中画};class DrawPrimitivesTestScene : public TestScene{ 阅读全文
摘要:
void MotionStreakTest1::onEnter(){ MotionStreakTest::onEnter(); CCSize s = CCDirector::sharedDirector()->getWinSize(); // the root object just rotates around m_root = CCSprite::create(s_pPathR1); addChild(m_root, 1); m_root->setPosition(ccp(s.width/2, s.height/2)); // the ta... 阅读全文
摘要:
//创建类的对象,并返回相应类的指针/** * define a create function for a specific type, such as CCLayer * @__TYPE__ class type to add create(), such as CCLayer */#define CREATE_FUNC(__TYPE__) \static __TYPE__* create() \{ \ __TYPE__ *pRet = new __TYPE__(); \ if (pRet && pRet->init()) \ { \ pRet->autor.. 阅读全文
摘要:
关于scheduleUpdate看这篇即可http://www.benmutou.com/blog/archives/56接下来是示例代码: CCSize size = CCDirector::sharedDirector()->getWinSize(); //创建二个精灵,一绿一红 CCSprite *psSprite1 = CCSprite::create("green.png"); CCSprite *psSprite2 = CCSprite::create("red.png"); //利用精灵创建进度条,并设置一些属... 阅读全文
摘要:
pSprite->setAnchorPoint(CCPoint(0,0)); pSprite->setPosition(CCPoint(300,700)); CCFiniteTimeAction* pAcion = CCEaseElasticOut::actionWithAction( CCMoveTo::create(1.0f,CCPoint(300,300)),0.6f);//通过第二个参数来调整振幅,或者速度,值越大越慢振幅越小 pSprite->runAction( CCRepeatForever::create( ... 阅读全文
摘要:
关于ccTouchesEnded看这个博客即可http://blog.linguofeng.com/archive/2012/09/12/cocos2d-x-touch.htmlclass ClickAndMoveTestScene : public TestScene{public: virtual void runThisTest();};class MainLayer : public CCLayer{public: MainLayer(); virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);};... 阅读全文