songrefa.blogg.se

Greenfoot actor
Greenfoot actor






That an object's image overlaps horizontally. Public int getWidth() Return the width of the object. Public int getRotation() Return the current rotation of the object. Returns: An object at the given location, or null if none found. cls - Class of objects to look for (passing 'null' will find all objects). dy - y-coordinate relative to this objects location. Parameters: dx - X-coordinate relative to this objects location. Object of the specified class resides at that location, one of them will (and its subclasses) by supplying the 'cls' parameter. Objects found can be restricted to a specific class cls) Return one object that is located at the specified cell (relative to this Protected Actor getOneObjectAtOffset(int dx, Protected Actor getOneIntersectingObject( cls) Return an object that intersects this object.

greenfoot actor

Parameters: r - Radius of the cirle (in pixels) cls - Class of objects to look for (passing 'null' will find all objects). Object's centre is less than or equal to r. cls) Return all objects within range 'r' around this object.Īn object is within range if the distance between its centre and this Returns: List of objects at the given offset. cls - Class of objects to look for (passing 'null' will find all cls) Return all objects that intersect the given location (relative to this diagonal - If true, include diagonal steps. Parameters: distance - Distance (in cells) in which to look for other objects. Inspect four cells, (1,true) will inspect eight cells. Thus, a distance/diagonal specification of (1,false) will Steps may be only in the four mainĭirections, or may include diagonal steps, depending on the 'diagonal' Thus, it is most useful in scenarios where objects are contained in aĪll cells that can be reached in the number of steps given in 'distance'įrom this object are considered. Method considers only logical location, ignoring extent of the image. cls) Return the neighbours to this object within a given distance. Parameters: cls - Class of objects to look for (passing 'null' will find all objects). NOTE: Does not take rotation into consideration. Graphical extent of objects into consideration. Protected getIntersectingObjects( cls) Return all the objects that intersect this object. Modified to change the object's appearance. Public greenfoot.GreenfootImage getImage() Returns the image used to represent this Actor. Throws: - If there is no world instantiated. Returns: The height of the object, or -1 if it has no image. That an object's image overlaps vertically. Public int getHeight() Return the height of the object. Parameters: world - The world the object was added to. This method can be overridden to implementĬustom behavoiur when the actor is inserted into the world. Protected void addedToWorld(greenfoot.World world) This method will be called by the Greenfoot system when the object hasīeen inserted into the world. At each action step in the environment,Įach object's act method is invoked, in unspecified order. Public void act() The act method is called by the greenfoot framework to give objects aĬhance to perform some action. Methods inherited from class Ĭlone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait Set an image for this object from an image file. Set the image for this object to the specified image. Return the y-coordinate of the object's current location.Ĭheck whether this object intersects with another given object. Return the x-coordinate of the object's current location.

greenfoot actor

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 Return an object that intersects this object. Return all objects within range 'r' around this object. Return all objects that intersect the given location (relative to this Return the neighbours to this object within a given distance.

greenfoot actor

Return all the objects that intersect this object. Returns the image used to represent this Actor. This method will be called by the Greenfoot system when the object has The act method is called by the greenfoot framework to give objects a The method here is empty, and subclasses normally provide their own implementations. Is called when the 'Act' or 'Play' buttons are activated in the Greenfoot interface. One of the most important aspects of this class is the 'act' method. Public abstract class Actor extends Īn Actor is an object that exists in the Greenfoot world.Įvery Actor has a location in the world, and an appearance (that is:Īn Actor is not normally instantiated, but instead used as a superclass








Greenfoot actor