![]() Exercise 2.11: Let crab run to edge of the screen or move it there. ![]() boolean atWorldEdge() – method will return either true (Yes!) or false (No!).Calling a method with a non-void return type asks a question.Calling a method with a void return type issues a command.Non-void Return Type From Introduction to Programming with Greenfoot by Michael Kölling Used with permission crab) inherits all the abilities (methods) from its superclass (i.e. Actors can’t leave the world and fall off it edge.Find at least five different error messages.ĭealing with Screen Edges From Introduction to Programming with Greenfoot by Michael Kölling Used with permission Exercise 2.8: Make various changes to cause different error messages.Exercise 2.7: Remove semicolon after move() and re-compile.Highlighted line may be the line after the error as in a “ expected” message.Clicking button displays additional information about error.Question mark button displays to the right of the error message.Syntax Errors From Introduction to Programming with Greenfoot by Michael Kölling Used with permission Move expects no parameters – just executes Turn requires additional information – an Integer value Multiple Instructions in Method From Introduction to Programming with Greenfoot by Michael Kölling Used with permission Multiple instructions executed in sequence (one after the other in ordered written) Exercise 2.6 Use both a move() and turn(N) instruction. Exercise 2.5: How can you make the crab turn left?.Must re-compile every time change the code. Exercise 2.4: Replace move()instruction with turn(5).'angle' is degrees towards the right (clockwise).Turning From Introduction to Programming with Greenfoot by Michael Kölling Used with permission Exercise 2.3: Place multiple crabs into the world. Compile and place a crab into the world and click the Act and Run buttons. From Introduction to Programming with Greenfoot by Michael Kölling Used with permission Exercise 2.2: Change the act method in your crab class to include the move() instruction. Method call is an instruction telling the crab to do it. ASTEROIDS SCREEN WRAP GREENFOOT HOW TOMethod is an action than an object (crab) knows how to do. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |