CBOT-code-jetcannon, Inne

[ Pobierz całość w formacie PDF ]
//// P.C. Osa1 v. 1.5 ////extern void object::Osa1(){object item;float x, dir;while (true){item = radar(AlienWasp);if ( item == null ){item = radar(Me);goto(item.position); // zatrzymajbreak;}while(radar(AlienWasp, 0, 360, 0, 50) == null){dir = direction(item.position);motor(1,1);if(position.z > item.position.z && position.z > 2){jet(-0.3);}else if(position.z < item.position.z - 1){jet(0.3);}else{jet(0);}if ( dir < 0 ) // po prawej?{motor(1, 1+dir/90);}else if ( dir > 0 ) // po lewej?{motor(1-dir/90, 1);}wait(0.2);}item = radar(AlienWasp, 0, 360, 0, 50);int i = 0;while (item != null){if(position.z > item.position.z && position.z > 1){jet(-0.3);}else if (position.z < item.position.z - 1){jet(0.3);}else{jet(0);}dir = direction(item.position);if ( dir < 0 ) // po prawej?{motor(1, 1+dir/45);}else if ( dir > 0 ) // po lewej?{motor(1-dir/45, 1);}dir = direction(item.position);if ( dir > -25 && dir < 25){x = GetAngle( this, item ) - pitch;//message("X: " + -dir + " Y: " + x, 3);if ( x >= -20 && x <= 20 ){aim( x, -dir );dir = dir - direction(item.position);if ( dir > -2 && dir < 2){fire(0.1);wait(0.2);}}else{wait(0.2);}}else{wait(0.2);}i++;if (i>5){item = radar(AlienWasp, 0, 360, 0, 50);i=0;}}}}float GetAngle( object robot, object target ){float a,b;b = distance2d( robot.position, target.position );a = target.position.z - robot.position.z;return atan(a/b);} [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • agul-net.keep.pl