This site requires JavaScript, please enable it in your browser!
Greenfoot back
theboyl
theboyl wrote ...

2016/12/23

getObjectsAt() won't work for me

theboyl theboyl

2016/12/23

#
Hello all, my code is not working in the newest Greenfoot version. Could someone look it up and maybe have an answer for me? It underlines the "Wuerfel.class" and says: "Incompatible types: Inferred types does not conform to equality constraint(s)".
List<Actor> wuerfel = getWorld().getObjects(Wuerfel.class);
        Wuerfel wu  = (Wuerfel) wuerfel.get(0);
        if(testeSpieler() && wu.augen == 6 && Greenfoot.mouseClicked(this))
        {
            setLocation(4,10);
            setRotation(270);
        }
danpost danpost

2016/12/23

#
I think you only need change 'Actor' in the first line to 'Wuerfel'. However, if that does not work, try this in place of your first two lines:
Wuerfel wu = (Wuerfel)getWorld().getObjects(Wuerfel.class).get(0);
You need to login to post a reply.