|
Polski Portal COLOBOTa COLOBOT Polish Portal |
|
Programy dla obcych - Pająk...
Korniszon - 18-10-2010, 09:33 Temat postu: Pająk... A oto program
Kod: | extern void object::Attack()
{
int list[], i = 0;
point dest, nav[];
object target;
errmode(0);
while(ismovie() != 0) wait(0.01);
list[i++] = WheeledGrabber;
list[i++] = TrackedGrabber;
list[i++] = WingedGrabber;
list[i++] = LeggedGrabber;
list[i++] = WheeledSniffer;
list[i++] = TrackedSniffer;
list[i++] = WingedSniffer;
list[i++] = LeggedSniffer;
list[i++] = WheeledShooter;
list[i++] = TrackedShooter;
list[i++] = WingedShooter;
list[i++] = LeggedShooter;
list[i++] = WheeledOrgaShooter;
list[i++] = TrackedOrgaShooter;
list[i++] = WingedOrgaShooter;
list[i++] = LeggedOrgaShooter;
list[i++] = PhazerShooter;
list[i++] = Thumper;
list[i++] = Recycler;
list[i++] = Shielder;
list[i++] = Subber;
list[i++] = Me;
list[i++] = Derrick;
list[i++] = BotFactory;
list[i++] = PowerStation;
list[i++] = Converter;
list[i++] = RepairCenter;
list[i++] = DefenseTower;
list[i++] = ResearchCenter;
list[i++] = RadarStation;
list[i++] = ExchangePost;
list[i++] = PowerPlant;
list[i++] = AutoLab;
list[i++] = NuclearPlant;
list[i++] = PowerCaptor;
list[i++] = Titanium;
list[i++] = PowerCell;
list[i++] = NuclearCell;
i = 0;
nav[i].x = cmdline(0);
nav[i++].y = cmdline(1);
nav[i].x = cmdline(2);
nav[i++].y = cmdline(3);
nav[i].x = cmdline(4);
nav[i++].y = cmdline(5);
nav[i].x = cmdline(6);
nav[i++].y = cmdline(7);
nav[i].x = cmdline(8);
nav[i++].y = cmdline(9);
while(true)
{
target = radar(list, 0, 360, 0, 30);
if(target==null)
{
for(i = 0; true; i++)
{
goto(nav[i%5]);
target = radar(list, 0, 360, 0, 30);
if(target != null) break;
}
}
else
{
if(distance(position, target.position) <= 10) fire();
else while(true)
{
float stan, dist = distance(position, p.position);
stan = dist - 5;
if(stan>25) stan = 25;
dest.x=(position.x-target.position.x)*stan/dist-target.position.x;
dest.y=(position.y-target.position.y)*stan/dist-target.position.y;
motor(1-direction(dest),1+direction(dest));
if(position == dest)
{
motor(0,0);
break;
}
}
}
}
}
|
Jest trochę ściągnięty z programu spider02.txt. Jakby powiedzeć - w 75% mój, w 25% Epsiteca.
Ale jest dobry .
//dodałem odgromnika
//... oraz zmieniłem na motor
//atakuje obiekty przenośne też
Berserker - 18-10-2010, 14:58
Nawet go nie testowales
Korniszon - 18-10-2010, 16:42
Testowałem, ale to była dobra wersja więc przepraszam za złe wpisanie kodu
Berserker - 18-10-2010, 19:31
No coz, dalej nie jest dobrze
Korniszon - 19-10-2010, 09:47
U mnie działało.
UPS!
Jednak nie działa.
|
|