public class LegoContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Obstacle |
box
Box obstacle.
|
static Obstacle |
channel
Channel obstacle.
|
Modifier and Type | Method and Description |
---|---|
static void |
setLocation(int x,
int y)
Sets the location of the playground (pixel coordinates of the upper left vertex).
|
static void |
setStartDirection(double direction)
Sets the EV3 starting direction (zero to EAST).
|
static void |
setStartPosition(int x,
int y)
Sets the EV3 starting position (x-y-coordinates 0..500, origin at upper left).
|
static void |
showNavigationBar()
Shows the navigation bar of the GameGrid and runs the simulation immediately.
|
static void |
showNavigationBar(boolean doRun)
Shows the navigation bar of the GameGrid.
|
static void |
useBackground(java.lang.String filename)
Use the give image as background (playground size 501 x 501).
|
static void |
useObstacle(Obstacle obstacle)
Uses the given obstacle at the center of the playground.
|
static void |
useObstacle(java.lang.String filename,
int x,
int y)
Defines the give images as an obstacle.
|
public static Obstacle box
public static Obstacle channel
public static void useBackground(java.lang.String filename)
filename
- the image file to use as background.public static void setStartPosition(int x, int y)
x
- the x-coordinate of the starting positiony
- the y-coordinate of the starting positionpublic static void setStartDirection(double direction)
direction
- the starting direction in degrees)public static void setLocation(int x, int y)
x
- the x-pixel-coordinate of the upper left vertex (positive to the right)y
- the y-pixel-coordinate of the upper left vertex (positive to the bottom)public static void useObstacle(java.lang.String filename, int x, int y)
filename
- the image file of the obstaclex
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static void useObstacle(Obstacle obstacle)
obstacle
- the obstacle to use.public static void showNavigationBar(boolean doRun)
doRun
- if true, runs the simulation immediatetly; otherwise the start
button must be hit to run the simulationpublic static void showNavigationBar()