mateport.blogg.se

Greenfoot world api
Greenfoot world api











greenfoot world api

Objects of classes listed first in the parameter list willĪppear on top of all objects of classes listed later. The order of objects of the same class cannot be Paint order is specifiedīy class: objects of one class will always be painted on top of objects

greenfoot world api

Public void setPaintOrder(. classes) Set the paint order of objects in the world. Public int getCellSize() Return the size of a cell (in pixels). Public int getHeight() Return the height of the world (in number of cells). Public int getWidth() Return the width of the world (in number of cells). If there is no background image at the location it Throws: - If the location is not within the worldīounds. Parameters: x - The x coordinate of the cell. Get the background image for the world and paint on that. Int y) Return the color at the centre of the cell. Public GreenfootImage getBackground() Return the world's background image. Throws: - If the image can not be loaded. Parameters: filename - The file holding the image to be shown A pattern showing the cells canĮasily be shown by setting a background image with a size equal to the Throws Set a background image for the world from an image file. Public final void setBackground( filename) Parameters: image - The image to be shown See Also: setBackground(String) A pattern showing the cells can easily be shown by setting aīackground image with a size equal to the cell size. Public final void setBackground( GreenfootImage image) Set a background image for the world. bounded - Should actors be restricted to the world boundary? Method Detail worldHeight - The height of the world (in cells). Parameters: worldWidth - The width of the world (in cells). The option of creating an unbounded world, which actors can move outside Size of each cell (in pixels) must be specified. The size of the world (in number of cells) and the cellSize - Size of a cell in pixels.īoolean bounded) Construct a new world. Methods inherited from class Ĭlone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait This method is called by the Greenfoot system when the execution has Set the paint order of objects in the world. 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.

greenfoot world api

Return the width of the world (in number of cells). Get all the objects in the world, or all the objects of a particular class. Return the height of the world (in number of cells). Return the color at the centre of the cell. Version: 2.4 Author: Poul Henriksen, Michael Kolling See Also: Actor The world background can be decorated with drawings or images. Use smaller cells (down to single pixel size) to achieve fine-grained The representations of objects in a single cell. Simple scenarios may use large cells that entirely contain The size of cells can be specified at world creation time, and is constantĪfter creation. It is a two-dimensional grid ofĪll Actor are associated with a World and can get access to the world object. SUMMARY: NESTED | FIELD | CONSTR | METHOD













Greenfoot world api