Field

public class Field(source)

A single field in a 2D world where field entities can be placed.

See also

Constructors

Link copied to clipboard
public void Field(KarelWorld world, int x, int y)
Constructs a field with the given coordinate and no entities on it.
public void Field(KarelWorld world, int x, int y, List<FieldEntity> entities)
Constructs a field with the given coordinate and the specified entities on it.

Properties

Link copied to clipboard
public final List<FieldEntity> entities
Contains all entities that are on this field.
Link copied to clipboard
@Nullable()
public @Nullable() Color fieldColor
Link copied to clipboard
public final KarelWorld world
Link copied to clipboard
public final int x
Link copied to clipboard
public final int y

Functions

Link copied to clipboard
Returns the entities that are on this field.
Link copied to clipboard
@Nullable()
public @Nullable() Color getFieldColor()
Returns the background color of this Field.
Link copied to clipboard
Returns the world of this field.
Link copied to clipboard
public int getX()
Returns the x-coordinate of this field.
Link copied to clipboard
public int getY()
Returns the y-coordinate of this field.
Link copied to clipboard
public void setFieldColor(@Nullable() @Nullable() Color fieldColor)
Sets the background color of this Field to the specified color.