本文整理汇总了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;
}
示例2: create
Enemy* Enemy::create()
{
Enemy* pRet = new Enemy();
if (pRet != nullptr) {
pRet->autorelease();
return pRet;
}
else
return nullptr;
}
示例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;
}
示例4: create
Enemy* Enemy::create()
{
Enemy* enemy = new Enemy();
if (!enemy->init())
{
CC_SAFE_DELETE(enemy);
return nullptr;
}
enemy->autorelease();
return enemy;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例11: create
Enemy* Enemy::create(){
Enemy *pRet = new Enemy;
if (pRet && pRet->init())
{
pRet->autorelease();
return pRet;
}
else
{
CC_SAFE_DELETE(pRet);
return NULL;
}
}
示例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;
}
示例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;
}
示例14: Enemy
Enemy * Enemy::create()
{
Enemy * pRect = new Enemy();
pRect->autorelease();
return pRect;
}