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


C++ Bird::bird_Fly_Spot方法代码示例

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


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

示例1: init

// on "init" you need to initialize your instance
bool GameStart::init()
{
	//////////////////////////////
	// 1. super init first
	if ( !Layer::init() )
	{
		return false;
	}
	log("GameStart init");
	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();

	// add a "close" icon to exit the progress. it's an autorelease object
	auto closeItem = MenuItemImage::create(
		"CloseNormal.png",
		"CloseSelected.png",
		CC_CALLBACK_1(GameStart::menuCloseCallback, this));

	closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
		origin.y + closeItem->getContentSize().height/2));

	// create menu, it's an autorelease object
	auto menu = Menu::create(closeItem, NULL);
	menu->setPosition(Vec2::ZERO);
	this->addChild(menu, 1);

	// create and initialize a label
	auto label = Label::createWithTTF("Flappy Bird", "fonts/Marker Felt.ttf", 32);
	label->setPosition(Vec2(origin.x + visibleSize.width/2,origin.y + visibleSize.height - 80));
	this->addChild(label, 3);


	//initialize the SpriteFrameCache
	SpriteFrameCache *frameCache = SpriteFrameCache::getInstance();
	frameCache->addSpriteFramesWithFile("birdSprites.plist");

	auto ready = Sprite::createWithSpriteFrameName("text_ready.png");
	ready->setPosition(visibleSize.width/2,visibleSize.height/2+100);
	addChild(ready,1);

	auto tutorial = Sprite::createWithSpriteFrameName("tutorial.png");
	tutorial->setPosition(visibleSize.width/2,visibleSize.height/2-10);
	addChild(tutorial,1);

	auto ok = Sprite::createWithSpriteFrameName("button_ok.png");
	auto ok_item = MenuItemSprite::create(ok,ok,nullptr,CC_CALLBACK_1(GameStart::Game_Begin,this));
	auto mu = Menu::create(ok_item,0);
	mu->setPosition(visibleSize.width/2,visibleSize.height/2-80);
	addChild(mu,2);

	auto bg = Sprite::createWithSpriteFrameName("bg_day.png");
	bg->setPosition(visibleSize.width/2,visibleSize.height/2);
	addChild(bg);

	Bird *bird = new Bird(static_cast<BIRD_KINDS>(random(0,2)));
	bird->getBird()->setPosition(visibleSize.width/2-45,visibleSize.height/2);
	addChild(bird->getBird(),2);
	bird->bird_Fly_Spot();


	//draw the background





	return true;
}
开发者ID:zhanghuanzj,项目名称:MyFlappyBird,代码行数:69,代码来源:GameStart.cpp


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