Colobot Wiki
Advertisement
Tballis1

An example of the aim function being used with the Phazer Shooter

Syntax: aim ( y, x );

This instruction sets the vertical and the horizontal angle of the cannon. The following robots are equipped with a cannon: o  Shooter o  Orga shooter o  Phazer shooter

When controlling the robot through programming, the gun can be also turned left or right by turning the whole robot with the instruction turn.

y: float Angle in degrees of the gun relative to the robot. A positive value orients the gun upward. For shooters and orga shooters, the angle must range from -20 to +20 degrees. For phazer shooters, the angle must range from -20 to 45 degrees.

x: float (default value: 0) Angle in degrees of the gun relative to the robot. A positive value orients the gun to the right. The angle must range from -40 to +40 degrees for all shooters.

Return value: int Zero if everything is OK, a value different from zero if the rotation could not be performed: == 0 The gun has now got the desired orientation != 0 rotation impossible

Advertisement