Will somebody send me the complete correct code for Eating worms. Code 3.2 as shown isn't sufficient for me I fear because I keep getting errors which I don't understand.
What is Code 3.2 as shown (list code on your post), and exactly what error message are you getting (copy and paste on your post)?
It would also help if you made a reference to what line number (in the class) the code you post starts at.
I have the book here, and the sample looks fine to me. What are the errors you are getting, exactly? With that info, we can help to track down the problem, but here's a couple of thoughts:
The book chapter is similar to the online tutorials, but the online tutorials use a slightly different scenario. If you're using the book, make sure you started with the little-crab scenario that comes with the book, not the one that's online
The code shown in 3.2 still needs the class declaration around it. That is, the code in 3.2 replaces the middle of 3.1 (the public void act bit), but you still need the outermost parts from 3.1
Looking at the code you provided, it appears you mixed up your classes. You show here the Worm class extending the Crab class, where Worm should extend Actor, and the code within the act() method provided should probably be in the Crab class (I do not believe that you want the worms moving around your world). The act() method for the Worm class should probably be empty (or non-existant).
Many thanks to you both and danpost in particular (I like your fractal) - I see my error(s) and I'll correct them and move on or report back if I'm stuck.