extern void object::Attack( )
{
	int list[] = {
		WingedGrabber,
		TrackedGrabber,
		WheeledGrabber,
		LeggedGrabber,
		WingedShooter,
		TrackedShooter,
		WheeledShooter,
		LeggedShooter,
		WingedOrgaShooter,
		TrackedOrgaShooter,
		WheeledOrgaShooter,
		LeggedOrgaShooter,
		WingedSniffer,
		TrackedSniffer,
		WheeledSniffer,
		LeggedSniffer,
		WingedBuilder,
		TrackedBuilder,
		WheeledBuilder,
		LeggedBuilder,
		Thumper,
		PhazerShooter,
		Recycler,
		Shielder,
		Subber,
		TargetBot,
		RadarStation
	//	DefenseTower
	};

	errmode(0);
	while ( ismovie() != 0 )  wait(1);

	while ( true )
	{
		object target = radar(list, 0, 360, 0, 60);
		if ( target != null and distance2d(target.position, position) < 5)
		{
			point dest(
				position.x + (rand() - 0.5) * 8,
				position.y + (rand() - 0.5) * 8
			);
			if ( topo(dest) > 0 ) goto(dest);
		}
		else if ( target != null )
		{
			point dest = target.position;
			while (true)
			{
				dest.x = (position.x + dest.x) / 2;
				dest.y = (position.y + dest.y) / 2;
				if ( distance2d(position, dest) < 1 )
				{
					dest.x = position.x + (rand() - 0.5) * 8;
					dest.y = position.y + (rand() - 0.5) * 8;
					if ( topo(dest) > 0 ) goto(dest);
					break;
				}
				if ( topo(dest) > 0 )
				{
					goto(dest);
					break;
				}
			}
		}
		else
		{
			float dim = 1 + rand() * 2;
			point nav1(position.x + dim, position.y + dim);
			point nav2(position.x + dim, position.y - dim);
			point nav3(position.x - dim, position.y - dim);
			point nav4(position.x - dim, position.y + dim);
			if (topo(nav1) > 0 and topo(nav2) > 0 and topo(nav3) > 0 and topo(nav4) > 0)
			{
				while ( true )
				{
					goto(nav1);
					target = radar(list, 0, 360, 0, 60);
					if ( target != null )  break;
	
					goto(nav2);
					target = radar(list, 0, 360, 0, 60);
					if ( target != null )  break;
	
					goto(nav3);
					target = radar(list, 0, 360, 0, 60);
					if ( target != null )  break;
	
					goto(nav4);
					target = radar(list, 0, 360, 0, 60);
					if ( target != null )  break;
				}
			}
			else
			{
				point dest(
					position.x + (rand() - 0.5) * 8,
					position.y + (rand() - 0.5) * 8
				);
				if ( topo(dest) > 0 ) goto(dest);
			}
		}
	}
}
