Hello everyone.
Im very new and i have a problem..
I wanted to make a project where my rover can throw strawberrys which doesnt works...
Heres my implementation:
public void erdbeereWerfen()
{
if(anzahlErdbeere>0);
{Erdbeere wurfErdbeere = new Erdbeere();
if(Greenfoot.isKeyDown("e"))
wurfErdbeere.setLocation(getX(), getY()-2);
if(Greenfoot.isKeyDown("f"))
wurfErdbeere.setLocation(getX(), getY()+2);
if(Greenfoot.isKeyDown("r"))
wurfErdbeere.setLocation(getX()+2, getY());
if(Greenfoot.isKeyDown("q"))
wurfErdbeere.setLocation(getX()-2, getY());
}
}
so the other class is called "Erdbeere".
and as you can see the problem is my access to the other class.
so i wrote: wurfErdbeere.setLocation(getX(), getY()-2);
i rewrote the keyword "this" to "wurfErdbeere which is wrong..
so can anyone help me please?
