Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What object is this cross in a circle?
(03-18-2016, 12:50 PM)tomaszkax86 Wrote: tar2.position is of type point, which has 3 floats. You need to save it to a variable and calculate position:
You might want to use object's orientation (angle) to calculate position using cos() and sin().

I'v got some positive results, thanks! The idea to calculte position of an object is quite interesting. Could you explain with some example, please, how to get angle of an object using cos and sin? For example, Target2?

(03-18-2016, 12:50 PM)tomaszkax86 Wrote: Side note: goto() is kinda like cheating. It's too easy. Try doing the same using motor() and jet(). I think this could be a good idea for a programming challenge. A speed run or something.

Yes, I'm inclined to agree with you. But I confronted with some troubles using move(). In previous mission my WheeledShooter every time, when was stopped by a building or ruin or a bot, continued to do move() without end. Though there was errmode() in the code. In the same time, errmode() worked correctly when WheeledShooter confronted with some plant. Why in one case the game didn't take stopping as an error and in other case took it as an error and performed errmode() that is a big riddle for me. Here is that code:
object ant, power;
point pos, pos2;
float lev = 0;
float dir = direction(ant.position);

while(radar(AlienAnt, 0, 360, 0, 20) == null)
ant = radar(AlienAnt);
dir = direction(ant.position);
int err;
err = move(distance(position, ant.position)-40);
if ( err != 0 )
if (distance(position, ant.position) < 50)
ant = radar(AlienAnt);
dir = direction(ant.position);

if (energyCell.energyLevel < 0.5)
power = radar(PowerStation);
while(energyCell.energyLevel < 1)

Messages In This Thread
RE: What object is this cross in a circle? - by Rinoldo - 03-18-2016, 02:52 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)