Beispiel #1
0
/*- -------------------------------------------------------------- -*/
void ResearchRobot::operate(Map& m){
	flagDeployedThisRound = false;

	checkRobotDeath();	// checking to see if the robot must be removed from the map


	if (m.dangers[get_pos_x()][get_pos_y()] >= 0.6) {	// this area is considered dangerous
		m.flags[get_pos_x()][get_pos_y()] = true; 		// setting down a flag so that other robots can avoid this area
		
		flagsDeployed++; 				// increase the flags counter for this robot
		flagDeployedThisRound = true;	// deployed a flag
	}
}
Beispiel #2
0
void map::Tower3::fire(){
	time=clock.getElapsedTime();
	timeInt=time.asMilliseconds()+20;
	if(timeInt%600<20){
		int destination=int(rand())%4+1;
		Projectile1 *wsk=new Projectile1(get_pos_x()+10, get_pos_y()+5, "Grafika/fball.png", speed, 10, 10, destination);
		projectiles.push_back(wsk);
		clock.restart();
	}

}
float			get_y(t_scene *scene, t_grille *grille, int pos)
{
  t_bunny_position	palier;
  float			y;

  y = 0;
  palier.x = grille->start_y + 10 + get_pos_y(y, grille);
  palier.y =  grille->start_y + 10 + get_pos_y(++y, grille);
  if (pos < palier.x)
    return (-1);
  while (pos > palier.y && y < scene->size.y)
    {
      palier.x = palier.y;
      palier.y = grille->start_y + 10 + get_pos_y(++y, grille);
    }
  if (pos > palier.y)
    return (-1);
  y += (float)((float)(pos - palier.x) / (float)(palier.y - palier.x));
  return (y - 1);
}