

Return a random number between 0 (inclusive) and limit (exclusive).Ĭheck whether a given key is currently pressed down. Return an object with information about the mouse state. Get the most recently pressed key since the last time this method was called. The size of one time step is defined by the speed slider. Return a string representation of this mouse event info.ĭelay execution by a number of time steps. The current y position of the mouse cursor. The current x position of the mouse cursor. The number of mouse clicks of this mouse event. The number of the pressed or clicked button (if any). Return the actor (if any) that the current mouse behaviour is related to. Set the paint order of objects in the world.Ĭalled by the Greenfoot system when execution has started.Ĭalled by the Greenfoot system when execution has stopped. Set a background image for the world from an image file. Set the act order of objects in the world. Get the number of actors currently in the world. Return the width of the world (in number of cells).

List getObjectsAt(int x, int y, Class cls) Return the height of the world (in number of cells). Return the color at the center of the cell. Void addObject(Actor object, int x, int y) World(int worldWidth, int worldHeight, int cellSize, boolean bounded)Ĭonstruct a new world with the option to create an unbounded world where actors can leave the world.Īct method for the world. Turn this actor to face towards a given location.Ĭlass World World(int worldWidth, int worldHeight, int cellSize) Turn this actor by the specified amount (in degrees). Set an image for this object from an image file. Set the image for this object to the specified image. Move this actor the specified distance in the direction it is currently facing. Protected boolean intersects(Actor other) Check whether this object intersects another given object. Return the y-coordinate of the object's current location. Return the x-coordinate of the object's current location. Return the world that this object lives in. Return the current rotation of the object.

Return one object that is located at the specified cell (relative to this objects location). Protected Actor getOneObjectAtOffset(int dx, int dy, Class cls) Return an object that intersects this object. Protected Actor getOneIntersectingObject(Class cls) Return all objects within range 'r' around this object. protected List getObjectsInRange(int r, Class cls) Protected List getObjectsAtOffset(int dx, Return all objects that intersect the given location (relative int dy, Class cls) to this object's location). Return the neighbours to this object within a given distance. Protected List getNeighbours(int distance, boolean diagonal, Class cls) Return all the objects that intersect this object. Protected List getIntersectingObjects(Class cls) Returns the image used to represent this Actor. This method is called by the Greenfoot system when the object has been inserted into the world. The act method is called by the Greenfoot framework to give objects a chance to perform some action. Provide information about the last mouse event. Used to communicate with the Greenfoot environment itself.Īctor methods are available to all actor subclasses. World methods are available to the world. Greenfoot API (v 2.4, for Greenfoot version 2.2.0 or newer) World
