This is what I coded, and as far as I understand it, it should do exactly the same as the solution that seems to work for most others (i.e. creating a GameObject in the createNewHead() method from snakeParts(0) and then using its x- and y-variables). Shouldn't my code get the same variables for the coordinates, just without creating a new GameObject beforehand? Am I missing something? Am I misunderstanding something?
Or is there a stupid error in the code that I just don't spot?
package com.codegym.games.snake;
import com.codegym.engine.cell.*;
public class Apple extends GameObject {
public Apple(int x, int y) {
super(x, y);
}
private static final String APPLE_SIGN = "\uD83C\uDF4E";
public boolean isAlive = true;
public void draw(Game game) {
game.setCellValueEx(x, y, Color.NONE, APPLE_SIGN, Color.GREEN, 75);
}
}