The question was, "write a method which initializes a 2D target array (assuming all other classes have been imported and given), and all targets should be stationary."
and this was my method i wrote:
public void initializeTargetArray(Target[][] targets) {
int row = targets.length();
int col = targets[0].length;
for(int i = 0; i < row; i++)
for (int j = 0; j < col; j++)
targets[i][j] = new Target(Target.STATIONARY, false);
}
Now my question how do I initialize an array similar to the method above for a different question?
Quote
Write a method which initializes an array (You can assume that the 2D array itself (but not the Target
objects inside) is already initialized), where the game level stage is now set:
Game level 1 - all targets are stationary,
Game level 2 - For even numbered rows, targets at even numbered columns are stationary, targets at odd
numbered columns are movable. For odd numbered rows, targets at odd numbered columns are
stationary, targets at even numbered columns are movable.
Game Level 3 - All targets are movable.
public void initializeTargetArray(Target[][] targets, int gameLevel) {
//*** Finish this method. ***//
Attached File(s)
-
Part b.pdf (177K)
Number of downloads: 50
This post has been edited by jon.kiparsky: 11 April 2014 - 11:27 PM
Reason for edit:: Keep text in-line, it's easier for everyone.

New Topic/Question
Reply


MultiQuote





|