Main revision sheet
In Greenfoot IDE you can press Ctrl + Space, to see a list of methods within that class (and Actor or World). If the method you wish to use is not in that Class then type the Class name, followed by a space, then press Ctrl + Space e.g. Greenfoot.
Left image show the error message and right image shows correction.
Look for the colours (layers of the cake), open { and closing } brackets are needed for:
if (grey)
methods (yellow)
classes (green)
Open { on if was missing
The dot is missing between the Class and the method.
The . (dot) between Greenfoot and isKeyDown() method has been added
Classes need to start with capitals (e.g. Greenfoot), methods start with lowercase and use camelCase (e.g. isKeyDown(String)
getRandomNumber(int) had a captial to start the method
Closing braket missing from method call.
Closing bracket of turn method missing
Opening bracket of method call missing
( Opening bracket of move missing
If you attempt the Counter, and your code doesn't work you will get zero marks. So make sure you remove errors or comment out the code with // to make the instructions comments.
Creating a new instance (version) of a class needs to be written:
ClassName variable = new ClassName();
This runs the constructor in that class when the new object is created.
() added to create a new Counter
TIP: Can't remember this call? Always go to the World Class e.g. Ground for that game, then look at the prepare() method to see how new objects are created.
new is missing from creating the object
new added to create a new Counter
TIP: Can't remember this call? Always go to the World Class e.g. Ground for that game, then look at the prepare() method to see how new objects are created.
private and non static used for any attributes (variables) in the Counter Class.
public static used on totalCount
TIP: Remember all attributes used to update the Counter need these. In other briefs this has been more than one attribute, e.g.
value and target (see main revision sheet)