Cocos2d-X----关于覆盖问题 setZorder

前端之家收集整理的这篇文章主要介绍了Cocos2d-X----关于覆盖问题 setZorder前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

关于覆盖问题 setZorder

#include "T03LayerZorder.h"


CCScene * T03LayerZorder::scene()
{
	CCScene * scene = CCScene::create();
	T03LayerZorder * layer = T03LayerZorder::create();
	scene->addChild(layer);

	return scene;
}
bool T03LayerZorder::init()
{
	if (!CCLayer::init())
	{
		return false;
	}


	CCSprite * man = CCSprite::create("zorder/man.png");
	man->setPosition(ccp(240-40,160-20));
	man->setScale(0.3);
	addChild(man);
	man->setZOrder(12);

	CCSprite * woman = CCSprite::create("zorder/woman.png");
	woman->setPosition(ccp(240,160));
	woman->setScale(0.3);
	addChild(woman);
	woman->setZOrder(10);

	CCSprite * another = CCSprite::create("zorder/another.png");
	another->setPosition(ccp(240+40,160+20));
	another->setScale(0.3);
	addChild(another);
	another->setZOrder(5);


	return true;
}
原文链接:https://www.f2er.com/cocos2dx/344021.html

猜你在找的Cocos2d-x相关文章