Hello,
i need some help :/
pls have understanding if my mistake are very heavy, i just started working with greenfoot.
I want an Actor (Brocken) make divide hisself into 2 smaller "Brockens" when he gets hit by the "Kugel"
public class Brocken extends Actor
{
public int size;
public Brocken()
{
size = 50;
}
public void setSize(int size)
{
this.size = size;
GreenfootImage image = getImage();
image.scale(size, size);
}
public void act()
{
treffen();
}
public void treffen() {
Actor a = this.getOneIntersectingObject(Kugel.class);
if( a != null)
{
this.getWorld().removeObject(a);
zerbrechen();
}
}
public void zerbrechen()
{
int r = getRotation() + Greenfoot.getRandomNumber(45);
Brocken a1 = new Brocken();
Brocken a2 = new Brocken();
getWorld().addObject(a1, getX(), getY());
getWorld().addObject(a2, getX(), getY());
a1.setSize(size/1.6);
a2.setSize(size/1.6);
a1.setRotation(r+60);
a2.setRotation(r-60);
a1.move();
a2.move();
getWorld().removeObject(this);
}
}
It says:
method setSize in class Brocken cannot be applied to given types;
required: int; found: double; reason: actual argument double cannot be converted to int by method invocation conversion
Any ideas?

