FANDOM


With the instruction radar(), you can look for objects like enemies, bots, buildings or raw materials.

Basic useEdit

Write in brackets the name of the object that you look for. Put the result in a variable of the type object. Here is an example that looks for the closest ant:

// At the beginning of the program:
object item; //variable declaration

//Look for the closest ant
item = radar(AlienAnt);

Syntax:Edit

Radar1

Radar

radar(int category, float angle, float focus, float min, float max, float way);

Seen from above, the purple zone corresponds to the zone where objects will be detected. 

Category of the objects that should be detected. For example, when you are looking for an ant, write radar(AlienAnt);

way: (default value 1)

Determines which way the objects are detected. With value 1, returns the closest object found in the specified zone. With value -1, the farthest object in the zone will be returned.

Return value:Edit

Returns the first object found that corresponds to the specified category in the specified zone. If no object was found, returns the value null.

RemarkEdit

You do not have to give all the parameters. Here are two examples of instructions that are equivalent: 

radar(Titanium, 0, 360, 0, 1000);
radar(Titanium); // equivalent

radar(Titanium, 0, 90, 0, 1000);
radar(Titanium, 0, 90); //equivalent

When one or more parameters are not specified, the default values indicated above are used instead; only the first parameter is compulsory.

Generally, only the first parameter is specified: ex. radar (AlienAnt); detects the closest ant, wherever it may be. 

See alsoEdit

Programming types and categories .

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.