colobot-data/help/D/cbot/fire.txt

32 lines
1.2 KiB
Plaintext

\b;Instruction \c;fire\n;
The instruction \c;fire();\n; fires the bot's onboard cannon.
\b;Basic use
Generally this instruction is used to shoot one-second bursts:
\c;
\s; fire(1);
\n;
\b;For specialists
Syntax:
\s;\c;fire ( time );\n;
Fires the gun, with a burst that lasts a certain time. The longer the burst, the more energy it needs. This instruction can be used with the following bot types:
o \l;Shooter\u object\botfr;
o \l;Orga shooter\u object\botor;
o \l;Phazer shooter\u object\botphaz;
When controlling the robot through programming, the only way to turn the gun left or right is to turn the whole robot with the instruction \c;\l;turn\u cbot\turn;\n;.
In order to move the gun upward or downward, use the instruction \c;\l;aim\u cbot\aim;\n;.
\t;time: \c;\l;float\u cbot\float;\n;
Duration of the burst. Generally, the value given is 1. Shorter bursts can also be performed in order to spare time and energy.
\t;Return value: \c;\l;int\u cbot\int;\n;
Zero if OK, or a value different from zero if an error occurred.
\c;== 0 \n;the cannon has been fired
\c;!= 0 \n;error, the cannon could not be fired
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.