The sooner you fall behind, the more time you’ll have to catch up.
— (unknown)
Continuing straight on from the last episode, we now make the turtle turn at the edge of the world.
Concepts discussed: method return value, boolean, if statement
Nothing to download – we continue with the scenario from last time.
I like the color coding feature in Greenfoot … it seems to be a very affective way of encouraging the proper nesting of blocks and is also quite affective at pointing out mismatched braces.
Report comment
This episode carefully explained why it was good to turn in small steps but not why it was possible for the turtle to apparently ignore the move (when it was at the edge of the world) and to carry out the turn. Perhaps a mention of this iin this episode would be helpful – even if it is already covered somewhere else.
Report comment
Yes, you’re right, sorry.
The story is this: Actors cam, by default, not leave the world. If they are at the edge and attempt to move, the move will just hav no effect. (They are just pushing against a wall.)
So the turtle actually tries to move at every step, but as long as it is facing the edge this has no effect. Once it has turned around sufficiently, the move works again.
Report comment
Mik, thanks for these video’s i just started going through them and they are GREAT.
-Doug
Report comment
I have always tried to learn programming and your site is by far the best tutorial i have seen.
Many thanks!
Report comment
I went to the Animal class documentation, but it only shows 1 method, not three. I only showed the void act() method.
Report comment
This post title says JOC #5, but the video is JOC #4…am I missing something?
Report comment
Whoops. Now it’s correct. I must’ve been confused
Report comment
For me, it says that my coding doesn’t recognize if (atWorldEdge()) ..
Report comment
Mine also says that my coding doesnt recognize the (atWorldEdge()) and i have exactly what is on your screen…
Report comment