コード例 #1
0
ファイル: Bullet.cpp プロジェクト: c-plus-c/3DShootingOne
void Bullet::Draw()
{
	SetUseLighting(FALSE);
	//SetUseLighting(TRUE);

	switch (_bulletType)
	{
	case BULLET_TYPE_ENEMY:
		MV1SetScale(ResourceHandles::getResourceHandles().EnemyBulletHandle, VGet(_size, _size, _size));
		MV1SetPosition(ResourceHandles::getResourceHandles().EnemyBulletHandle, _translation);
		MV1DrawModel(ResourceHandles::getResourceHandles().EnemyBulletHandle);
		break;
	case BULLET_TYPE_PLAYER:
		MV1SetScale(ResourceHandles::getResourceHandles().PlayerBulletHandle, VGet(_size, _size, _size));
		MV1SetPosition(ResourceHandles::getResourceHandles().PlayerBulletHandle, _translation);
		MV1DrawModel(ResourceHandles::getResourceHandles().PlayerBulletHandle);
		break;
	case BULLET_TYPE_PLAYER_HORMING:
		MV1SetScale(ResourceHandles::getResourceHandles().HormingBulletHandle, VGet(_size, _size, _size));
		MV1SetPosition(ResourceHandles::getResourceHandles().HormingBulletHandle, _translation);
		MV1DrawModel(ResourceHandles::getResourceHandles().HormingBulletHandle);
		break;
	default:
		break;
	}
}
コード例 #2
0
ファイル: Enemy.cpp プロジェクト: Xivil/zemigame
Enemy::Enemy(float x, float y, float z, int life, int timer){
	this->x = x;
	this->y = y;
	this->z = z;
	this->life = life;
	this->timer = timer;
	graph = MV1LoadModel("R-13A.pmd");
	MV1SetScale( graph, VGet(0.025f, 0.025f, 0.025f));
	ShotSpeed = 1.5f;
}
コード例 #3
0
ファイル: Character.cpp プロジェクト: Xivil/zemigame
void Character::Init(float a, float b, float c, float X, float Y, float Z, int graph){
	x = a;
	y = b;
	z = c;
	RotateX = X;
	RotateY = Y;
	RotateZ = Z;
	RotateZ2 = 0;
	life = 10;
	power = 0;
	this->graph = graph;
	DeathTimer = 180;
	targetwindow = MV1LoadModel("target.mqo");
	MV1SetScale(targetwindow, VGet(0.025f, 0.025f, 0.025f));
	MV1SetScale(graph, VGet(0.06f, 0.06f, 0.06f));
	for(int i = 0; i < SNUM; i++){
		shot[i].flag = 0;
		shot[i].graph = MV1LoadModel("shotp.pmx");
		shot[i].attach = MV1AttachAnim( shot[i].graph, 0, -1, FALSE ) ;
		shot[i].shottime = MV1GetAttachAnimTotalTime( shot[i].graph, shot[i].attach );
		shot[i].playtime = 0;
		MV1SetScale(shot[i].graph, VGet(0.3f, 0.3f, 0.8f));
	}
	
	//ブーストの初期化
	boost.graph = MV1LoadModel("boost.pmd");
	boost.attach = MV1AttachAnim(boost.graph, 1, -1, FALSE ) ;
	boost.totaltime= MV1GetAttachAnimTotalTime( boost.graph, boost.attach ) ;
	boost.playtime = 0;
	MV1SetScale(boost.graph, VGet(0.11f, 0.11f, 0.11f));
	
	boost2.graph = MV1LoadModel("boost.pmd");
	boost2.attach = MV1AttachAnim(boost2.graph, 2, -1, FALSE ) ;
	boost2.totaltime= MV1GetAttachAnimTotalTime( boost2.graph, boost2.attach ) ;
	boost2.playtime = 0;
	MV1SetScale(boost2.graph, VGet(0.11f, 0.11f, 0.11f));

	shotsound = LoadSoundMem( "sound/shoot1.mp3" );
	 ChangeVolumeSoundMem( 100, shotsound ) ;

}
コード例 #4
0
ファイル: Character.cpp プロジェクト: Xivil/zemigame
Character::Character(float a, float b, float c, float X, float Y, float Z, int graph){
	x = a;
	y = b;
	z = c;
	RotateX = X;
	RotateY = Y;
	RotateZ = Z;
	life = 10;
	this->graph = graph;
	targetwindow = MV1LoadModel("target.mqo");
	MV1SetScale(targetwindow, VGet(0.025f, 0.025f, 0.025f));
	MV1SetScale(graph, VGet(0.015f, 0.015f, 0.015f));
	for(int i = 0; i < SNUM; i++){
		shot[i].flag = 0;
		shot[i].graph = MV1LoadModel("aaaa.mqo");
	}
	damage_sound = LoadSoundMem("sound/nc84550.mp3");
	ChangeVolumeSoundMem(100, damage_sound);
	damaged_timer = 0;
	damaged_flag = false;
}
コード例 #5
0
ファイル: Enemy.cpp プロジェクト: Xivil/zemigame
void Enemy::Death(){
	float x = 0.3f, y = 0.3f, z =0.3f;
	if(life <= 0 ){
		DeathTimer --;
		RotateY --;
		RotateX --;
		MV1SetScale(graph, VGet( x, y , z));
	}
	if( life == 0){
		graph = MV1LoadModel("爆発消x1.pmd");
		life --;
	}
}
コード例 #6
0
ファイル: Character.cpp プロジェクト: Xivil/zemigame
void Character::Death(){
	if(KeyGet(KEY_INPUT_L)) life = 0;
	float x = 0.3f, y = 0.3f, z =0.3f;
	if(life <= 0 ){
		DeathTimer --;
		RotateY --;
		RotateX --;
		MV1SetScale(graph, VGet( x, y , z));
		if(DeathTimer == 0) gamestate = 2;
	}
	if( life == 0){
		graph = MV1LoadModel("Graph/消せる爆発/爆発消x1.pmd");
		life --;
	}
}
コード例 #7
0
ファイル: Enemy.cpp プロジェクト: Xivil/zemigame
void Boss::HitAnim(){
	for (int i = 0; i < 16; i++){
		if (HitEffectFlag[i] == 1){
			MV1DrawModel(HitEffectGraph[i]);
			MV1SetPosition(HitEffectGraph[i], HitEffectPosition[i]);
			MV1SetScale(HitEffectGraph[i], VGet(3, 3, 3));
			HitEffect[i].AnimTime++;
			if (HitEffect[i].AnimTime >= HitEffect[i].TotalTime){
				HitEffectFlag[i] = 0;
				HitEffect[i].AnimTime = 0.0f;
			}
			
		}
	}
}
コード例 #8
0
ファイル: managiment.cpp プロジェクト: cam-xetal/c_zemi
void MANAGIMENT :: freeMode(){
	int ModelHandle;
	//床読み込み
	ModelHandle = MV1LoadModel("model\\floor\\floor.mqo");
	MV1SetScale(ModelHandle, VGet(250.0f, 100.0f, 250.0f));
	MV1SetPosition(ModelHandle, VGet(0, 0, 0));

	BUILDING buil;

	//弾の配列の確保
	SHOT* mShot;
	mShot = new SHOT(GetColor(255, 255, 0), 15.0f, 85.0f);
	//モデルの読み込み
	PLAYER* p;
	p = new PLAYER(VGet(0, 0, 0), 0.0, mShot);
	//ターゲットの読み込み
	TARGET t;
	t.newTarget();

	while(ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0){
		// 画面をクリア
		ClearDrawScreen();
		//床の描画
		MV1DrawModel(ModelHandle);
		
		buil.display();
		//FPSの表示
		fpsDisplay();
		//モデルの操作,描画
		p->control();
		p->display();
		t.display();
		p->doNotMove(buil.collision(p->getPos(), p->getRotate()));
		p->doNotMove(t.collision(p->getPos(), p->getRotate()));
		mShot->collisionTarget(buil.getModelHandle());
		if(mShot->collisionTarget(t.getModelHandle()) > 0){
			t.delTarget();
			t.newTarget();
		}
		//裏画面の内容を表画面に反映
		ScreenFlip();
	}
	MV1DeleteModel(ModelHandle);
	delete mShot;
	delete p;
}
コード例 #9
0
ファイル: Enemy.cpp プロジェクト: Xivil/zemigame
void Enemy::SetAll( float x, float y, float z, int life, int timer, int shotpattern, int movepattern , int Itemflag){
	SetX(x);
	SetY(y);
	SetZ(z);
	SetLife(life);
	SetTimer(timer);
	this->Itemflag = Itemflag; 
	this->shotpattern = shotpattern;
	this->movepattern = movepattern;
	for(int i = 0; i < ESNUM; i++){
		es[i].graph = MV1LoadModel("aaaa.mqo");
		es[i].flag = 0;
		MV1SetScale(es[i].graph, VGet(0.01f, 0.01f, 0.01f));

	}
	score = life * 100;
	DeathTimer = 120;
}
コード例 #10
0
ファイル: Character.cpp プロジェクト: Xivil/zemigame
void Character::Shot(){
	static unsigned int pad_timer = 0;
	if(KeyGet(KEY_INPUT_U)) power = 2;
	if (input & PAD_INPUT_1) {
		pad_timer++;
	}
	else{
		pad_timer = 0;
	}
	if (KeyGet(KEY_INPUT_SPACE) % 5 == 1 || pad_timer % 5 == 1  && muteki == 0){
		PlaySoundMem( shotsound , DX_PLAYTYPE_BACK ) ;

		for(int i = 0; i < SNUM; i++){
			if(shot[i].flag == 0){
				shot[i].flag = 1;
				shot[i].x = x;
				shot[i].y = y;
				shot[i].z = z;
				shot[i].angleX = RotateX;
				shot[i].angleY = RotateY;
				shot[i].angleZ = RotateZ;
				shot[i].playtime =0.0f;
				float sbx =  1 * tan((RotateZ * PI/ 180));
				float sb =  ((sbx * sbx) + 1 * 1);
				float sby = sb * tan((RotateX * PI/ 180));
				shot[i].rx = sbx / sb * 10.0f;
				shot[i].rz = 1 / sb * 10.0f;
				shot[i].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i].graph, VGet(( shot[i].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));
				break;
				
			}
			
		}

	}
	if(KeyGet(KEY_INPUT_SPACE) % 5 == 1 && power == 1 ){
		PlaySoundMem( shotsound , DX_PLAYTYPE_BACK ) ;
		for(int i = 0; i < SNUM; i++){
			if(shot[i].flag == 0){
				shot[i].flag = 1;
				shot[i].x = x - 2;
				shot[i].y = y;
				shot[i].z = z;
				shot[i + 1].flag = 1;
				shot[i + 1].x = x + 2;
				shot[i + 1].y = y;
				shot[i + 1].z = z;
				shot[i].angleX = RotateX;
				shot[i].angleY = RotateY;
				shot[i].angleZ = RotateZ;
				shot[i].playtime =0.0f;
				shot[i + 1].angleX = RotateX;
				shot[i + 1].angleY = RotateY;
				shot[i + 1].angleZ = RotateZ;
				shot[i + 1].playtime =0.0f;
				float sbx =  1 * tan((RotateZ * PI/ 180));
				float sb =  ((sbx * sbx) + 1 * 1);
				float sby = sb * tan((RotateX * PI/ 180));
				shot[i].rx = sbx / sb * 10.0f;
				shot[i].rz = 1 / sb * 10.0f;
				shot[i].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i].graph, VGet(( shot[i].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));
				shot[i + 1].rx = sbx / sb * 10.0f;
				shot[i + 1].rz = 1 / sb * 10.0f;
				shot[i + 1].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i + 1].graph, VGet(( shot[i + 1].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i + 1].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));
				break;
				
			}
			
		}

	}
	if(KeyGet(KEY_INPUT_SPACE) % 5 == 1 && power >= 2 ){
		PlaySoundMem( shotsound , DX_PLAYTYPE_BACK ) ;
		for(int i = 0; i < SNUM; i++){
			if(shot[i].flag == 0){
				shot[i].flag = 1;
				shot[i].x = x;
				shot[i].y = y;
				shot[i].z = z;
				shot[i].angleX = RotateX;
				shot[i].angleY = RotateY;
				shot[i].angleZ = RotateZ;
				shot[i].playtime =0.0f;

				shot[i + 1].flag = 1;
				shot[i + 1].x = x + 4;
				shot[i + 1].y = y;
				shot[i + 1].z = z;
				shot[i + 1].angleX = RotateX;
				shot[i + 1].angleY = RotateY;
				shot[i + 1].angleZ = RotateZ;
				shot[i + 1].playtime =0.0f;

				shot[i + 2].flag = 1;
				shot[i + 2].x = x - 4;
				shot[i + 2].y = y;
				shot[i + 2].z = z;
				shot[i + 2].angleX = RotateX;
				shot[i + 2].angleY = RotateY;
				shot[i + 2].angleZ = RotateZ;
				shot[i + 2].playtime =0.0f;

				float sbx =  1 * tan((RotateZ * PI/ 180));
				float sb =  ((sbx * sbx) + 1 * 1);
				float sby = sb * tan((RotateX * PI/ 180));
				shot[i].rx = sbx / sb * 10.0f;
				shot[i].rz = 1 / sb * 10.0f;
				shot[i].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i].graph, VGet(( shot[i].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));

				shot[i + 1].rx = sbx / sb * 10.0f;
				shot[i + 1].rz = 1 / sb * 10.0f;
				shot[i + 1].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i + 1].graph, VGet(( shot[i + 1].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i + 1].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));

				shot[i + 2].rx = sbx / sb * 10.0f;
				shot[i + 2].rz = 1 / sb * 10.0f;
				shot[i + 2].ry = sby / sqrt(sb * sb + sby * sby) * 8.0f;
				MV1SetRotationXYZ( shot[i + 2].graph, VGet(( shot[i + 2].angleX / 1.5)* DX_PI_F / 180.0f, ((shot[i + 2].angleZ  + 180 ) * -1) * DX_PI_F / 180.0f, 0 * DX_PI_F / 180.0f ));
				break;
				
			}
			
		}

	}

	for(int i = 0; i < SNUM; i++){
		if(shot[i].flag == 1){
			shot[i].z += shot[i].rz;
			shot[i].x -= shot[i].rx;
			shot[i].y += shot[i].ry;
			MV1SetPosition( shot[i].graph, VGet(shot[i].x, shot[i].y, shot[i].z) );
			MV1DrawModel( shot[i].graph );
			
			MV1SetAttachAnimTime( shot[i].graph, shot[i].attach, shot[i].playtime ) ;
			
			shot[i].playtime += 2.0f;
			
			if(shot[i].playtime >= shot[i].shottime ) shot[i].playtime = 0;
			
			if(shot[i].z > z + 300.0f){
				shot[i].flag = 0;
				shot[i].playtime = 0.0f;
			}
		}
		if(shot[i].flag == 2){
			shot[i].x -= shot[i].rx;
			shot[i].y -= shot[i].ry;
			shot[i].z -= shot[i].rz;
			
			MV1SetScale(shot[i].graph, VGet(0.05f, 0.05f, 0.005f));
			MV1SetPosition( shot[i].graph, VGet(shot[i].x, shot[i].y, shot[i].z) );
			MV1DrawModel( shot[i].graph );
			
			if(shot[i].z > 100){
				shot[i].flag = 0;
			}
		}
	}

}
コード例 #11
0
ファイル: target.hpp プロジェクト: cam-xetal/c_zemi
//public--start
inline TARGET :: TARGET(void){
	srand((unsigned)time(NULL));
	ModelHandle = MV1LoadModel("model\\target\\target.mqo");
	MV1SetScale(ModelHandle, VGet(3.0f, 3.0f, 3.0f));
}
コード例 #12
0
ファイル: Enemy.cpp プロジェクト: Xivil/zemigame
void Boss::Shot(float px, float py, float pz){
	if (timer  == 119){
		SetAnimPattern(firebomb);
		flag |= HORIZONTAL;
	}
	if (count == 6){
		flag &= ~HORIZONTAL + ~VERTICAL;
		flag |= APPROACH;
	}
	
	if (AnimPattern == firebomb && AnimTime >= 20 && !(flag & ATTACK) && flag & HORIZONTAL){
		float len = 3;
			for (int i = 0; i < BSNUM; i++){
				if (bs[i].flag == 0){
					if (bs[i].graph == 0){
						bs[i].graph = MV1LoadModel("aaaa.mqo");
						MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
					}
					bs[i].flag = 1;
					bs[i].x = x;
					bs[i].y = y + 40;
					bs[i].z = z;

					float sbx = x - target_x;
					float sby = y - target_y + 40;
					float sbz = z - target_z;
					float sb = sqrt(sbx * sbx + sbz * sbz);
					bs[i].rx = sbx / sb * ShotSpeed;
					bs[i].rz = sbz / sb * ShotSpeed;
					bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

					break;
				}
			}
			for (int i = 0; i < BSNUM; i++){
				if (bs[i].flag == 0){
					if (bs[i].graph == 0){
						bs[i].graph = MV1LoadModel("aaaa.mqo");
						MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
					}
					bs[i].flag = 1;
					bs[i].x = x;
					bs[i].y = y + 40;
					bs[i].z = z;

					float sbx = x - px - len;
					float sby = y - py + 40;
					float sbz = z - pz;
					float sb = sqrt(sbx * sbx + sbz * sbz);
					bs[i].rx = sbx / sb * ShotSpeed;
					bs[i].rz = sbz / sb * ShotSpeed;
					bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

					break;
				}
			}
			for (int i = 0; i < BSNUM; i++){
				if (bs[i].flag == 0){
					if (bs[i].graph == 0){
						bs[i].graph = MV1LoadModel("aaaa.mqo");
						MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
					}
					bs[i].flag = 1;
					bs[i].x = x;
					bs[i].y = y + 40;
					bs[i].z = z;

					float sbx = x - px + len;
					float sby = y - py + 40;
					float sbz = z - pz;
					float sb = sqrt(sbx * sbx + sbz * sbz);
					bs[i].rx = sbx / sb * ShotSpeed;
					bs[i].rz = sbz / sb * ShotSpeed;
					bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

					break;
				}
			}
			for (int i = 0; i < BSNUM; i++){
				if (bs[i].flag == 0){
					if (bs[i].graph == 0){
						bs[i].graph = MV1LoadModel("aaaa.mqo");
						MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
					}
					bs[i].flag = 1;
					bs[i].x = x;
					bs[i].y = y + 40;
					bs[i].z = z;

					float sbx = x - px + len * 2;
					float sby = y - py + 40;
					float sbz = z - pz;
					float sb = sqrt(sbx * sbx + sbz * sbz);
					bs[i].rx = sbx / sb * ShotSpeed;
					bs[i].rz = sbz / sb * ShotSpeed;
					bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

					break;
				}
			}
			for (int i = 0; i < BSNUM; i++){
				if (bs[i].flag == 0){
					if (bs[i].graph == 0){
						bs[i].graph = MV1LoadModel("aaaa.mqo");
						MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
					}
					bs[i].flag = 1;
					bs[i].x = x;
					bs[i].y = y + 40;
					bs[i].z = z;

					float sbx = x - px + len * -2;
					float sby = y - py + 40;
					float sbz = z - pz;
					float sb = sqrt(sbx * sbx + sbz * sbz);
					bs[i].rx = sbx / sb * ShotSpeed;
					bs[i].rz = sbz / sb * ShotSpeed;
					bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

					break;
				}
			}
			flag |= ATTACK + VERTICAL;
			flag &= ~HORIZONTAL;
			count++;
			PlaySoundMem(boss_attack_sound, DX_PLAYTYPE_BACK);
	}

	if (AnimPattern == firebomb && AnimTime >= 20 && !(flag & ATTACK) && flag & VERTICAL){
		float len = 3;
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - target_x;
				float sby = y - target_y + 40;
				float sbz = z - target_z;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px;
				float sby = y - py + 40 - len;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px;
				float sby = y - py + 40 + len;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px ;
				float sby = y - py + 40 + len * 2;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px ;
				float sby = y - py + 40 + len * -2;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		flag |= ATTACK;
		flag &= ~VERTICAL;
		flag |= HORIZONTAL;
		count++;
		PlaySoundMem(boss_attack_sound, DX_PLAYTYPE_BACK);
	}

	if (AnimPattern == firebomb && AnimTime >= 20 && !(flag & ATTACK) && flag & CROSS){
		float len = 3;
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - target_x;
				float sby = y - target_y + 40;
				float sbz = z - target_z;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px;
				float sby = y - py + 40 - len;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px;
				float sby = y - py + 40 + len;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px;
				float sby = y - py + 40 + len * 2;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px;
				float sby = y - py + 40 + len * -2;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px - len;
				float sby = y - py + 40;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px + len;
				float sby = y - py + 40;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px + len * 2;
				float sby = y - py + 40;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		for (int i = 0; i < BSNUM; i++){
			if (bs[i].flag == 0){
				if (bs[i].graph == 0){
					bs[i].graph = MV1LoadModel("aaaa.mqo");
					MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
				}
				bs[i].flag = 1;
				bs[i].x = x;
				bs[i].y = y + 40;
				bs[i].z = z;

				float sbx = x - px + len * -2;
				float sby = y - py + 40;
				float sbz = z - pz;
				float sb = sqrt(sbx * sbx + sbz * sbz);
				bs[i].rx = sbx / sb * ShotSpeed;
				bs[i].rz = sbz / sb * ShotSpeed;
				bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

				break;
			}
		}
		flag |= ATTACK;
		count++;
		PlaySoundMem(boss_attack_sound, DX_PLAYTYPE_BACK);
	}

	if (flag & APPROACH){

		if (AnimPattern != flight && !(flag & CONTINUITY)){
			SetAnimPattern(flight);
			flag &= ~HORIZONTAL + ~VERTICAL + ~CROSS;
		}
		if (!(flag & CONTINUITY)){
			z -= 2;
		}
		if (z <= 80 && AnimPattern == flight){
			flag |= CONTINUITY;
			SetAnimPattern(firebomb);
		}
		if (AnimPattern == firebomb && AnimTime >= 20 && (int(AnimTime) % 5 == 0) && flag & CONTINUITY){
			float len = 3;
			for (int i = 0; i < BSNUM; i++){
				if (bs[i].flag == 0){
					if (bs[i].graph == 0){
						bs[i].graph = MV1LoadModel("aaaa.mqo");
						MV1SetScale(bs[i].graph, VGet(0.01f, 0.01f, 0.01f));
					}
					bs[i].flag = 1;
					bs[i].x = x;
					bs[i].y = y + 40;
					bs[i].z = z;

					float sbx = x - target_x;
					float sby = y - target_y + 40;
					float sbz = z - target_z;
					float sb = sqrt(sbx * sbx + sbz * sbz);
					bs[i].rx = sbx / sb * ShotSpeed;
					bs[i].rz = sbz / sb * ShotSpeed;
					bs[i].ry = sby / sqrt(sb * sb + py * py) * ShotSpeed;

					break;
				}
			}
			flag |= ATTACK;
			count += 100;
			PlaySoundMem(boss_attack_sound, DX_PLAYTYPE_BACK);
		}
	}
	if (count >= 2100){
		count = 0;
		flag |= LEAVE;
		flag &= ~APPROACH;
	}
	if (flag & LEAVE){
		z += 1;
		if (z >= 130){
			flag &= ~LEAVE;
			flag &= ~CONTINUITY;

			if (life <= LIFE / 2)
			{
				flag |= CROSS;
			}
			else{
				flag |= HORIZONTAL;
			}
			count = 0;
		}
	}
	if (AnimPattern == firebomb && AnimTime == 0) flag &= ~ATTACK;

	for (int i = 0; i < BSNUM; i++){
		if (bs[i].flag)
		{
			bs[i].x -= bs[i].rx;
			bs[i].y -= bs[i].ry;
			bs[i].z -= bs[i].rz;
			MV1SetPosition(bs[i].graph, VGet(bs[i].x, bs[i].y, bs[i].z));
			MV1DrawModel(bs[i].graph);
			if (bs[i].z < -10){
				bs[i].flag = 0;
			}
		}
	}	
	
}
コード例 #13
0
ファイル: Enemy.cpp プロジェクト: Xivil/zemigame
Enemy::Enemy(){

	life = -1;
	graph = MV1LoadModel("Graph/Tブースター.pmx");
	MV1SetScale( graph, VGet(0.5f, 0.5f, 0.5f));
}
コード例 #14
0
ファイル: Model.hpp プロジェクト: tenonno/dxlib-2
	Model &setScale(const double scale)
	{
		MV1SetScale(handle, Vec3(scale));

		return (*this);
	}
コード例 #15
0
ファイル: managiment.cpp プロジェクト: cam-xetal/c_zemi
void MANAGIMENT :: battleModeH(){
	int ModelHandle;
	//床読み込み
	ModelHandle = MV1LoadModel("model\\floor\\floor.mqo");
	MV1SetScale(ModelHandle, VGet(250.0f, 100.0f, 250.0f));
	MV1SetPosition(ModelHandle, VGet(0, 0, 0));

	BUILDING buil;

	//弾の配列の確保
	SHOT* mShot;
	SHOT* eShot;
	mShot = new SHOT(GetColor(255, 255, 0), 15.0f, 85.0f);
	eShot = new SHOT(GetColor(255, 0, 0), 15.0f, 85.0f);

	
	READ_INIT* read;
	read = new READ_INIT();
	char src_ip[32];
	int src_port;
	char sin_ip[32];
	int sin_port;
	VECTOR pPos;
	VECTOR ePos;
	float pR, eR;
	read->read(src_ip, &src_port, sin_ip, &sin_port, &pPos, &ePos, &pR, &eR);
	delete read;
	
	NET_TRANS* net;
	net = new NET_TRANS(src_ip, src_port, sin_ip, sin_port);
	net->setBind();
	

	hTh = (HANDLE)_beginthreadex(NULL, 0, &thread_recv, net, 0, &thID);

	while(1){
		DrawFormatString(20, 20, GetColor(0, 0, 0), "通信中");
		if(!nflag2)
			net->send("start");
		if(nflag1)
			net->send("ok");
		if(nflag1 && nflag2)
			break;
		if(ProcessMessage() != 0 || CheckHitKey(KEY_INPUT_ESCAPE) != 0){
			sflag1 = true;
			WaitForSingleObject(hTh, INFINITE);
			CloseHandle(hTh);
			delete net;
			delete mShot;
			delete eShot;
			MV1DeleteModel(ModelHandle);
			return;
		}
		ScreenFlip();
	}
	sflag1 = true;
	WaitForSingleObject(hTh, INFINITE);
	CloseHandle(hTh);
	
	//モデルの読み込み
	PLAYER* p;
	ENEMY_NET* e;
	p = new PLAYER(pPos, pR, mShot, net);
	e = new ENEMY_NET(ePos, eR, eShot, net);
	

	int pH;
	int eH;

	e->start(e);
	while(ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0){
		// 画面をクリア
		ClearDrawScreen();
		//床の描画
		MV1DrawModel(ModelHandle);
		buil.display();
		//FPSの表示
		fpsDisplay();
		//モデルの操作,描画
		//プレイヤー
		p->control();
		p->send();

		p->doNotMove(buil.collision(p->getPos(), p->getRotate()));
		mShot->collisionTarget(buil.getModelHandle());
		
		p->display();
		e->display();

		e->enterCritical();
		eShot->collisionTarget(buil.getModelHandle());
		pH = p->damageCheck(eShot);
		e->leaveCritical();

		p->doNotMove(p->collision(e->getPos(), e->getRotate()));
		if(e->getHp() <= 0 || pH <= 0){
			break;
		}
		eH = e->damageCheck(mShot);
		//裏画面の内容を表画面に反映
		ScreenFlip();
	}
	
	
	while(ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0){
		p->send();
		// 画面をクリア
		ClearDrawScreen();
		//床の描画
		MV1DrawModel(ModelHandle);
		buil.display();
		//FPSの表示
		SetFontSize(16);
		fpsDisplay();
		p->addCR(0.01f);
		p->display();
		e->display();

		SetFontSize(32);
		pH = p->getHp();
		eH = e->getHp();
		if(pH == eH)
			DrawFormatString(300, 350, GetColor(255, 255, 255), "Draw");
		else if(pH > eH) 
			DrawFormatString(310, 350, GetColor(255, 255, 255), "Win");
		else
			DrawFormatString(300, 350, GetColor(255, 255, 255), "Loss");
		//裏画面の内容を表画面に反映
		ScreenFlip();
	}
	e->stop();
	SetFontSize(16);
	
	
	delete net;

	MV1DeleteModel(ModelHandle);
	delete mShot;
	delete eShot;
	delete p;
	delete e;
}
コード例 #16
0
ファイル: managiment.cpp プロジェクト: cam-xetal/c_zemi
void MANAGIMENT :: battleModeC(){
	int ModelHandle;
	//床読み込み
	ModelHandle = MV1LoadModel("model\\floor\\floor.mqo");
	MV1SetScale(ModelHandle, VGet(250.0f, 100.0f, 250.0f));
	MV1SetPosition(ModelHandle, VGet(0, 0, 0));

	//弾の配列の確保
	SHOT* mShot;
	SHOT* eShot;
	mShot = new SHOT(GetColor(255, 255, 0), 15.0f, 85.0f);
	eShot = new SHOT(GetColor(255, 0, 0), 15.0f, 85.0f);
	//モデルの読み込み
	PLAYER* p;
	ENEMY* e;
	p = new PLAYER(VGet(0, 0, 3500.0), 0.0f, mShot);
	e = new ENEMY(VGet(0, 0, -3500), PI, eShot);
	BUILDING buil;

	int pH;
	int eH;
	while(ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0){
		// 画面をクリア
		ClearDrawScreen();

		//床の描画
		MV1DrawModel(ModelHandle);
		buil.display();
		//FPSの表示
		fpsDisplay();
		//モデルの操作,描画
		//プレイヤー
		p->control();
		p->display();
		//敵
		VECTOR rotateP = p->getRotate();
		e->control(rotateP.y, p->getVector());
		e->display();
		
		p->doNotMove(buil.collision(p->getPos(), p->getRotate()));
		e->doNotMove(buil.collision(e->getPos(), e->getRotate()));
		mShot->collisionTarget(buil.getModelHandle());
		eShot->collisionTarget(buil.getModelHandle());

		p->doNotMove(p->collision(e->getPos(), e->getRotate()));
		e->doNotMove(e->collision(p->getPos(), p->getRotate()));
		
		pH = p->damageCheck(eShot);
		eH = e->damageCheck(mShot);
		if(pH <=0 || eH <= 0)
			break;
		mShot->collisionModel(e->getModelHandle());
		eShot->collisionModel(p->getModelHandle());
		
		//裏画面の内容を表画面に反映
		ScreenFlip();
	}
	
	while(ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0){
		// 画面をクリア
		ClearDrawScreen();
		//床の描画
		MV1DrawModel(ModelHandle);
		buil.display();
		//FPSの表示
		SetFontSize(16);
		fpsDisplay();
		p->addCR(0.01f);
		p->display();
		e->display();
		SetFontSize(32);
		pH = p->getHp();
		eH = e->getHp();
		if(pH == eH)
			DrawFormatString(300, 350, GetColor(255, 255, 255), "Draw");
		else if(pH > eH) 
			DrawFormatString(310, 350, GetColor(255, 255, 255), "Win");
		else
			DrawFormatString(300, 350, GetColor(255, 255, 255), "Loss");
		//裏画面の内容を表画面に反映
		ScreenFlip();
	}
	SetFontSize(16);

	MV1DeleteModel(ModelHandle);
	delete mShot;
	delete eShot;
	delete p;
	delete e;
}