Catch The Apple: a Greenfoot project

Catch The Apple

Greenfoot project 2 · all projects · part of Intro to Java with Greenfoot · not graded, and not tracked as progress

Keyboard control, a score that goes up, and spawning objects at random.

Before you start: finish lesson 4.4. That is the last thing this project needs. Starting earlier is allowed and you will hit a method nobody has shown you yet.

Tutorial. Put this window on one side of your screen and Greenfoot on the other, then build along with it.

Get the starter files

Methods you will use

Every one of these appears in the build. The lesson number is where the course teaches it, so if a row looks unfamiliar you have not missed anything, you just have not got there yet.

Method Taught in What it does here
Greenfoot.isKeyDown("left") 2.7 move the basket
setLocation(getX(), getY() + 2) 1.4 make things fall
getWorld().removeObject(this) 3.7 an actor deletes itself
isTouching(Apple.class) 4.4 caught it
removeTouching(Bomb.class) 4.4 and the bad ones
Greenfoot.getRandomNumber(600) 2.6 spawn somewhere unpredictable
private int score, lives, time 3.8 three things to remember at once
showText("Score: " + score, 100, 20) 6.7 show all three

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]