Beispiel #1
0
//--------------------------------------------------------------
void ofApp::update(){

	if(game_state=="start"){//スタート画面の更新描画

	}else if(game_state=="tutorial"){

	}else if(game_state=="game"){//ゲーム画面の更新描画
		player_1.update();
		update_bullets();
		update_bonuses();
        boss_1.update();

		//ボスの動き、弾バリエーション
		if(boss_1.lives>0){
			if(boss_1.shot()){
			if(boss_1.lives>=50){
		
			Bullet b;
			b.setup(false,boss_1.pos,boss_1.bullet_speed,&boss_bullet_image);
			bullets.push_back(b);
		        }
		if(boss_1.lives<50){
			Bullet b;
			b.setup(false,boss_1.pos,boss_1.bullet_speed,&boss_bullet_image2);
			bullets.push_back(b);
		}
			}

		//敵出現
		for(int i=0;i<enemies.size();i++){
			enemies[i].update();

			if(enemies[i].time_to_shoot()){
			Bullet b;//time_to_shot関数にて一瞬だけtrueにしている
			b.setup(false,enemies[i].pos,enemies[i].speed,&enemy_bullet_image);
			bullets.push_back(b);
            }
      }
		for(int i=enemies.size()-1;i>0;i--){
			//画面外に出たら消す
		    if(enemies[i].pos.y+enemies[i].width/2>ofGetHeight()){
			enemies.erase(enemies.begin()+i);
		  }
		}
		if(level_controller.should_spawn()==true){
			Enemy e;
			e.setup(max_enemy_amplitude,max_enemy_shoot_interval,&enemy_image);
			enemies.push_back(e);
		}
		if(level_controller.Item_spawn()==true){
			Life l;
			l.setup(&life_image);
			bonuses.push_back(l);
		}
		}
		else{
			for(int i=0;i<enemies.size();i++){
				enemies[i].end();
				if(boss_1.pos.y<0){
					game_state="end";
					mainSound.stop();
					endingSong.loadSound("end.mp3");
					endingSong.play();
				}
			}
		}
	}else if(game_state=="end"){
	}
}
Beispiel #2
0
/*
 * Handle "p_ptr->update"
 */
void update_stuff(void)
{
	/* Update stuff */
	if (!p_ptr->update) return;


	if (p_ptr->update & (PU_BONUS))
	{
		p_ptr->update &= ~(PU_BONUS);
		update_bonuses();
	}

	if (p_ptr->update & (PU_TORCH))
	{
		p_ptr->update &= ~(PU_TORCH);
		calc_torch();
	}

	if (p_ptr->update & (PU_HP))
	{
		p_ptr->update &= ~(PU_HP);
		calc_hitpoints();
	}

	if (p_ptr->update & (PU_MANA))
	{
		p_ptr->update &= ~(PU_MANA);
		calc_mana();
	}

	if (p_ptr->update & (PU_SPELLS))
	{
		p_ptr->update &= ~(PU_SPELLS);
		calc_spells();
	}


	/* Character is not ready yet, no screen updates */
	if (!character_generated) return;


	/* Character is in "icky" mode, no screen updates */
	if (character_icky) return;


	if (p_ptr->update & (PU_FORGET_VIEW))
	{
		p_ptr->update &= ~(PU_FORGET_VIEW);
		forget_view();
	}

	if (p_ptr->update & (PU_UPDATE_VIEW))
	{
		p_ptr->update &= ~(PU_UPDATE_VIEW);
		update_view();
	}


	if (p_ptr->update & (PU_FORGET_FLOW))
	{
		p_ptr->update &= ~(PU_FORGET_FLOW);
		forget_flow();
	}

	if (p_ptr->update & (PU_UPDATE_FLOW))
	{
		p_ptr->update &= ~(PU_UPDATE_FLOW);
		update_flow();
	}


	if (p_ptr->update & (PU_DISTANCE))
	{
		p_ptr->update &= ~(PU_DISTANCE);
		p_ptr->update &= ~(PU_MONSTERS);
		update_monsters(TRUE);
	}

	if (p_ptr->update & (PU_MONSTERS))
	{
		p_ptr->update &= ~(PU_MONSTERS);
		update_monsters(FALSE);
	}


	if (p_ptr->update & (PU_PANEL))
	{
		p_ptr->update &= ~(PU_PANEL);
		event_signal(EVENT_PLAYERMOVED);
	}
}