import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class MyWorld here. * * @author (your name) * @version (a version number or a date) */ public class Crop_Circle extends World { /** * Constructor for objects of class MyWorld. * */ public Crop_Circle() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(900, 600, 1); getBackground().drawImage(getCrop_Circle(400), 500, 100); prepare(); } private GreenfootImage getCrop_Circle(int size) { GreenfootImage image = new GreenfootImage(size, size); image.setColor(Color.BLACK); image.fillOval(0, 0, size, size); image.setColor(Color.WHITE); image.fillOval(0, size/4, size/2, size/2); image.setColor(Color.BLACK); image.fillOval(0, 20+size/3, size/4, size/4); return image; } /** * Prepare the world for the start of the program. * That is: create the initial objects and add them to the world. */ private void prepare() { Crop_Circle01 crop_Circle01 = new Crop_Circle01(); addObject(crop_Circle01, 280, 300); } }
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Crop_Circle01 here. * * @author (your name) * @version (a version number or a date) */ public class Crop_Circle01 extends Actor { /** * Act - do whatever the Crop_Circle01 wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { drawOval(); } private void drawOval() { GreenfootImage image = new GreenfootImage(400, 400); image.setColor(Color.BLACK); image.fillOval(0, 0, 400, 400); image.setColor(Color.WHITE); image.fillOval(25, 25, 350, 350); image.setColor(Color.BLACK); image.fillOval(150, 150, 100, 100); setImage(image); } }