Esempio n. 1
0
Bird* Bird::create(const std::string& filename, const std::string& c_plist, const char* c_FileNameFormat, Vec2 P0, Vec2 P1, Vec2 P2, Vec2 P3, float DelayTime, float FlyTime)
{
	Bird *sprite = new (std::nothrow) Bird(filename, c_plist, c_FileNameFormat, P0, P1, P2, P3, DelayTime, FlyTime);
	if (sprite && sprite->init())
	{
		sprite->autorelease();		
		return sprite;
	}
	CC_SAFE_DELETE(sprite);
	return nullptr;
}
Esempio n. 2
0
Bird* Bird::createWithWorld( b2World* world )
{
	Bird* result = new Bird();
	if (result && result->initWithWorld(world))
	{
		result->autorelease();
		return result;
	} else {
		delete result;
		result = NULL;
		return NULL;
	}
}
Esempio n. 3
0
Bird * Bird::create( short type )
{
    Bird *bird = new Bird();
    CCString *name = CCString::createWithFormat("*****@*****.**",type);
    if(bird&&bird->initWithSpriteFrameName(name->getCString()))
    {
        bird->birdType = type;
        bird->autorelease();
        CCArray *frames = CCArray::create();
        CCString *blinkFrame = CCString::createWithFormat("*****@*****.**",type);
        frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name->getCString()));
        frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(blinkFrame->getCString()));
        frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name->getCString()));
        CCAnimation *animation = CCAnimation::createWithSpriteFrames(frames,0.2f);
        bird->blinkAct = CCAnimate::create(animation);
        bird->blink();
        return bird;
    }
    return NULL;
}