Exemplo n.º 1
0
void EnemyBulletManager::createEnemyBullet(Player* player,GMVector2D pos, int type , int number)
{
	EnemyBullet* eb;
	
	
	if (type == 1) {
		eb = new EnemyBullet1(player, pos, number);
		mEnemyBullets.push_back(eb);
	} else if (type == 2) {
		eb = new EnemyBullet2(player, pos, number);
		mEnemyBullets.push_back(eb);
	} else if (type == 3) {
		eb = new EnemyBullet3(player, pos, number);
		mEnemyBullets.push_back(eb);
	} else if (type == 4) {
		eb = new EnemyBullet4(player, pos, number);
		mEnemyBullets.push_back(eb);
	} else if (type == 5) {
		eb = new EnemyBullet5(player, pos, number);
		mEnemyBullets.push_back(eb);
	} else if (type == 6) {
		eb = new EnemyBullet6(player, pos, number);
		mEnemyBullets.push_back(eb);
	} else if (type == 7) {
		eb = new EnemyBullet7(player, pos, number);
		mEnemyBullets.push_back(eb);
	} else if (type == 8) {
		eb = new EnemyBullet8(player, pos, number);
		mEnemyBullets.push_back(eb);
	}else {
		throw GMException("Invalid enemy type: %d", type);
	}
	
	
}
Exemplo n.º 2
0
Enemy* EnemyGenerator::createEnemy(EnemyAppearance* info, int number)
{
    GMVector2D pos(info->x, info->y);
    
	if (info->type == 1000){
		gGameInst->mGlobal->setBossFlag(1);
	}
	
    /* 学生の方へ:敵のクラスを追加するたびに、敵のインスタンスを new するコードを書いてください。 */
    if (info->type == 0) {
        return new Enemy0(pos, info->life, number , info->deadScore , info->itemType );
	} else if (info->type == 1) {
        return new Enemy1(pos, info->life, number , info->deadScore , info->itemType );
    } else if (info->type == 2) {
        return new Enemy2(pos, info->life, number , info->deadScore , info->itemType );
    }else if (info->type == 3) {
        return new Enemy3(pos, info->life, number , info->deadScore , info->itemType );
    }else if (info->type == 4) {
        return new Enemy4(pos, info->life, number , info->deadScore , info->itemType );
    }else if (info->type == 5) {
        return new Enemy5(pos, info->life, number , info->deadScore , info->itemType );
    }else if (info->type == 6) {
        return new Enemy6(pos, info->life, number , info->deadScore , info->itemType );
    }else if (info->type == 7) {
        return new Enemy7(pos, info->life, number , info->deadScore , info->itemType );
    }else if (info->type == 8) {
        return new Enemy8(pos, info->life, number , info->deadScore , info->itemType );
    }else if (info->type == 9) {
        return new Enemy9(pos, info->life, number , info->deadScore , info->itemType );
    }else if (info->type == 1000) {
        return new Enemy1000(pos, info->life, number , info->deadScore , info->itemType );
    }else {
        throw GMException("Invalid enemy type: %d (frame=%d)", info->type, info->frame);
    }
}
Exemplo n.º 3
0
 void Carsor::draw(GMSpriteBatch* s){
     if(!m_UnderElement){
         if(m_Window->getElements().empty()) GMException("はれはれはー");
         m_UnderElement = m_Window->getElements()[0];
     }
     s->draw(0, m_UnderElement->getRect(), m_Color);
 }
Exemplo n.º 4
0
 Element* Carsor::update(GMInput* input, double deltaTime){
     if(!m_UnderElement){
         GMException("うにゃにゃー");
     }
     if(input->isKeyDownTriggered(GMKeyMaskZ | GMKeyMaskReturn)){
         // 決定キーが押された。
         // 現在選択エレメントを返す。
         gGameInst->getSoundMan()->get(SoundName_Return)->play();
         return m_UnderElement;
     }
     if(input->isKeyDownTriggered(GMKeyMaskLeft | GMKeyMaskUp)){
         m_UnderElement->setCarsor(0);
         if(m_UnderElement->getPrev()){
             m_UnderElement = m_UnderElement->getPrev();
         }else{
             m_UnderElement = m_Window->getElements()[m_Window->getElements().size()-1];
         }
         m_UnderElement->setCarsor(this);
         if(dynamic_cast<SKTitle*>(gGameInst->GetCurrentScene())){
             gGameInst->getSoundMan()->get(SoundName_Carsor)->play();
         }else if(dynamic_cast<SKPlayScene*>(gGameInst->GetCurrentScene())){
         }
     }else if(input->isKeyDownTriggered(GMKeyMaskRight | GMKeyMaskDown)){
         m_UnderElement->setCarsor(0);
         if(m_UnderElement->getNext()){
             m_UnderElement = m_UnderElement->getNext();
         }else{
             m_UnderElement = m_Window->getElements()[0];
         }
         m_UnderElement->setCarsor(this);
         if(dynamic_cast<SKTitle*>(gGameInst->GetCurrentScene())){
             gGameInst->getSoundMan()->get(SoundName_Carsor)->play();
         }else if(dynamic_cast<SKPlayScene*>(gGameInst->GetCurrentScene())){
         }
     }
     return 0;
 }
Exemplo n.º 5
0
void EnemyGenerator::loadEnemyAppearances(int stage)
{
	
    if (stage == 1) {
		
		/*addEnemyAppearance(t ,type ,item,   X,	  Y,   体力, n,score ) */
		
		//マグロ
		addEnemyAppearance(5*60,	4, 	2,	  60,	480,	10, 8,	-1);
		addEnemyAppearance(10*60,	4, 	2,340-58,	480,	10, 8,	-1);
		addEnemyAppearance(17*60,	5, 	2,	  60,	480,	10, 8,	-1);
		addEnemyAppearance(22*60,	5, 	2,340-58,	480,	10, 8,	-1);
		
		//プリン
		addEnemyAppearance(30*60,	2, 	2,	286,	480,    60, 1,	20000);
		addEnemyAppearance(30*60,	2, 	2,	 60,	480,    60, 1,	20000);
		addEnemyAppearance(36*60,	2, 	2,	286,	480,    60, 1,	20000);
		addEnemyAppearance(36*60,	2, 	2,	 60,	480,    60, 1,	20000);
		
		//お茶
		addEnemyAppearance(42*60,	0, 	2,	  0,	480,	10, 8,	-1);
		addEnemyAppearance(48*60,	0, 	2,	400,	480,	10, 8,	-1);
		
		//卵
		addEnemyAppearance(54*60,	6, 	1,	400,	400,	2, 8,	-1);
		addEnemyAppearance(54*60,	6, 	2,	-58,	400,	2, 8,	-1);
		
		//数の子
		addEnemyAppearance(58*60,	7, 	1,	400,	400,	2, 8,	-1);
		addEnemyAppearance(58*60,	7, 	2,	-58,	400,	2, 8,	-1);
		
		
		//卵
		addEnemyAppearance(62*60,	6, 	1,	400,	400,	2, 8,	-1);
		addEnemyAppearance(62*60,	6, 	2,	-58,	400,	2, 8,	-1);
		addEnemyAppearance(62*60,	6, 	1,	400,	250,	2, 8,	-1);
		addEnemyAppearance(62*60,	6, 	2,	-58,	250,	2, 8,	-1);
		
		//数の子&卵
		addEnemyAppearance(66*60,	6, 	1,	400,	400,	2, 4,	-1);
		addEnemyAppearance(66*60,	6, 	2,	-58,	400,	2, 4,	-1);
		addEnemyAppearance(66*60,	7, 	1,	510,	400,	2, 4,	-1);
		addEnemyAppearance(66*60,	7, 	2, -168,	400,	2, 4,	-1);
		addEnemyAppearance(66*60,	6, 	1,	400,	250,	2, 4,	-1);
		addEnemyAppearance(66*60,	6, 	2,	-58,	250,	2, 4,	-1);
		addEnemyAppearance(66*60,	7, 	1,	510,	250,	2, 4,	-1);
		addEnemyAppearance(66*60,	7, 	2, -168,	250,	2, 4,	-1);
		
		//わさび&ほたて
		addEnemyAppearance(67*60,	8, 	2,  -37,	520,   10, 1,	-1);
		
		addEnemyAppearance(68*60,	9, 	2,   75,	480,   50, 3,	-1);
		addEnemyAppearance(68*60,	8, 	2,400-60,	520,   10, 1,	-1);
		
		addEnemyAppearance(69*60,	9, 	2,   75,	480,   50, 3,	-1);
		addEnemyAppearance(69*60,	8, 	2,  -37,	520,   10, 1,	-1);
		
		//ボス(板前)
		addEnemyAppearance(79*60,1000,	1,	140,	480,12000,	1,	120000);
		
		/*
		addEnemyAppearance(4*60,	0, 	2,	  0,	480,	10, 8,	-1);
		
		addEnemyAppearance(11*60,	2, 	2,	286,	480,    80, 1,	20000);
		addEnemyAppearance(11*60,	2, 	2,	 60,	480,    80, 1,	20000);
		addEnemyAppearance(11*60,	1, 	1,	  5,	480,	10, 5,	-1);
		
		addEnemyAppearance(18*60,	2, 	2,	286,	480,    80, 1,	20000);
		addEnemyAppearance(18*60,	2, 	2,	 60,	480,    80, 1,	20000);
		addEnemyAppearance(18*60,	1, 	2,	363,	480,	10, 5,	-1);

		addEnemyAppearance(25*60,	3, 	2,	  0,	480,	10, 8,	-1);
		addEnemyAppearance(32*60,	3, 	2,	400,	480,	10, 8,	-1);
		
		addEnemyAppearance(40*60,1000,	1,	140,	480,  2000,	1,	120000);
		 */
    }
    
    mFrameCount = 0;
    if (mAppearances.empty()) {
        throw GMException("No Enemy Data has been loaded for stage %d", stage);
    }

    mCurrentPos = 0;
    mNextAppearance = mAppearances[mCurrentPos++];
}