!7 static int points; static ImageSurface is; static int w = 500, h = 500; static int rw = 50, rh = 50, border = 10; static int x1, y1; p-substance { nextImage(); } svoid nextImage { RGBImage img = rgbImage(Color.white, w, h); x1 = random(border, w-rw-border); y1 = random(border, h-rh-border); rgbFillRect(img, x1, y1, rw, rh, Color.red); bool first = is == null; is = showImage(is, img); if (first) { onLeftClick(is, voidfunc(Pt p) { if (new Rect(x1, y1, rw, rh).contains(p)) { ++points; print("Points: " + points); nextImage(); } }); disableImageSurfaceSelector(is); } }