Exemple #1
0
void Game::Initialise(){
	DebugOut("Game::Initialise being called");
	glEnable(GL_POLYGON_SMOOTH);  //set best smoothing
	glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);

	timer = new Timer();
	font1 = new BFont(hDC, "Courier", 14);
	initPhysicsObjects();
	oPlatform = new OGL_Box(pForm);
	oPlatform->setRGB(1.0f,1.0f,1.0f);
	/*oBox = new OGL_Box(pBox);
	oBox->setRGB(0.0f,0.0f,1.0f);*/
	for(int i = 0; i < ARRAY_BOX_NUMBER; i++){
		oBoxArray[i] = new OGL_Box(pBoxArray[i]);
		oBoxArray[i]->setRGB(1.0,0.0,0.0);
	}
	//oSphere = new OGL_Sphere(pSphere);
	//oSphere->setRGB(0.0,1.0,0.0);
	mark = new Marker(0.1,0.5,0.1);
	mark->setPos(0.0,0.8,3.0);
	mark->setRGB(0.0,1.0,0.0);

	makeGoal();

	m_sEngine->play2D("Sounds/Kevin_MacLeod_-_Funeral_March_for_Brass.mp3", true);

}
Exemple #2
0
void Game::playInit(){
	levelFact = new LevelFactoryImplementation();
	enemyFact = new EnemyFactoryImplementation();

	initPhysicsObjects();
	
	oSphere = new OGL_Sphere(pSphere, "Images/metal.bmp");
	oSphere->setRGB(1.0,1.0,1.0);

	skyBox = new Marker(15, 15, 15, "Images/sky.bmp");
	skyBox->setRGB(1.0,1.0,1.0);

	makeGoal();

	loadFileif.open("loadText.txt");
	
	enemyf = enemyFact->createEnemy(SMALL, 100, 60, 10);
}
Exemple #3
0
void Game::Update(){
	//Timers
	while(timer->getElapsedTime() - lft - 1.0f/60.0f < 0.001f); //Frame Limiter (set to 60 FPS)
	cft = timer->getElapsedTime();
	tbf = cft - lft;
	lft = cft;
	//Havok
	if(physicsState){
		m_world->stepDeltaTime(tbf); //update physics engine
		#ifdef _DEBUG
			m_vdb->step(tbf);	// update VDB when running
		#endif
	}

	//if(pSphere->getPos().y < -10.0){//to stop error
	//	physicsState = false;
	//}
		
	//Object Updates
	oPlatform->update();
	/*oSphere->update();*/
	if(goal){
		isColliding = mark->collides(goal);
		if(isColliding == true){
			delete goal;
			goal = NULL;
			makeGoal();
		}
	}
//	oBox->update();
	for(int i = 0; i < ARRAY_BOX_NUMBER; i++){
		oBoxArray[i]->update();
	}
	for(int i = 0; i < ARRAY_WALL_NUMBER; i++){
		if(oWall[i]){
			oWall[i]->update();
		}
	}
	
	//Camera
	toX = pForm->getPos().x; toY = pForm->getPos().y; toZ = pForm->getPos().z;
}
Exemple #4
0
/*** メイン関数 ***/
int main(int argc, char *argv[])
{
    dInitODE(); // ODEの初期化
    setDrawStuff(); // 描画関数の設定
    world        = dWorldCreate();              // ワールドの生成
    space        = dHashSpaceCreate(0);         // スペースの生成
    contactgroup = dJointGroupCreate(0);        // 接触点グループの生成
    ground       = dCreatePlane(space,0,0,1,0); // 地面の生成
    dWorldSetGravity(world, 0.0, 0.0, - 9.8); // 重力加速度の設定
    dWorldSetCFM(world,1e-3); // CFMの設定
    dWorldSetERP(world,0.8);  // ERPの設定

    makeOmni(); // 全方向移動ロボットの生成
    makeBall(); // ボールの生成
    makeGoal(); // ゴールの生成
    dsSimulationLoop(argc,argv,640,480,&fn); // シミュレーションループ

    dJointGroupDestroy(contactgroup);  // 接触点グループの破壊
    dSpaceDestroy(space);              // スペースの破壊
    dWorldDestroy(world);              // ワールドの破壊
    dCloseODE(); // ODEの終了
    return 0;
}
Exemple #5
0
void Game::Update(){
	//Timers
	while(timer->getElapsedTime() - lft - 1.0f/60.0f < 0.001f); //Frame Limiter (set to 60 FPS)
	cft = timer->getElapsedTime();
	tbf = cft - lft;
	lft = cft;
	//Havok
	if(GAMESTATE == MAINSTATESCREEN){

	}
	if(GAMESTATE == PLAYSTATESCREEN){
		if(physicsState){
			m_world->stepDeltaTime(tbf); //update physics engine
			#ifdef _DEBUG
				m_vdb->step(tbf);	// update VDB when running
			#endif
		}
		//if(physicsState == true){
		//	if(pBox->getPos().y < -4 /*|| pBoxArray[0]->getPos().y < 6 || pBoxArray[1]->getPos().y < 6 || pBoxArray[2]->getPos().y < 6 || pBoxArray[3]->getPos().y < 6*/){
		//		//physicsState = false;
		//		pBoxArray[0]->getRigidBody()->setPosition(hkVector4(0.0,0.0,0.0));
		//	}
		//}
		//if(pSphere->getPos().y < -10.0){//to stop error
		//	physicsState = false;
		//}
		
		//Object Updates
		if(oSphere){
			oSphere->update();
		}
		if(oLevel1){
			oLevel1->update();
		}
		//Collision dectection
		if(goal && oSphere){
			isColliding = goal->collidesWithSphere(oSphere);
			if(isColliding == true){
				deleteEverything();
				makeGoal();
				deleteLevel1();
				createLevel1();
			}
		}
		if(pSphere->getPos().y <= -15){
			sphereInZone == false;
			if(sphereInZone == false){
					dropSphere();
					lives--;
			}
		}
		if(enemyf){
			enemyf->aiUpdate(pSphere);
			isCollidingModelSphere = oSphere->collisionModel(enemyf, oSphere);
			if(isCollidingModelSphere == true){
				lives--;
				dropSphere();
				delete enemyf;
				enemyf = NULL;
			}
		}
		//Camera
		//if(pLevel1){
			toX = pLevel1->getPos().x; toY = pLevel1->getPos().y; toZ = pLevel1->getPos().z;
		//}
	}
}