April 2019
Intermediate to advanced
360 pages
9h 17m
English
Our game-level creation system starts with the abstract BaseLevel class. This class implements Java's Cloneable interface. There are three class variables that will be part of each game level that's created—levelName, numberOfNPCs, and numberOfTokens. Following the class variables are the three accessor methods, one for each of the variables:
public abstract class BaseLevel implements Cloneable { public String levelName; public int numberOfNPCs; public int numberOfTokens; // accessor methods public String getLevelName() { return levelName; } public int getNumberOfNPCs() { return numberOfNPCs; } public int getNumberOfTokens() { return numberOfTokens; }
The second half of the BaseLevel class contains the mutator ...
Read now
Unlock full access