I just started with programming Java, but I have some issues programming the game Snake.
I programmed a piece of software which has to move the a snake consisting of 3 pieces one step in a direction. The problem is it equals the coordinats even after the method has ended, can someone help me.
The code:The first three lines of the output look like:Code:void processMoving(String eventData){
if(eventData.equals("scherm verversen")){
afdrukkenCoordinateRow(snakeRow);
for(int i=snakeRow.numbersInRow;i>0;i--){
Coordinate hulpCoordinaat=snakeRow.row[i-1];
snakeRow.row[i]=hulpCoordinaat;
}
printCoordinateRow(snakeRow);
snakeRow.row[0].x+=1;
snakeRow.row[0]=moveFrontOfSnake(snakeRow.row[0]);
printCoordinateRow(snakeRow);
}
}
2,0 1,0 0,0 2,0 2,0 1,0 3,0 3,0 1,0
3,0 3,0 1,0 3,0 3,0 3,0 4,0 4,0 4,0
4,0 4,0 4,0 4,0 4,0 4,0 5,0 5,0 5,0
2,0 1,0 0,0 are the starting coordinates of the snake.

