So I have this problem with my Snake holding to its length. After eating an apple he gets bigger for a while, but then he falls back to deafult size. Can anyone please help me with that issue?
Heres my code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Chvost here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Chvost extends Actor
{
int x;
/**
* Act - do whatever the Chvost wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
//vymazuje koniec chvostu a zároveň ho zväčšuje
int pocitadlo = this.getWorld().getObjects(Had.class).get(0).getPocitadlo();
int score = this.getWorld().getObjects(Had.class).get(0).getScore();
if(pocitadlo> score)
{
getWorld().removeObject(this);
}
}
}

