java.lang.Objectgreenfoot.World
City
public class City
'City' acts as a container for all objects / "Actors" in the game (incl. map, HUD, etc.)
Constructor Summary | |
---|---|
City(java.lang.String name,
java.lang.String path)
Constructs a City. |
Method Summary | |
---|---|
void |
didIncrementDate()
This method is called when date is incremented (every 1 sec). |
void |
didMoveMapTo(int x,
int y)
This method is called when the map is moved. |
void |
didMoveViewportTo(int x,
int y)
This method is called when the minimap viewport has been moved. |
static City |
getInstance()
Returns an instance of City . |
void |
hideOverlay()
Hides the overlay. |
Hint |
hint()
Returns the active Hint . |
MenuBar |
menuBar()
Returns an instance of MenuBar . |
void |
removeHint()
Removes the active hint from view. |
int |
score()
Returns the city's current score. |
void |
setHint(Hint hint)
Sets the active hint. |
void |
setScore(int value)
Sets the city's score. |
void |
showOverlay()
Shows an overlay to fade out the screen. |
Methods inherited from class greenfoot.World |
---|
act, addObject, getBackground, getCellSize, getColorAt, getHeight, getObjects, getObjectsAt, getWidth, numberOfObjects, removeObject, removeObjects, repaint, setActOrder, setBackground, setBackground, setPaintOrder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public City(java.lang.String name, java.lang.String path)
Method Detail |
---|
public void didIncrementDate()
This method is called when date is incremented (every 1 sec).
This method tells Data
to write the latest statistics to the database and hints to the JVM to perform GC every 10 secs, and refreshes the HUD values every 1 sec.
public void didMoveMapTo(int x, int y)
This method is called when the map is moved.
(i.e. when the user scrolls the map).
Updates the viewport position on the minimap after the map has moved.
public void didMoveViewportTo(int x, int y)
This method is called when the minimap viewport has been moved.
(i.e. minimap has been clicked on)
public static City getInstance()
City
.
public void hideOverlay()
public Hint hint()
Hint
.
Hint
.public MenuBar menuBar()
MenuBar
.
public void removeHint()
public int score()
public void setHint(Hint hint)
hint
- The hint to be made active.public void setScore(int value)
An
- integer with the new score.public void showOverlay()
public void started()
World
from the Greenfoot framework. This is called when the game is started.
started
in class greenfoot.World
public void stopped()
World
from the Greenfoot framework. This is called when the game is stopped.
stopped
in class greenfoot.World