Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm working on a code for clearing the waypoint course
#1
Hey. This is {No}Mad here. I recently started playing COLOBOT: Gold Edition because I remember fooling around with it as a kid but not really understanding it. Now I've returned to it to teach myself a bit of coding and for the fun challenge of it.

I created a code for the first challenge of getting the robot to follow the waypoints, instead of just moving a set number of meters, but I ran into an issue at the end where there were no more waypoints, and I'm trying to get it to move the appropriate meters to the left of it to cross the finish line. I just haven't figured it out yet.

The code is as follows:


Quote:extern void object::Move()
{
 
 object item;
 
 while (true)
 
 {
  item = radar(WayPoint);
  goto(item.position);
  
  if (false)
  {
   break;
  }
 }
 
 turn(90);
 move(20);
 
}

The only issue is that, when I use it, it doesn't work. As soon as the bot runs out of waypoints, it says "Unknown Object", and stops dead in it's tracks.

I'm going to continue working on it, but suggestions would be, you know, nice. Though I do plan to figure these out on my own as I get more experienced.


Messages In This Thread
I'm working on a code for clearing the waypoint course - by {No}Mad - 07-19-2018, 07:18 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)