Пример #1
0
void Player::Rensha_Update()
{
	// 連射ゲージ加算-----------------------------------------------------
	if(Keyboard_Get(KEY_INPUT_Z) == 1 || Keyboard_Get(KEY_INPUT_A) == 1){
		if(s_rensha < 41)	s_rensha++;
	}

	// -------------------------------------------------------------------
	switch (s_powlv)
	{
	case 0:	s_rensha = 0;	break;
	case 1:	if (Stage::GetTime() % 17 == 0)	s_rensha--;	break;
	case 2:	if (Stage::GetTime() % 12 == 0)	s_rensha--;	break;
	case 3: if (Stage::GetTime() % 11 == 0)	s_rensha--;	break;
	case 4: if (Stage::GetTime() % 10 == 0)	s_rensha--;	break;

	default: assert(!"不正な状態"); break;
	}

	// -------------------------------------------------------------------
	switch (s_rensha)
	{
	case 0:		
		if(s_powlv != 0) Shift(false);
		break;
	case 40:	if (s_powlv != 4)	Shift(true);
		break;
	}
}
Пример #2
0
void Op::Update(){
	if(Keyboard_Get(KEY_INPUT_DOWN) == 1 && keyy != 410){
		keyy = 410; 
	}
	if(Keyboard_Get(KEY_INPUT_UP) == 1 && keyy != 375){
		keyy = 375; 
	}
	if(Keyboard_Get(KEY_INPUT_SPACE) == 1 && keyy == 375){
		mSceneChanger->ChangeScene(eScene_Game);//シーンをメニューに変更
	}	
}
Пример #3
0
void Player::InputMng()
{
	const bool KEY_STAY_RIGHT = ( Keyboard_Get(KEY_INPUT_RIGHT) >= 30 );
	const bool KEY_STAY_LEFT  = ( Keyboard_Get(KEY_INPUT_LEFT) >= 30 );
	const bool PUSH_Z_KEY     = ( Keyboard_Get(KEY_INPUT_Z) == 1 );

	keydir = InputDir::Neutral;						// キーをニュートラルにする
	
	if (KEY_STAY_RIGHT)	keydir = InputDir::Right;

	if (KEY_STAY_LEFT)	keydir = InputDir::Left;

	if (PUSH_Z_KEY && s_powlv == 0)	Shift(true);	// 無の状態で押すと無条件で1段階アップ
}
Пример #4
0
void Player::Move()
{
	const bool INPUT_HORIZONTAL  = Keyboard_Get(KEY_INPUT_RIGHT) >= 1 || Keyboard_Get(KEY_INPUT_LEFT) >= 1;
	const bool INPUT_VERTICAL    = Keyboard_Get(KEY_INPUT_UP)    >= 1 || Keyboard_Get(KEY_INPUT_DOWN) >= 1;
	const bool KEY_STAY_RIGHT    = Keyboard_Get(KEY_INPUT_RIGHT) >= 1;
	const bool KEY_STAY_LEFT     = Keyboard_Get(KEY_INPUT_LEFT)  >= 1;
	const bool KEY_STAY_UP       = Keyboard_Get(KEY_INPUT_UP)    >= 1;
	const bool KEY_STAY_DOWN     = Keyboard_Get(KEY_INPUT_DOWN)  >= 1;
	double speed;


	// スピード設定
	if(INPUT_HORIZONTAL)
	{
		if (INPUT_VERTICAL)	speed = (1 / 1.41421356) * SpeedForce;	// (1 / √2) * speed    // 斜めのとき
		else				speed = SpeedForce;						// 斜め補正解除
	}
	else if(INPUT_VERTICAL)	speed = SpeedForce;						// 上下のみの移動

	// 移動させる
	if (KEY_STAY_RIGHT)	pos.x += speed;
	if (KEY_STAY_LEFT)	pos.x -= speed;
	if (KEY_STAY_UP)	pos.y -= speed;
	if (KEY_STAY_DOWN)	pos.y += speed;

	// 移動可能範囲を設定
	Vector2D::BorderStop(&pos.x, LimitScreenXL, LimitScreenXR);
	Vector2D::BorderStop(&pos.y, LimitScreenYT, LimitScreenYB);
}
Пример #5
0
void Enemy::Update()
{
	// 登場時間が来たら出てくる
	if (Stage::GetTime() == in_time)
	{
		isExist = true;
	}

	if (isExist)
	{
		// 時間を経過させる
		elapsedTime++;

		s_time++;

		isDamage = false;

		// 攻撃されたら起こる
		if (Keyboard_Get(KEY_INPUT_Z) == 1)	isUngry = true;

		Move();
	}

	shot->Update(pos.x, pos.y);
	
	if (shot2 != nullptr)	shot2->Update(pos.x, pos.y);
	
	if (shot3 != nullptr)	shot3->Update(pos.x, pos.y);

	if (!isExist)	return;
	
	Fire();
}
Пример #6
0
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){
	ChangeWindowMode(TRUE), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK ); //ウィンドウモード変更と初期化と裏画面設定
	SetGraphMode(512,512,16) ;//ディスプレイの大きさの設定

	SceneMgr sceneMgr;
    sceneMgr.Initialize();


	while( ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && gpUpdateKey()==0 ){
        sceneMgr.Update();  //更新
        sceneMgr.Draw();    //描画
		fps();
		if(Keyboard_Get(KEY_INPUT_F1) == 1){
			debbattle = !debbattle;
		}
		if(debbattle){
		    DrawFormatString(0, 10,GetColor(255,255,255),"battle:true");
		}
		fpsc++;
	}

	sceneMgr.Finalize();
	DxLib_End();	// DXライブラリ終了処理
	return 0;
}
Пример #7
0
//更新
void SceneMng::Update()
{			
	DebugMode::Update();

	if (mNextScene != eScene_None)								// 次のシーンがセットされていたら
	{    
		delete mScene;											// 現在のシーンの終了処理を実行
		switch (mNextScene)										// シーンによって処理を分岐
		{
		case eScene_Menu:										// 次の画面がメニューなら
			mScene = static_cast<BaseScene*> (new Menu(this));	// メニュー画面のインスタンスを生成する
			break;												// 以下略
		case eScene_Game:
			mScene = static_cast<BaseScene*> (new Game(this));
			break;
		case eScene_Config:
			mScene = static_cast<BaseScene*> (new Config(this));
			break;
		case eScene_Another:
			mScene = static_cast<BaseScene*> (new Another(this));
			break;
		case eScene_GameOver:
			mScene = static_cast<BaseScene*> (new GameOver(this));
			break;
		}
		mNextScene = eScene_None;								// 次のシーン情報をクリア
	}
	mScene->Update();											// シーンの更新

	// DEBUG ONLY
	if (Keyboard_Get(KEY_INPUT_F1) == 1)	DebugMode::SwitchTest();
}
Пример #8
0
void Rpg::Update() {
	if (Keyboard_Get(VK_ESCAPE) != 0) { //Escキーが押されていたら
		mSceneChanger->ChangeScene(eScene_Menu);//シーンをメニューに変更
	}
	if (mNextScene != eGameScene_None) {    //次のシーンがセットされていたら
		mGameScene->Finalize();//現在のシーンの終了処理を実行
		switch (mNextScene) {       //シーンによって処理を分岐
		case eGameScene_Text:    //現在の画面がメニューなら
			if (RpgKillFrag) {
				nextenemy++;
				RpgKillFrag = false;
			}
			mGameScene = (gameBaseScene*) new Text(this,1, nextenemy);
			break;//以下略
		case eGameScene_Main:
			
			if (nextenemy == 3) {
				mSceneChanger->ChangeScene(eScene_Menu);
			}
			else {
				mGameScene = (gameBaseScene*) new rpggame::RpgGame(this,nextenemy);
			}
			break;//以下略
		}
		mNextScene = eGameScene_None;    //次のシーン情報をクリア
		mGameScene->Initialize();    //シーンを初期化
	}
	mGameScene->Update(); //シーンの更新
}
Пример #9
0
void Pshot::Input()
{
	const bool PUSH_Z_KEY	= ( Keyboard_Get(KEY_INPUT_Z) == 1 );
	const bool isREADY_NEXT = ( isShotNext && !isShot );				// 次の発射が待っているか?
	const bool isON_NEXT	= ( PUSH_Z_KEY && isShot && !isShotNext );	// 発射中に発射ボタンを押したか?
	const bool isSHOT		= ( PUSH_Z_KEY && !isShot );				// 発射したか?

	if (isREADY_NEXT)
	{
		isShot		= true;				// 発射準備
		isShotNext	= false;			// 次の発射準備をおろす
	}
	if (isON_NEXT)	isShotNext	= true;
	if (isSHOT)		isShot		= true;
	if (isShot)		Fire();				// 発射処理
	if (Keyboard_Get(KEY_INPUT_X) == 1)	bomb->Fire(shiftLevel);
}
Пример #10
0
//更新
void Game::Update(){
	extern bool move,change;		
	//更新
	if(!battlemode && !dead){
		if(Keyboard_Get(KEY_INPUT_ESCAPE) == 1){
			playerpoint[0] = players[nowplayer].getPlayerx();
			playerpoint[1] = players[nowplayer].getPlayery();
			playerpoint[2] = players[nowplayer].getplayervec();
			do{
				nowplayer++;
				if(nowplayer == 4){
					nowplayer = 0;
					break;
				}
			}while(!players[nowplayer].getMate());
			change = true;
			players[nowplayer].Update(playerpoint);
		}
		menu.Update(stageMgr.getWords(players[nowplayer].getPlayerx(),players[nowplayer].getPlayery(),players[nowplayer].getplayervec()),count,players[nowplayer].getability(),players,playercount,stageMgr.getNowStage(),nowplayer);
		players[nowplayer].UpDateMove(stageMgr.Fieldmovex(),stageMgr.Fieldmovey());
		players[nowplayer].UpDateSrc(Keyboard_Get(KEY_INPUT_UP),Keyboard_Get(KEY_INPUT_DOWN),Keyboard_Get(KEY_INPUT_RIGHT),Keyboard_Get(KEY_INPUT_LEFT),menu.getMenu());
		battlemode = stageMgr.GoBattle(players[nowplayer].getPlayerx(),players[nowplayer].getPlayery());
		stageMgr.Update(players[nowplayer],menu.getMenu(),menu.gettalk(),false);
		players[nowplayer].Update(stageMgr.PlayerPointDef());
		count++;
		if(count ==60){
			count = 0;
		}
	}
	else if(!dead){
		battle.Update(players,stageMgr.getNowStage(),count,playercount);
		if(battle.EndBattle()){
			battlemode = false;
			if(battle.getTele()){
				stageMgr.Update(players[nowplayer],menu.getMenu(),menu.gettalk(),battle.getTele());
			}
		}
		if(battle.getDead()){
			dead = true;
		}
	}
	else if(Keyboard_Get(KEY_INPUT_SPACE) == 1){
		mSceneChanger->ChangeScene(eScene_Op);//死んだらOpに戻る
		dead = false;
	}
}
Пример #11
0
void Menu::AnotherUpdate() 
{
	const bool KEY_PUSH_RIGHT	= ( Keyboard_Get(KEY_INPUT_RIGHT) == 1 );
	const bool KEY_PUSH_UP		= ( Keyboard_Get(KEY_INPUT_UP)    == 1 );
	const bool KEY_PUSH_DOWN	= ( Keyboard_Get(KEY_INPUT_DOWN)  == 1 );
	const bool KEY_PUSH_LEFT	= ( Keyboard_Get(KEY_INPUT_LEFT)  == 1 );


	if (KEY_PUSH_RIGHT && ano_tri < 4)						ano_tri++;
	if (KEY_PUSH_UP    && ano_tri < 8  && ano_tri >= 4)		ano_tri++;
	if (KEY_PUSH_DOWN  && ano_tri < 12 && ano_tri >= 8)		ano_tri++;
	if (KEY_PUSH_LEFT  && ano_tri < 16 && ano_tri >= 12)	ano_tri++;

	if(ano_tri == 16){
		mSceneChanger->ChangeScene(eScene_Another);
	}
}
Пример #12
0
void Game::Update()
{
	//mino->Update();

	field->Update(tetrimino);

	if (Keyboard_Get(KEY_INPUT_Z) == 1) mSceneChanger->ChangeScene(eScene_Menu);
}
Пример #13
0
void Stage::Update()
{
	// 時間経過
	s_time++;
	if (s_time % 120 == 0)	s_rank++;
	SetVolumeSoundMem(255, hs_bgm);

	Move();

	if (Keyboard_Get(KEY_INPUT_6) == 1)	ChangeVolumeSoundMem(0, hs_bgm);

	// TEST-----------------------------------------------------------------
	if (DebugMode::isTest == false)	return;

	/// 時がくるまで封印
//	if (effect->getIsAnime() && !f_quake)	f_quake = true;
	if (Keyboard_Get(KEY_INPUT_W) >= 1) cycle += 0.1;
	if (Keyboard_Get(KEY_INPUT_S) >= 1) cycle -= 0.1;
	if (Keyboard_Get(KEY_INPUT_D) >= 1) shake += 0.1;
	if (Keyboard_Get(KEY_INPUT_A) >= 1) shake -= 0.1;
}
Пример #14
0
void GameOver::Update()
{
	time++;

	if (time < 121)
		time_in += 255 / 120;

	if (time < 121 + FEED_STAYTIME)	return;

	time_in -= 255 / 120;
	
	if (time_in == 0)	mSceneChanger->ChangeScene(eScene_Menu);
	
	if (Keyboard_Get(KEY_INPUT_Z) == 1)	mSceneChanger->ChangeScene(eScene_Menu);
}
Пример #15
0
void Score::Update()
{
	if(Keyboard_Get(KEY_INPUT_Y) == 1)	clsDx();
	if (val_score != score)				val_score = score;
	if (val_hiscore != hi_score)		val_hiscore = hi_score;
	if (score > hi_score)				hi_score = score;

	// TEST
	if (!DebugMode::isTest)	return;
	/*
	if (Keyboard_Get(KEY_INPUT_1) == 1)	AddScore(123); // test
	if (Keyboard_Get(KEY_INPUT_2) == 1)	DeleteScore(); // test
	*/

//	ShowResult();
}
Пример #16
0
void Menu::Update()
{
	title->Update();													// タイトルロゴ
	if (!title->isStop)	return;											// 止まっていなければここはスルー

	const bool INPUT_VERTICAL = ( Keyboard_Get(KEY_INPUT_DOWN) == 1 || Keyboard_Get(KEY_INPUT_UP)     == 1 );
	const bool INPUT_OK       = ( Keyboard_Get(KEY_INPUT_Z)    == 1 || Keyboard_Get(KEY_INPUT_RETURN) == 1 );
	const bool PUSH_KEY_UP    = ( Keyboard_Get(KEY_INPUT_UP)   == 1 );
	const bool PUSH_KEY_DOWN  = ( Keyboard_Get(KEY_INPUT_DOWN) == 1 );
	const bool STATE_START    = selectNum == 0;
	const bool STATE_QUIT     = selectNum == 3;

	y_cur = y[selectNum] - 2;											// カーソルの位置
	if (INPUT_VERTICAL)	PlaySoundMem(hs_move, DX_PLAYTYPE_BACK);		// ♪カーソル音
	if (PUSH_KEY_UP)	selectNum = (selectNum + 3) % ALL_SELECT_NUM;	// カーソルの移動と選択項目
	if (PUSH_KEY_DOWN)	selectNum = (selectNum + 1) % ALL_SELECT_NUM;

	if(INPUT_OK)														// 決定キーを押したなら
	{
		if (STATE_START)
		{
			PlaySoundMem(hs_choice, DX_PLAYTYPE_BACK);				// ♪決定音
			isGame = true;
		}
		if (STATE_QUIT)		QuitGame();									// ゲームをやめる
	}

	if(isGame)
	{
		c_game->Update();

		if (c_game->isLast())	mSceneChanger->ChangeScene(eScene_Game);
	}

	score->Update();													// スコアデータ更新

	AnotherUpdate();													// It's a secret.
}
Пример #17
0
void Clear_Update()
{
	if (Keyboard_Get(KEY_INPUT_RIGHT) == 1 || GamePad_Get(PAD_INPUT_RIGHT)==1)
	{
		SelectCnt = (SelectCnt + 1) % 3;
	}
	if (Keyboard_Get(KEY_INPUT_LEFT) == 1 || GamePad_Get(PAD_INPUT_LEFT)==1)
	{
		SelectCnt = (SelectCnt + 2) % 3;
	}
	if (Keyboard_Get(KEY_INPUT_RIGHT) == 1 || GamePad_Get(PAD_INPUT_RIGHT) == 1 || Keyboard_Get(KEY_INPUT_LEFT) == 1 || GamePad_Get(PAD_INPUT_LEFT)==1)
	{
		for (int i = 0; i < 3; i++)
		{
			if (i == SelectCnt)
			{
				Menu_clear[i].image = GraphicHandle[6];
				PlaySoundMem(SoundHandle[1], DX_PLAYTYPE_BACK, true);
			}
			else
			{
				Menu_clear[i].image = GraphicHandle[7];
				PlaySoundMem(SoundHandle[1], DX_PLAYTYPE_BACK, true);
			}
		}
	}
	if (Keyboard_Get(KEY_INPUT_Z) == 1 && SelectCnt == 0 || GamePad_Get(PAD_INPUT_1)==1&&SelectCnt==0)	//りとらいが押されたらゲームシーンに移る
	{
		StopSoundMem(SoundHandle[4]);
		PlaySoundMem(SoundHandle[2], DX_PLAYTYPE_BACK, true);
		PlaySoundMem(SoundHandle[0], DX_PLAYTYPE_LOOP, true);
		ChangeScene(gamepre);
	}
	if (Keyboard_Get(KEY_INPUT_Z) == 1 && SelectCnt == 1 || GamePad_Get(PAD_INPUT_1)==1&&SelectCnt==1)	//たいとるが押されたらタイトルシーンに移る
	{
		StopSoundMem(SoundHandle[4]);
		PlaySoundMem(SoundHandle[2], DX_PLAYTYPE_BACK, true);
		PlaySoundMem(SoundHandle[0], DX_PLAYTYPE_LOOP, true);
		Title_Initialize();			//タイトルの初期化処理もする
		ChangeScene(title);
	}
	if (Keyboard_Get(KEY_INPUT_Z) == 1 && SelectCnt == 2||GamePad_Get(PAD_INPUT_1)==1&&SelectCnt==2)	//おわるが押されたら終了する
	{
		StopSoundMem(SoundHandle[4]);
		PlaySoundMem(SoundHandle[2], DX_PLAYTYPE_NORMAL, true);
			GameContinueFlag = false;	//ゲームの終了処理もする
	}
	if (Keyboard_Get(KEY_INPUT_X) == 1 || GamePad_Get(PAD_INPUT_2)==1)	//xキーが押されたらおわるに移動する
	{
		SelectCnt = 2;
		for (int i = 0; i < 3; i++)
		{
			if (i == SelectCnt)
			{
				Menu_clear[i].image = GraphicHandle[6];
				PlaySoundMem(SoundHandle[1], DX_PLAYTYPE_BACK, true);
			}
			else
			{
				Menu_clear[i].image = GraphicHandle[7];
				PlaySoundMem(SoundHandle[1], DX_PLAYTYPE_BACK, true);
			}
		}
	}
}