Transitioning from Scratch to Greenfoot - using the "Sprite" subclass

The "Sprite" subclass exists to allow for an easier transition from Tile Based programming in Scratch to Java syntax in Greenfoot. The Sprite subclass of Actor contains the following methods and functions with "Scratch Like" commands to allow the student programmer to use familiar vocabulary in building several beginning Greenfoot projects. As the student becomes more familiar with Java syntax and the basic Actor methods, the student may begin to define their own functions and move away from the Sprite subclass.

An example would be the command "Move 10 Steps" in Scratch. Greenfoot does not have a direct equivalent method in the Actor class. Because "Move Steps" needs to account for the direction of the Actor and use radians, sin, and cosine, pre-defining a "MoveSteps" method will make for an easier transition to Greenfoot for the young programmer.

The following Methods exist in the Sprite subclass:

MoveSteps()
Turn()
GoTo(x, y)
IfOnEdgeBounce()
goToMouse()
pointAtMouse()
EdgeTransfer()

The following Functions exist in the Sprite subclass:

MouseX() -> Returns the Mouse X position
MouseY() -> Returns the Mouse Y position

spriteWorld

For each of these beginning projects, the student may download and use the "spriteWorld" scenario as the template. "spriteWorld" provides the Sprite and Message subclasses for the student to build their programs.

Download "spriteWorld" (in zip format)

Email Mr.Michaud

Copyright ©2011 Mr. Michaud.