So I've been working on a game in greenfoot for my java class and I've come to a new crossroad that I cannot understand what to do with.
I have an actor named Teemo. Teemo has a subclass named Dart. My goal is to make it so when q is pressed on the keyboard A dart is created at teemo's position and flies the direction he is looking to the edge of the screen.
Within the class teemo I have this:
and this:
What I 'thought' this would do would create actor Dart on the position of teemo. I believe I know how to make the dart move to the edge and remove itself but I cannot get it to be created. Thanks ahead of time.
public void animate()
{
if (Greenfoot.isKeyDown("q"))
{
firedart();
} public void firedart()
{
int x = getX();
int y = getY();
addObject(new dart(x,y));
}

