So, my professor wants me to make a snake program using his format only. I am not allowed to change it in any way and it confused me. Im trying to make the snake move around and it won't work.
void move() {
this.debugInfo("Start of move");
GridPos newLocation = new GridPos(0,9); //Right here is where it goes wrong, i dont need the (0,9), i need to fix it but i
for(int i=0; i<length-1; i++){ // dont know how to. he suggested
body[i] = body[i+1];
body[length-1] = newLocation;
"What you need to do is add the x-coordinate of the current head position (which you can get with body[length-1].getX() ) to the x-coordinate of the movement direction, direction.getX() to get the nextX coordinate. A similar process will let you get the nextY coordinate. Then you do nextHead = new GridPos(nextX, nextY); to make the gridPos object for the next head position." I dont know how to put this into code. does anyone get it?