My collision is not being detected

It compiled and it is still wrong

My collision is not being detected

This page is part of Intro to Java with Greenfoot. It assumes you have reached lesson 4.4. Opening it is not counted against you and is not tracked as progress.

What it actually means

Either the actors never actually overlap, or the check is looking for the wrong thing.

The usual causes

Ranked by how often each one turns out to be the answer. Work down the list.

  1. The class named in isTouching is not the class of the thing you are hitting.
  2. The actor moves so far each frame that it jumps straight over the target.
  3. The check is not inside act(), so it only ever ran once.
  4. One of the actors was already removed from the world.

How to fix it

Press Act one frame at a time and watch the two actors approach. If they pass through each other in a single frame, reduce the move distance. If they visibly overlap and nothing happens, check the class name in the isTouching call.

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]