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


C++ Enemy::autorelease方法代码示例

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


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

示例1: Enemy

Enemy * Enemy::createEnemy(GameStage stage)
{
    int i;
    Enemy * enemy = new Enemy(stage);
    if (enemy) {
        
        enemy->_weakIndex = 0;
        for (i = 0; i < ENEMY1_NUM; i++) {
            enemy->initWithEnemyType(stage, kEnemy01);
            enemy->setVisible(false);
            enemy->_weak.pushBack(enemy);
        }
        
        enemy->_mediumIndex = 0;
        for (i = 0; i < ENEMY2_NUM; i++) {
            enemy->initWithEnemyType(stage, kEnemy02);
            enemy->setVisible(false);
            enemy->_medium.pushBack(enemy);
       }
        
        enemy->_strongIndex = 0;
        for (i = 0; i < ENEMY3_NUM; i++) {
            enemy->initWithEnemyType(stage, kEnemy03);
            enemy->setVisible(false);
            enemy->_strong.pushBack(enemy);
       }
        
        enemy->autorelease();
        return enemy;
    }
    delete enemy;
    enemy = nullptr;
    return nullptr;
    
}
开发者ID:kubocker,项目名称:SpaceShooting,代码行数:35,代码来源:Enemy.cpp

示例2: create

Enemy* Enemy::create()
{
	Enemy* pRet = new Enemy();
	if (pRet != nullptr) {
		pRet->autorelease();
		return pRet;
	}
	else
		return nullptr;
}
开发者ID:fordream,项目名称:AirPlane,代码行数:10,代码来源:Enemy.cpp

示例3:

Enemy * Enemy::create_sprite(const Vec2 init_pos)
{
	Enemy *ret = new Enemy;
	if (ret && ret->init_sprite(init_pos))
	{
		ret->autorelease();
		return ret;
	}
	CC_SAFE_DELETE(ret);
	return nullptr;
}
开发者ID:dotrung,项目名称:bazooka-game,代码行数:11,代码来源:Enemy.cpp

示例4: create

Enemy* Enemy::create()
{
	Enemy* enemy = new Enemy();
	if (!enemy->init())
	{
		CC_SAFE_DELETE(enemy);
		return nullptr;
	}
	enemy->autorelease();
	
	return enemy;
}
开发者ID:ashpemb,项目名称:TGPProject,代码行数:12,代码来源:Enemy.cpp

示例5: createEnemy

Enemy* Enemy::createEnemy(char* name,int type)
{
    Enemy *pRet = new Enemy();
    if (pRet && pRet->initWithFile(name))
    {
        pRet->init(name,type);
        pRet->autorelease();
        return pRet;
    }
    CC_SAFE_DELETE(pRet);
    return NULL;
}
开发者ID:2011conquer,项目名称:AirPlane,代码行数:12,代码来源:Enemy.cpp

示例6: Enemy

Enemy *Enemy::create(
	int stage,
	int enemyType){
	Enemy *e = new Enemy();

	if(e && e->init(stage, enemyType)){
		e->autorelease();
		return e;
	}
	CC_SAFE_DELETE(e);
	return nullptr;
}
开发者ID:SubwayRocketTeam,项目名称:game,代码行数:12,代码来源:Enemy.cpp

示例7: create

/**自己的create函数,因为要带参数,那个子弹类也可以这么写*/
Enemy* Enemy::create(EnemyType type)
{
    Enemy *pRet = new Enemy();
    if (pRet && pRet->enemyInit(type)) {
        pRet->autorelease();
        return pRet;
    }
    else
    {
        delete pRet;
        pRet = NULL;
        return NULL;
    }
}
开发者ID:897290110,项目名称:MoonWarriors,代码行数:15,代码来源:Enemy.cpp

示例8: create

Enemy* Enemy::create(Layer* gameLayer)
{
	Enemy* pRet = new Enemy();
	if (pRet&&pRet->initwithGame(gameLayer))
	{
		pRet->autorelease();
		return pRet;
	}
	else
	{
		delete pRet;
		pRet = nullptr;
		return nullptr;
	}
}
开发者ID:fordream,项目名称:TowerDefnece,代码行数:15,代码来源:Enemy.cpp

示例9: nodeWithTheGame

Enemy* Enemy::nodeWithTheGame(HelloWorld* game)
{
	Enemy *pRet = new Enemy();
	if (pRet && pRet->initWithTheGame(game))
	{
		pRet->autorelease();
		return pRet;
	}
	else
	{
		delete pRet;
		pRet = NULL;
		return NULL;
	}
}
开发者ID:Kurukshetran,项目名称:Cocos2dxGame,代码行数:15,代码来源:Enemy.cpp

示例10: create

Enemy* Enemy::create ( KDuint uType )
{
	Enemy*  pRet = new Enemy ( );

	if ( pRet && pRet->init ( uType ) )
	{
		pRet->autorelease ( );
	}
	else
	{
		CC_SAFE_DELETE ( pRet );
	}

	return pRet;
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:15,代码来源:Enemy.cpp

示例11: create

Enemy* Enemy::create(){

	Enemy *pRet = new Enemy;
	if (pRet && pRet->init())
	{
		pRet->autorelease();
		
		return pRet;
	}
	else
	{
		CC_SAFE_DELETE(pRet);
		return NULL;
	}
}
开发者ID:jingwang109,项目名称:FeiJi-cocos2d-x,代码行数:15,代码来源:Enemy.cpp

示例12: create

Enemy* Enemy::create(CCPoint position, const char* fileName)
{
	//エネミー生成
	Enemy* enemy = new Enemy();
	if (enemy)
	{
        enemy->initEnemy(position, fileName);
		enemy->autorelease();
		GAME::getInstance()->addChild(enemy, kTag_Enemy, kOrder_Enemy);
		return enemy;
	}
	//autoreleaseを使用しているため、deleteの代わりに使用、メモリを開放
	//何度も生成しないようにガードをかける
	CC_SAFE_DELETE(enemy);
	return NULL;
}
开发者ID:Nadd3564,项目名称:2DActionPuzzleGame,代码行数:16,代码来源:Enemy.cpp

示例13: create

Enemy* Enemy::create(const std::string & filename)
{
    Enemy* pSprite = new Enemy();

    if (pSprite->initWithFile(filename))
    {
        pSprite->autorelease();

        pSprite->initOptions();

        return pSprite;
    }

    CC_SAFE_DELETE(pSprite);
    return NULL;
}
开发者ID:betterwithlasers,项目名称:gash-prototype,代码行数:16,代码来源:Enemy.cpp

示例14: Enemy

Enemy * Enemy::create()
{
	Enemy * pRect = new Enemy();
	pRect->autorelease();
	return pRect;
}
开发者ID:whuhan2013,项目名称:Plane,代码行数:6,代码来源:Enemy.cpp


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