The following are occasions where a loop is employed:
Often, a for loop is used to add a large number of one type object into the world, or to iterate through an array to determine what actor to place in what cell. Sometimes a 'while' loop is used to make sure that objects placed randomly into the world do not end up on top of other objects already in the world.
The following are occasions where a loop is employed:
Often, a for loop is used to add a large number of one type object into the world, or to iterate through an array to determine what actor to place in what cell. Sometimes a 'while' loop is used to make sure that objects placed randomly into the world do not end up on top of other objects already in the world.
Sorry but I new to Greenfoot and programing in general. I need for statement for a school project game. We haven't learnt arrays. Could you give an example of a for statement with using a array.
A good source of information pertaining to programming in java can be found in the Java tutorials. The second section on the left titled in red (Trails Covering the Basics) is the place to start (especially the sub-section called 'Learning the Java Language'.