03-19-2016, 07:20 AM
The "f" is used to express a literal float value in C++, it doesn't exist in CBOT.
Code:
// orientation is the direction the object is facing. 0-360
// 0 and 360 == east
// 90 == north and 180 == west
// To calculate a point 5 meters behind an object
float dist = -5.0; // <------change this to 5.0 to go in front of the object
point pos = item.position;
float ori = item.orientation;
// calculate the difference
float dx = dist * cos(ori); // cos() is used for x
float dy = dist * sin(ori); // sin() is used for y
// add that to object position
pos.x += dx;
pos.y += dy;
goto(pos);
turn( direction(item.position) );