July 24

July 23 July 25

2019-07-24-IfFinal

2019-07-24-LoopsFinal

 

Java Review in Greenfoot context

Here are Greenfoot Classes and methods to pay particular attention to:

  • World: there is exactly one instance of World; it provides the “playing field” for the Actors. Methods we used:
    • World( width, height, cellsize ) initializes the World
    • removeObject( object ) erases a specific object from the World
  • Actor: everything else in your Greenfoot project is some kind of Actor; that is, classes you create that inherit from Actor. Methods we used:
    • act(): we must define this method for each Actor child class we define to tell the object what to do for each “tick” of the World “clock”.
    • move( step ) moves an Actor a given number of steps
    • turn( degrees ) changes the direction the Actor is pointing (and moving)
    • getWorld() gets the World object so we can tell it to do something
  • Greenfoot: this provides access to system items such as the keyboard, the mouse, etc. Method we used:
    • isKeyDown( key ) tells us whether a particular key is pressed

More useful Greenfoot classes! — Edit / Import class

Double-click the yellow buttons to add them to your project!

Also helpful:

Greenfoot Wombat Slides

User Contributions at Greenfoot Website

If_Exercise

  • Download
  • Unzip
  • Follow directions in IfExercise class
  • Test!!!
  • Zip and send to me
  • Due at end of class

11:20?? Lunch

2:20 — Please fill out the feedback form for today’s class.

Homework

Prepare for the quiz in any way helpful to you
and / or
Make a Greenfoot character that follows the mouse around.

July 23 July 25