I know that you have to use getbackground () drawline for a straight line with the world class if I understand it but I do not know how to start it
Thank you for your help
getBackground().drawPolygon(int [] {5,10,15,20},int [] {25,30,35,40},5);
getWorld().getBackground().drawLine(getX(), getY(), getX()+dx, getY()+dy);
if(Greenfoot.mouseMoved(null)) { MouseInfo mouseInfo = Greenfoot.getMouseInfo(); setLocation(mouseInfo.getX(), mouseInfo.getY()); }
getWorld().getBackground().drawLine(getX(), getY(), getX()+dx, getY()+dy);
if (Greenfoot.mouseMoved(null)) { MouseInfo mouseInfo = Greenfoot.getMouseInfo(); int x=getX(), y=getY(), dx=mouseInfo.getX()-x, dy=mouseInfo.getY()-y; getWorld().getBackground().drawLine(x, y, x+dx, y+dy); setLocation(x+dx, y+dy); }