当前位置: 首页>>代码示例>>C++>>正文


C++ SpriteBatchNode::getTexture方法代码示例

本文整理汇总了C++中SpriteBatchNode::getTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ SpriteBatchNode::getTexture方法的具体用法?C++ SpriteBatchNode::getTexture怎么用?C++ SpriteBatchNode::getTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SpriteBatchNode的用法示例。


在下文中一共展示了SpriteBatchNode::getTexture方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addChild

//------------------------------------------------------------------
//
// TMXOrthoTest
//
//------------------------------------------------------------------
TMXOrthoTest::TMXOrthoTest()
{
    //
    // Test orthogonal with 3d camera and anti-alias textures
    //
    // it should not flicker. No artifacts should appear
    //
    //auto color = LayerColor::create( Color4B(64,64,64,255) );
    //addChild(color, -1);

    auto map = TMXTiledMap::create("TileMaps/orthogonal-test2.tmx");
    addChild(map, 0, kTagTileMap);
    
    Size CC_UNUSED s = map->getContentSize();
    CCLOG("ContentSize: %f, %f", s.width,s.height);
    
    auto pChildrenArray = map->getChildren();
    SpriteBatchNode* child = NULL;
    Object* pObject = NULL;
    CCARRAY_FOREACH(pChildrenArray, pObject)
    {
        child = static_cast<SpriteBatchNode*>(pObject);

        if(!child)
            break;

        child->getTexture()->setAntiAliasTexParameters();
    }
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:33,代码来源:TileMapTest.cpp

示例2: createMapAndGetTile

void HelloWorld::createMapAndGetTile()
{
    auto mapnotchange = TMXTiledMap::create("orthogonal-test4.tmx");
    addChild(mapnotchange, 0, 1);
    mapnotchange->setPosition(50,240);
    
    auto map = TMXTiledMap::create("orthogonal-test4.tmx");
    addChild(map, 0, 2);
    map->setPosition(570,240);
    
    SpriteBatchNode* child = nullptr;
    
    auto& children = map->getChildren();
    
    for(const auto &node : children) {
        child = static_cast<SpriteBatchNode*>(node);
        child->getTexture()->setAntiAliasTexParameters();
    }
    
    map->setAnchorPoint(Point(0, 0));
    
    auto layer = map->getLayer("Layer 0");
    auto s = layer->getLayerSize();
    
    Sprite* sprite;
    sprite = layer->getTileAt(Point(0,0));
    sprite->setScale(2);
    sprite = layer->getTileAt(Point(s.width-1,0));
    sprite->setScale(2);
    sprite = layer->getTileAt(Point(0,s.height-1));
    sprite->setScale(2);
    sprite = layer->getTileAt(Point(s.width-1,s.height-1));
    sprite->setScale(2);
}
开发者ID:Ratel13,项目名称:book-code,代码行数:34,代码来源:HelloWorldScene.cpp

示例3: addChild

//------------------------------------------------------------------
//
// TMXOrthoTest4
//
//------------------------------------------------------------------
TMXOrthoTest4::TMXOrthoTest4()
{
    auto map = TMXTiledMap::create("TileMaps/orthogonal-test4.tmx");
    addChild(map, 0, kTagTileMap);
    
    Size CC_UNUSED s1 = map->getContentSize();
    CCLOG("ContentSize: %f, %f", s1.width,s1.height);

    SpriteBatchNode* child = nullptr;
    
    auto& children = map->getChildren();
    
    for(const auto &node : children) {
        child = static_cast<SpriteBatchNode*>(node);
        child->getTexture()->setAntiAliasTexParameters();
    }
    
    map->setAnchorPoint(Vec2(0, 0));

    auto layer = map->getLayer("Layer 0");
    auto s = layer->getLayerSize();
    
    Sprite* sprite;
    sprite = layer->getTileAt(Vec2(0,0));
    sprite->setScale(2);
    sprite = layer->getTileAt(Vec2(s.width-1,0));
    sprite->setScale(2);
    sprite = layer->getTileAt(Vec2(0,s.height-1));
    sprite->setScale(2);
    sprite = layer->getTileAt(Vec2(s.width-1,s.height-1));
    sprite->setScale(2);

    schedule( schedule_selector(TMXOrthoTest4::removeSprite), 2 );

}
开发者ID:289997171,项目名称:cocos2d-x,代码行数:40,代码来源:TileMapTest.cpp

示例4: addBird

void HelloWorld::addBird(cocos2d::Point p)
{
    SpriteBatchNode *parent = SpriteBatchNode::create("bird_hero.png");
    m_pSpriteTexture = parent->getTexture();//获取纹理贴图
    //将精灵批处理节点添加到层
    this->addChild(parent,0,kTagParentNode);
    
//    Sprite *sprite = Sprite::createWithTexture(m_pSpriteTexture,Rect(32*idx, 32*idy, 32, 32));
    
    bird = Sprite::createWithTexture(m_pSpriteTexture);
    parent->addChild(bird);
    
    Size birdSize = m_pSpriteTexture->getContentSize();
    
    b2BodyDef bodyDef;
    bodyDef.type = b2_dynamicBody;
    
    bodyDef.position.Set(p.x/PTM_RATIO, p.y/PTM_RATIO);
    bodyDef.userData = bird;
    b2Body *body = world->CreateBody(&bodyDef);
    
    //定义盒子形状
    b2PolygonShape dynamicBox;
    dynamicBox.SetAsBox(birdSize.width/2/PTM_RATIO, birdSize.height/2/PTM_RATIO);
    
    b2FixtureDef fixtureDef;
//   fixtureDef.filter.groupIndex = 0;
//    fixtureDef.filter.maskBits = 0x0002;//掩码
//    fixtureDef.filter.categoryBits = 0x0003;//设置分类码
    fixtureDef.shape = &dynamicBox;
    fixtureDef.density = 1.f;//密度
    fixtureDef.friction = 0.3f;
    fixtureDef.restitution = 0.f;//弹性系数
    body->CreateFixture(&fixtureDef);//用刚体创建夹具
    
    //事件监听
    auto listener1 = EventListenerTouchOneByOne::create();
    listener1->setSwallowTouches(true);
    listener1->onTouchBegan =[=](Touch *touch,Event *event)
    {
        //设置线性速度
        body->SetLinearVelocity(b2Vec2(0, 7));
        return true;
    };
    _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, this);
}
开发者ID:2011conquer,项目名称:FlappyBird,代码行数:46,代码来源:HelloWorldScene.cpp

示例5: world

Box2DTestLayer::Box2DTestLayer()
: _spriteTexture(NULL)
, world(NULL)
{
#if CC_ENABLE_BOX2D_INTEGRATION
    setTouchEnabled( true );
    setAccelerometerEnabled( true );

    // init physics
    this->initPhysics();
    // create reset button
    this->createResetButton();

    //Set up sprite
#if 1
    // Use batch node. Faster
    SpriteBatchNode *parent = SpriteBatchNode::create("Images/blocks.png", 100);
    _spriteTexture = parent->getTexture();
#else
    // doesn't use batch node. Slower
    _spriteTexture = TextureCache::getInstance()->addImage("Images/blocks.png");
    Node *parent = Node::create();
#endif
    addChild(parent, 0, kTagParentNode);


    addNewSpriteAtPosition(VisibleRect::center());

    LabelTTF *label = LabelTTF::create("Tap screen", "Marker Felt", 32);
    addChild(label, 0);
    label->setColor(Color3B(0,0,255));
    label->setPosition(Point( VisibleRect::center().x, VisibleRect::top().y-50));
    
    scheduleUpdate();
#else
    LabelTTF *label = LabelTTF::create("Should define CC_ENABLE_BOX2D_INTEGRATION=1\n to run this test case",
                                            "Arial",
                                            18);
    Size size = Director::getInstance()->getWinSize();
    label->setPosition(Point(size.width/2, size.height/2));
    
    addChild(label);
#endif
}
开发者ID:CBanDa,项目名称:cocos2d-x-3.0alpha0-pre,代码行数:44,代码来源:Box2dTest.cpp

示例6: if

/*
-(void) runDisappearAnimation : (BlockType )type : (CGPoint)pos : (b2World *)world : (b2Body *)body
{
if (type == Stone)
{
width = 15; height = 15;
frameCount = 4;
delay = 0.5f;
stoneType = [NSString stringWithFormat:@"stoneAni_%d.png",GLOBAL_MAPINFO[GLOBAL_GAMEINFO.currentLevel-1]];
}
else if (type == Item)
{
width = height = 27;
frameCount = 8;
delay = 0.2f;
stoneType = [NSString stringWithFormat:@"Tannenzapfen.png"];
}
SpriteBatchNode *parent = [SpriteBatchNode batchNodeWithFile:stoneType];
spriteTexture_ = [parent texture];

Sprite *sp1 = [Sprite spriteWithTexture:spriteTexture_ rect:CGRectMake( 0 , 0 , width, height)];
Sprite *sp2 = [Sprite spriteWithTexture:spriteTexture_ rect:CGRectMake( 15 , 0 , width, height)];
uint offsetY = 20;
uint offsetX = 10;


sp1.position = ccp(sp1.position.x +offsetX,sp1.position.y+offsetY);
sp2.position = ccp(sp2.position.x+offsetX,sp2.position.y+offsetY);
//sp3.position = ccp(sp3.position.x+offsetX,sp3.position.y+offsetY);
//sp4.position = ccp(sp4.position.x+offsetX,sp4.position.y+offsetY);
[self.parent addChild: sp1 z:15];
// [self addChild: sp2 z:15];

b2Body *body_StonePiece1;
b2BodyDef bodyDef_StonePiece1;
b2FixtureDef fixtureDef_StonePiece1;
b2PolygonShape shape_StonePiece1;
bodyDef_StonePiece1.type = b2_dynamicBody;
bodyDef_StonePiece1.position.Set(sp1.position.x/PTM_RATIO, sp1.position.y/PTM_RATIO);
bodyDef_StonePiece1.userData = sp1;
body_StonePiece1 = world->CreateBody(&bodyDef_StonePiece1);
shape_StonePiece1.SetAsBox(sp1.contentSize.width/PTM_RATIO*0.5, sp1.contentSize.height/PTM_RATIO*0.5);
fixtureDef_StonePiece1.restitution = 0.5f;
fixtureDef_StonePiece1.friction = 0.5f;
fixtureDef_StonePiece1.density = 1.0f;
fixtureDef_StonePiece1.shape = &shape_StonePiece1;
body_StonePiece1->CreateFixture(&fixtureDef_StonePiece1);
body_StonePiece1->ApplyForce(b2Vec2(1,15), body_StonePiece1->GetWorldCenter());
[self removeFromParentAndCleanup:YES];
}
*/
CCAnimation * BlockSprite::createAnimationFromCachedImage(BlockType type, unsigned int stage)
{
	unsigned int  smallStage = GLOBAL_MAPINFO[stage - 1];
	if (type == Stone)
	{
		frameCount = 5;
		delay = 0.3f;
		width = 27 * RATE; height = 36 * RATE;
		if (smallStage == 1 || smallStage == 2 || smallStage == 6)
			stoneType = String::createWithFormat("Stone_%d_%d-hd.png", smallStage, rand() % 3 + 1);
			//[NSString stringWithFormat : @"Stone_%d_%d.png", smallStage, rand() % 3 + 1];
		else
			stoneType = String::createWithFormat("Stone_%d_%d-hd.png", smallStage, 1);
			//[NSString stringWithFormat : @"Stone_%d_%d.png", smallStage, 1];
	}
	else if (type == Item)
	{
		frameCount = 5;
		delay = 0.3f;
		width = height = 27 * RATE;
		stoneType = String::createWithFormat("Item_%d-hd.png", smallStage);
			//[NSString stringWithFormat : @"Item_%d.png", smallStage];
	}
	SpriteBatchNode *parent = SpriteBatchNode::create(stoneType->getCString());
		//[SpriteBatchNode batchNodeWithFile : stoneType];
	spriteTexture_ = parent->getTexture();
		//[parent texture];
	//NSMutableArray *cachedImage = [NSMutableArray array];
	Vector<SpriteFrame*> cachedImage;
	for (int i = 0; i < frameCount; i++)
	{
		//[cachedImage addObject :
		//[SpriteFrame frameWithTexture : spriteTexture_ rect : CGRectMake(i * 27 * RATE, 0, width, height)]];
		cachedImage.pushBack(SpriteFrame::createWithTexture(spriteTexture_, Rect(i * 27 * RATE, 0, width, height)));
	}

	CCAnimation *animation = Animation::createWithSpriteFrames(cachedImage, delay);
		//[CCAnimation animationWithSpriteFrames : cachedImage delay : delay];
	return animation;
}
开发者ID:baochi810,项目名称:freelance_02,代码行数:91,代码来源:BlockSprite.cpp

示例7: createWithTMX

void TileMapLayer::createWithTMX(const char* tmxFile)
{
	// create a TMX map --- WARNING : if tsx path in the tmx file is subclass of Resources, libs can't find *.tsx, *.png
	map = TMXTiledMap::create(tmxFile);
	prepareLayers();
	addChild(map);

	// All the tiles by default will be aliased. If you want to create anti-alias tiles, you should do:
	// iterate over all the "layers" (atlas sprite managers)
	// and set them as 'antialias' 
	Array * pChildrenArray = map->getChildren();
	SpriteBatchNode* child = NULL;
	Object* pObject = NULL;

	CCARRAY_FOREACH(pChildrenArray, pObject)
	{
		child = (SpriteBatchNode*)pObject;

		if(!child)
			break;

		child->getTexture()->setAntiAliasTexParameters();
	}
开发者ID:rtothecore,项目名称:SaladMaker,代码行数:23,代码来源:TileMap.cpp

示例8: init

// on "init" you need to initialize your instance
bool CShop::init()
{
	//////////////////////////////
	// 1. super init first
	if (!Layer::init())
	{
		return false;
	}

	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();

	/////////////////////////////
	// 3. add your codes below...

	auto m_textureCache = TextureCache::getInstance();

	//添加背景
	auto bg = Sprite::createWithTexture(m_textureCache->getTextureForKey("select_degree.jpg")); 
	bg->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 2));
	this->addChild(bg);


	//////////道具种类/////////////

	//双倍分数 图标
	auto scoreSprite = Sprite::createWithTexture(
		m_textureCache->getTextureForKey("prop_score.png"));
	scoreSprite->setPosition(Vec2(visibleSize.width/4,visibleSize.height*0.6));
	this->addChild(scoreSprite);

	//双倍金币 图标
	auto goldSprite = Sprite::createWithTexture(
		m_textureCache->getTextureForKey("prop_gold.png"));
	goldSprite->setPosition(Vec2(visibleSize.width / 4, visibleSize.height*0.6 - scoreSprite->getContentSize().height));
	this->addChild(goldSprite);

	//延时 图标
	auto delaySprite = Sprite::createWithTexture(
		m_textureCache->getTextureForKey("prop_delay.png"));
	delaySprite->setPosition(Vec2(visibleSize.width / 4, visibleSize.height*0.6 - scoreSprite->getContentSize().height * 2));
	this->addChild(delaySprite);

	//提示 图标
	auto hintSprite = Sprite::createWithTexture(
		m_textureCache->getTextureForKey("prop_hint.png"));
	hintSprite->setPosition(Vec2(visibleSize.width / 4, visibleSize.height*0.6 - scoreSprite->getContentSize().height * 3));
	this->addChild(hintSprite);


	//////////玩家当前道具数量/////////////
	std::string num;

	//玩家金币数量

	auto m_goldSprite = Sprite::createWithTexture(
		m_textureCache->getTextureForKey("rest_gold.png"));
	m_goldSprite->setPosition(Vec2(visibleSize.width - m_goldSprite->getContentSize().width*0.6, visibleSize.height - m_goldSprite->getContentSize().height*0.6));
	m_goldSprite->runAction(Sequence::create(JumpTo::create(1.0,m_goldSprite->getPosition(),m_goldSprite->getContentSize().height,2),nullptr));
	this->addChild(m_goldSprite);

	num = String::createWithFormat("%d", CScore::getInstance()->getGold())->_string;
	auto remainLabel = Label::createWithCharMap(
		"digital.png",
		20, 20,
		'0');
	remainLabel->setString(num);
	remainLabel->setScale(1.5);
	remainLabel->setAlignment(TextHAlignment::RIGHT);
	remainLabel->setAnchorPoint(Vec2(1,1));
	remainLabel->setPosition(Vec2(visibleSize.width, visibleSize.height-m_goldSprite->getContentSize().height));
	this->addChild(remainLabel,1,101);
/*

	//金币积分兑换

	auto totalSprite1 = Sprite::create("total_change.png");
	auto totalSprite2 = Sprite::create("total_change.png");
	totalSprite2->setScale(1.2);

	auto totalGoldItem = MenuItemSprite::create(
		totalSprite1,
		totalSprite2
		);
	totalGoldItem->setCallback(CC_CALLBACK_1(CShop::onChangeItemCallback, this));
	totalGoldItem->setPosition(Vec2(
		visibleSize.width - totalGoldItem->getContentSize().width / 2, visibleSize.height - m_goldSprite->getContentSize().height-remainLabel->getContentSize().height*2));
	

	num = String::createWithFormat("%d", AdHelp::queryPoints())->_string;
	totalLabel = Label::createWithCharMap(
		"digital.png",
		20, 20,
		'0');
	totalLabel->setString(num);
	totalLabel->setScale(1.5);
	totalLabel->setAlignment(TextHAlignment::RIGHT);
	totalLabel->setAnchorPoint(Vec2(1, 1));
	totalLabel->setPosition(Vec2(visibleSize.width, visibleSize.height - m_goldSprite->getContentSize().height - remainLabel->getContentSize().height-totalSprite1->getContentSize().height));
//.........这里部分代码省略.........
开发者ID:120649969,项目名称:Zodiac,代码行数:101,代码来源:CShop.cpp

示例9: init

//实现PianoLayer类中的init方法,初始化布景
bool PianoLayer::init()
{
	//调用父类的初始化
    if ( !Layer::init() )
    {
        return false;
    }
    
    degree = 0;
    musicFlag = false;
    pauseFlag = false;
    instrumentName = "piano";
    instrumentNumber = 1;
    changeFlag = true;
    musicNum = 0;

    //获取可见区域尺寸
    Size visibleSize = Director::getInstance()->getVisibleSize();
    //获取可见区域原点坐标
    Point origin = Director::getInstance()->getVisibleOrigin();

    Sprite* volume = Sprite::create(pic_RESOURE_PATH + "volume_cn.png");				//音量
    volumeSize = volume->getContentSize();
    volume->setScale(1.2);
    volume->setPosition(Point(volumeSize.width/2 + 20, visibleSize.height - volumeSize.height/2));
    this->addChild(volume, 2);

    exit = Sprite::create(pic_RESOURE_PATH + "exit.png");			//退出
    Size exitSize = exit->getContentSize();
    exit->setScale(1.2);
    exit->setPosition(Point(visibleSize.width - exitSize.width/2, visibleSize.height - exitSize.height/2));
    this->addChild(exit, 2);

    slider = Slider::create();
	slider->loadBarTexture(pic_RESOURE_PATH + "soundBackGround.png");
	slider->loadSlidBallTextures(pic_RESOURE_PATH + "transparent.png",pic_RESOURE_PATH + "transparent.png", "");
	slider->loadProgressBarTexture(pic_RESOURE_PATH + "sound.png");
	slider->setAnchorPoint(Point(0, 0.5));
	sliderSize = slider->getContentSize();
	slider->setPercent(CocosDenshion::SimpleAudioEngine::getInstance()->getEffectsVolume()*100);
	slider->setPosition(Point(volumeSize.width*1.2 + 20,  visibleSize.height - volumeSize.height/2));
	slider->addEventListener(CC_CALLBACK_2(PianoLayer::sliderEvent, this));
	this->addChild(slider, 5);

	instrument = Sprite::create(pic_RESOURE_PATH + "piano_cn.png");	//选择
    Size selectSize = instrument->getContentSize();
    instrument->setPosition(
    		Point(
    				visibleSize.width - exitSize.width - selectSize.width/2 -20,
    				visibleSize.height - selectSize.height/2
    		));
    this->addChild(instrument, 2);

    selection = Sprite::create(pic_RESOURE_PATH + "back.png");			//背景
    selection->setPosition(
    		Point(
    				visibleSize.width - exitSize.width - selectSize.width/2 -20,
    				visibleSize.height - selectSize.height/2
    		));
    this->addChild(selection, 1);

    Sprite* left = Sprite::create(pic_RESOURE_PATH + "left.png");			//左键
    leftSize = left->getContentSize();
    left->setScale(SCALE);
    left->setPosition(
    		Point(
    				leftSize.width/2*SCALE + 10,
    				visibleSize.height - volumeSize.height - leftSize.height*SCALE/2 - 5
    		));
    this->addChild(left, 2);

    Sprite* right = Sprite::create(pic_RESOURE_PATH + "right.png");		//右键
    rightSize = right->getContentSize();
    right->setScale(SCALE);
    right->setPosition(
    		Point(
    				visibleSize.width - rightSize.width*SCALE/2 - 10,
    				visibleSize.height - volumeSize.height - rightSize.height*SCALE/2 - 5
    		));
    this->addChild(right, 2);

    //第二个参数为最大储存数
    SpriteBatchNode* batchNode = SpriteBatchNode::create(pic_RESOURE_PATH + "white_small.jpg", 50); 		//小键盘
	batchNode->setAnchorPoint(Point(0, 0));
	batchNode->setPosition(
			Point(
					leftSize.width*SCALE + LEFT_INTERVAL,
					visibleSize.height - volumeSize.height - ABOVE_INTERVAL
				));
	this->addChild(batchNode);

	for(int i = 0; i<PIANO_KEY; i++)									//小键盘
	{
		Sprite* whiteSmall = Sprite::createWithTexture(batchNode->getTexture(), Rect(0, 0, 34, 57));
		whiteSmall->setScale(SCALE);
		whiteSmall->setAnchorPoint(Point(0, 0));
		smallSize = whiteSmall->getContentSize();
		whiteSmall->setPosition(Point(i*smallSize.width*SCALE,0));
		batchNode->addChild(whiteSmall, 2);
//.........这里部分代码省略.........
开发者ID:chenqian89614,项目名称:xiaoxin,代码行数:101,代码来源:PianoLayer.cpp

示例10: initStonePieceWithType

StonePieceSprite* StonePieceSprite::initStonePieceWithType(BlockType type, b2World * world, StonePieceType piece, Point pos)
{

	int width, height;
	String *stoneType;
	CCTexture2D *spriteTexture_;
	int level = (g_nBigLevel - 1) * 8 + g_nSmallLevel;
	if (type == Stone)
	{
		width = 15 * RATE; height = 15 * RATE;
		stoneType = String::createWithFormat("stoneAni_%d-hd.png", GLOBAL_MAPINFO[level - 1]);
	}
	else if (type == Item)
	{
		width = height = 15 * RATE;
		stoneType = String::createWithFormat("itemAni_%d-hd.png", GLOBAL_MAPINFO[level - 1]);
	}
	else if (type == Platform_Breakable)
	{
		width = 40 * RATE; height = 27 * RATE;
		stoneType = String::createWithFormat("FlyingPlatform_break-hd.png");
		//stoneType = String::createWithFormat("itemAni_%d-hd.png", GLOBAL_MAPINFO[level - 1]);
	}
	SpriteBatchNode *parent = SpriteBatchNode::create(stoneType->getCString());
		//[SpriteBatchNode batchNodeWithFile : stoneType);
	spriteTexture_ = parent->getTexture();//[parent texture);
	if (Sprite::initWithTexture(spriteTexture_, Rect(piece*width, 0, width, height)))
	{


		BodyInfo info;
		if (type == Platform_Breakable)
		{
			this->setTag(tag_pb);
			info.type = b2_staticBody;
			info.categoryBit = CATEGORY_SCENE;
			info.maskBit = ~(CATEGORY_SCENE);
			info.density = 0.1f;
			

			if (piece == piece1)
				this->setPosition(pos.x - this->getContentSize().width / 2 * G_SCALEX, pos.y - this->getContentSize().height / 2 * G_SCALEY);
			else
				this->setPosition(pos.x + this->getContentSize().width / 2 * G_SCALEX, pos.y - this->getContentSize().height / 2 * G_SCALEY);
		}
		else if (type == Platform_Down_1)
		{
			this->setPosition(pos.x, pos.y - this->getContentSize().height / 2 * G_SCALEY);
			info.type = b2_kinematicBody;
			info.categoryBit = CATEGORY_SCENE;
			info.maskBit = ~CATEGORY_SCENE;
			auto moveX1 = MoveBy::create(2.0f,Point(this->getPosition().x, this->getPosition().y - 50 * G_SCALEY));
			auto moveX2 = MoveBy::create(2.0f,Point(this->getPosition().x, this->getPosition().y + 100 * G_SCALEY));
			auto moveX3 = MoveBy::create(2.0f,Point(this->getPosition().x, this->getPosition().y - 100 * G_SCALEY));
			auto action = RepeatForever::create( Sequence::create(moveX2, moveX3, NULL));
			this->runAction( Sequence::create( moveX1, action, NULL));
		}
		else if (type == Platform_Down_2)
		{



			this->setPosition(pos.x, pos.y - this->getContentSize().height / 2 * G_SCALEY);
			info.type = b2_kinematicBody;
			info.categoryBit = CATEGORY_SCENE;
			info.maskBit = ~CATEGORY_SCENE;
			auto moveX1 = MoveBy::create(2.0f, Point(this->getPosition().x, this->getPosition().y - 50 * G_SCALEY));
			auto moveX2 = MoveBy::create(2.0f, Point(this->getPosition().x, this->getPosition().y + 100 * G_SCALEY));
			auto moveX3 = MoveBy::create(2.0f, Point(this->getPosition().x, this->getPosition().y - 100 * G_SCALEY));
			auto action = RepeatForever::create(Sequence::create(moveX2, moveX3, NULL));
			this->runAction( Sequence::create( moveX1, action, NULL));







		}
		else if (type == Platform)
		{


			this->setPosition(pos.x, pos.y - this->getContentSize().height / 2 * G_SCALEY);
			info.type = b2_kinematicBody;
			info.categoryBit = CATEGORY_SCENE;
			info.maskBit = ~CATEGORY_SCENE;
			auto moveX1 = MoveBy::create(2.0f, Point(this->getPosition().x, this->getPosition().y - 50 * G_SCALEY));
			auto moveX2 = MoveBy::create(2.0f, Point(this->getPosition().x, this->getPosition().y + 100 * G_SCALEY));
			auto moveX3 = MoveBy::create(2.0f, Point(this->getPosition().x, this->getPosition().y - 100 * G_SCALEY));
			auto action = RepeatForever::create(Sequence::create(moveX2, moveX3, NULL));
			this->runAction( Sequence::create( moveX1, action, NULL));






		}
		else
//.........这里部分代码省略.........
开发者ID:baochi810,项目名称:freelance_02,代码行数:101,代码来源:StonePieceSprite.cpp


注:本文中的SpriteBatchNode::getTexture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。