You must login or register to participate.

Description

Learn Java, the language of the internet!  No prior experience required!

To get started, JOIN THIS GROUP. Then click on the Activities tab. Next complete each of the Activities. And finally compete in the Challenge Activity.

Click the Details tab for more information. After you've completed this path, if you've enjoyed it and want to go further, check out some of the other programming learning paths, including Make a 3D Video Game and Building Flashy Websites with JavaFX.

Learning Path and Challenge Activity Provided By

FreshBrain is proud to sponsor the "Learn Java Programming" learning path and challenge activity.

More Support Classes - A look at SmoothMover

More Support Classes - A look at SmoothMover

Description

In this activity you'll learn about a Greenfoot support class that can move smoothly across a world.  Smoothly moving actors will be useful in future activities and games development.

Basic Steps

  1. Start up Greenfoot.
  2. From the Scenario menu, select the scenario called Monsters.
  3. Create a new subclass of class Actor called SmoothMover. Open the editor and copy the source code for SmoothMover. Compile to make sure this part is correct.
  4. If you got an error “cannot find symbol - class Vector not found” you’re on the right track! Also notice that in the editor window, the symbol Vector is highlighted. This is one of the features of the Greenfoot IDE where it can help you debug your errors. If you take a peek at the code for SmoothMover, you’ll notice it makes use of a class called Vector. This is a Greenfoot Support class, not a standard Java class and is not part of the Actor hierarchy. We’ll need to copy and create this class in our own library. You’ll likely want to do this with other classes in the future.
  5.  From the “Edit” menu, select “New Class…”. Name it Vector. A new class will appear in the box “Other classes” with this name. Open the editor for Vector and copy and paste the source code for Vector. Compile all. You should no longer see the error message.
  6. Create a new monster class (SmoothMonster?) by subclassing SmoothMover. You can use your own image, select from the image library or try this image.
  7. Using the editor, add these constructors for SmoothMonster
  8. To make this new class do something, you will need to modify the act() method.  Again, use the editor for SmoothMonster. This time we'll ask you to show your creativity instead of  yet-another-cut-and-paste.
  9. Compile, add a SmoothMonster and run the scenario.
  10. Read Digging Deeper on Vector and SmoothMover  to learn about Greenfoot support classes and the Vector  and SmoothMover classes.
  11. Please read the following instructions for preparing your work prior to submission to this activity.
  12. Select Scenario -> Export.  Choose  Webpage (from Publish, Webpage, Application) and select a location to save the scenario as an applet (a jar file and a .html file).
  13. Export this as a jar file and submit for this activity.

Suggested Activity Tools

Resource Links

Recent Submissions

icon

Monsters 3

0
August 16, 2009 by Ryanh423
icon

Activity 6

0
August 8, 2009 by sunshinehombre
icon

Smooth Monsters (fixed)

0
August 3, 2009 by zackiddy
icon

GRAH1

0
August 2, 2009 by cheez246890
More Submissions

Activity Forum

There are currently no forum topics posted.