I dont have any code because im pretty lost
/** chase */ // the first code line below does what is described in the following commented lines // determine shortest turn direction to face chased // int angleDiff = getRotation()-(int)(Math.atan2(dy, dx)*180/Math.PI); // range: -359 to 359 // int anglet = (angleDiff+360+180)%360-180; // range: -180 to 179 (sign is turn direction) // turn and move // turn(16*rate*(int)Math.signum(anglet)); turn(16*rate*(int)Math.signum((getRotation()-(int)(Math.atan2(dy, dx)*180/Math.PI)+540)%360-180)); move(rate/8, getQR()); // between 'move(0.1)' to 'move(0.4)' for a non-QActor, which is not possible
private GreenfootImage originalImage; private int imageSizePct = 100;
public Fish() { originalImage = getImage(); }
public void grow(int pctChange) { imageSizePct += pctChange; GreenfootImage img = new GreenfootImage(originalImage); img.scale(img.getWidth()*imageSizePct/100, img.getHeight()*imageSizePct/100); setImage(img); }
public MyWorld()
new Fish()
Fish fish = new Fish();
addObject(new Fish(), 0, 0);