コード例 #1
0
void AIEnemyZombie::UseBrain()
{
	xtile = aiinput->GetXTilePos();
	ytile = aiinput->GetYTilePos();
	xpos = aiinput->GetXLoc();
	ypos = aiinput->GetYLoc();

	if(new_enemy){
		new_enemy=false;
		//if( (aiinput->lower_patrol_x > 0) && (aiinput->upper_patrol_x > 0)) use_patrol_bounds = true;
	}

	


	switch(GetState())
	{
	case AIS_CHASE:
		Chase();
		break;
	case AIS_ATTACK:
		Attack();
		break;
	case AIS_PATROL:
		Patrol();
		break;
	case AIS_MOVE:
		MoveToXTile(movetoxtile);
		break;
	case AIS_WAIT:
		Wait();
		break;

	}
}
コード例 #2
0
void AIEnemyAdvancedGeneticMonster2::UseBrain()
{
	xtile = aiinput->GetXTilePos();
	ytile = aiinput->GetYTilePos()-1;
	xpos = aiinput->GetXLoc();
	ypos = aiinput->GetYLoc();

	int pyt = aio->player_input->GetYTilePos();
	int th = abs(ytile - pyt);

	if(aiinput->GetStateFlags()->S_DEAD) return;
	
	if(new_enemy)
	{
		new_enemy = false;
		cur_health = aiinput->GetCurLife();
	}

	prev_health = cur_health;
	cur_health = aiinput->GetCurLife();

	
	
	if( (prev_health - cur_health) >0 ) damaged = true;
	else damaged = false;

/*#ifdef _DEBUG
	char temp[256];
	sprintf(temp, "{AI}[AGM] (th:%d)", th);
	OutputDebugString(temp);
#endif*/

	switch(GetState())
	{
	case AIS_CHASE:
		Chase();
		break;
	case AIS_ATTACK:
		Attack();
		break;
	case AIS_PATROL:
		Patrol();
		break;
	case AIS_MOVE:
		MoveToXTile(movetoxtile);
		break;
	case AIS_WAIT:
		Wait();
		break;
/*	case AIS_NAVIGATE_DOWN:
		break;
	case AIS_NAVIGATE_UP:
		break;*/
	}
}
コード例 #3
0
void BaseEnemy::UseBrain()
{
	xtile = aiinput->GetXTilePos();
	ytile = aiinput->GetYTilePos();
	xpos = aiinput->GetXLoc();
	ypos = aiinput->GetYLoc();
//	_ftprintf(debug, _T("%i %i\n"), xtile, ytile);
//	_ftprintf(debug, _T("%i\n"), GetAIMapCord(xtile, ytile));

//	aioutput->moveButton4();
	
/*	FILE *temp  = _tfopen(_T("greenninja.txt"), _T("a"));
	_ftprintf(temp, _T("th%d xt%d yt%d xp%f yp%f\n"), aiinput->GetTileHeight(), xtile, ytile, xpos, ypos);
	fclose(temp);*/

	
//	StateManager();

/*	FILE *fp;
	fp = fopen("ailog.txt", "w");
	fprintf(fp, "%i %i %i %i", aiinput->lower_patrol_x, aiinput->lower_patrol_y, aiinput->upper_patrol_x, aiinput->upper_patrol_y);
	fclose(fp);*/
	switch(GetState())
	{
	case AIS_CHASE:
		Chase();
		break;
	case AIS_ATTACK:
		Attack();
		break;
	case AIS_PATROL:
		Patrol();
		break;
	case AIS_MOVE:
		MoveToXTile(movetoxtile);
		break;
	case AIS_WAIT:
		Wait();
		break;
/*	case AIS_NAVIGATE_DOWN:
		break;
	case AIS_NAVIGATE_UP:
		break;*/
	}
}
コード例 #4
0
void AIEnemyJunkbotTrack::UseBrain()
{
	xtile = aiinput->GetXTilePos();
	ytile = aiinput->GetYTilePos();
	xpos = aiinput->GetXLoc();
	ypos = aiinput->GetYLoc();

/*#ifdef _DEBUG
	char temp[256];
	sprintf(temp, "{AI}[JunkbotTrack] (xt:%d) (yt%d) (stopblock:%d)", xtile, ytile, IsStopBlock());
	OutputDebugString(temp);
#endif*/


	if(new_enemy){
		new_enemy=false;
		if( (aiinput->lower_patrol_x > 0) && (aiinput->upper_patrol_x > 0)) use_patrol_bounds = true;
	}


	
	switch(GetState())
	{
	case AIS_CHASE:
		Chase();
		break;
	case AIS_ATTACK:
		Attack();
		break;
	case AIS_PATROL:
		Patrol();
		break;
	case AIS_MOVE:
		MoveToXTile(movetoxtile);
		break;
	case AIS_WAIT:
		Wait();
		break;

	}
}
コード例 #5
0
void AIEnemyFlyingSentryB::UseBrain()
{
	xtile = aiinput->GetXTilePos();
	ytile = aiinput->GetYTilePos();
	xpos = aiinput->GetXLoc();
	ypos = aiinput->GetYLoc();

	if(new_enemy){
		new_enemy=false;
		//if( (aiinput->lower_patrol_x  > 0) && (aiinput->upper_patrol_x  > 0)) use_patrol_bounds=true;
	}

/*#ifdef _DEBUG
	char temp[256];
	sprintf(temp, "{AI}[SentryB] (cstate:%d)(use_patrol_bounds:%d)(lxb:%d)(uxb:%d)", current_state, use_patrol_bounds, aiinput->lower_patrol_x, aiinput->upper_patrol_x);
	OutputDebugString(temp);
#endif*/
	
	switch(GetState())
	{
	case AIS_CHASE:
		Chase();
		break;
	case AIS_ATTACK:
		Attack();
		break;
	case AIS_PATROL:
		Patrol();
		break;
	case AIS_MOVE:
		MoveToXTile(movetoxtile);
		break;
	case AIS_WAIT:
		Wait();
		break;

	}
}
コード例 #6
0
void AIEnemyFlyingSentryA::UseBrain()
{
	xtile = aiinput->GetXTilePos();
	ytile = aiinput->GetYTilePos();
	xpos = aiinput->GetXLoc();
	ypos = aiinput->GetYLoc();

	if(new_enemy){
		new_enemy=false;
		//use_patrol_bounds=true;
		//if( (aiinput->lower_patrol_y  == 0) && (aiinput->upper_patrol_y  == 0))
		//{/*no bounds were set -- make some*/
		//	aiinput->lower_patrol_y = aiinput->GetYTilePos()+6;
		//	aiinput->upper_patrol_y = aiinput->GetYTilePos()-6;
		//}

	}
	
	switch(GetState())
	{
	case AIS_CHASE:
		Chase();
		break;
	case AIS_ATTACK:
		Attack();
		break;
	case AIS_PATROL:
		Patrol();
		break;
	case AIS_MOVE:
		MoveToXTile(movetoxtile);
		break;
	case AIS_WAIT:
		Wait();
		break;

	}
}