Remember that Greenfoot.isKeyDown() checks if a key is currently being pressed and that our ScrollWorld has two public constants WIDTH and HEIGHT. Assuming our image is 100 pixels wide by 50 high, what test conditions do we write for the following:

Logical Tests

Keypress

Logical Operator

Edge Check

Greenfoot.isKeyDown("up")

Greenfoot.isKeyDown("down")

Greenfoot.isKeyDown("left")

Greenfoot.isKeyDown("right")

Writing the Code

Once we have the test conditions for our if statements, we can complete the code

Save a copy of your scenario with all the changes made to upload to Canvas as part of the next lab.

We will be adding more code to these files in subsequent exercises, so it is not time to submit them to Canvas yet. However, it is a good idea to have a backup copy in case of problems later in development.