Class City

java.lang.Object
  extended by greenfoot.World
      extended by City

public class City
extends greenfoot.World

Class City represents the world from which Snail is trying to escape. Players must type the letter they see on top of the screen. The more they type correctly the faster Snail moves.

Version:
12.06.2015
Author:
Maria - Despoina Gkaintatzi

Constructor Summary
City(Snail snail)
          Constructor for objects of class City.
 
Method Summary
 void act()
          Act method for class City.
 void changeButtonColor()
          Changes the colour of the button to be typed.
 void changeCityImage()
          Changes the background image according to the level, when passes to the next level
 void checkClick()
          Removes message if someone clicks in it.
 void checkLives()
          Checks if the player has used all the lifes he has and ends the game.
 void gameOver(java.lang.String message)
          This method is called when the game is over to display the final score.
 Counter getLifeCounter()
          Returns the lifeCounter.
 Counter getScoreCounter()
          Returns the scoreCounter.
 void prepare()
          Initiates components that will be included in the constructor
 void resetButtonColor(java.lang.String letter)
          Resets the colour of the button after the correct key is typed.
 void scrollBackground()
          Makes background scroll
 Button whichButton(java.lang.String letter)
          Finds the correct key according to the given letter.
 
Methods inherited from class greenfoot.World
addObject, getBackground, getCellSize, getColorAt, getHeight, getObjects, getObjectsAt, getWidth, numberOfObjects, removeObject, removeObjects, repaint, setActOrder, setBackground, setBackground, setPaintOrder, showText, started, stopped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

City

public City(Snail snail)
Constructor for objects of class City.

Method Detail

act

public void act()
Act method for class City.

Overrides:
act in class greenfoot.World

changeButtonColor

public void changeButtonColor()
Changes the colour of the button to be typed.


changeCityImage

public void changeCityImage()
Changes the background image according to the level, when passes to the next level


checkClick

public void checkClick()
Removes message if someone clicks in it.

Parameters:
actor(Actor) - the actor to be removed.

checkLives

public void checkLives()
Checks if the player has used all the lifes he has and ends the game.


gameOver

public void gameOver(java.lang.String message)
This method is called when the game is over to display the final score.

Parameters:
message(String) - the message to be displayed when the game is over.

getLifeCounter

public Counter getLifeCounter()
Returns the lifeCounter.

Returns:
Counter lifeCounter

getScoreCounter

public Counter getScoreCounter()
Returns the scoreCounter.

Returns:
Counter scoreCounter

prepare

public void prepare()
Initiates components that will be included in the constructor


resetButtonColor

public void resetButtonColor(java.lang.String letter)
Resets the colour of the button after the correct key is typed.


scrollBackground

public void scrollBackground()
Makes background scroll


whichButton

public Button whichButton(java.lang.String letter)
Finds the correct key according to the given letter.

Parameters:
letter(String) - the letter of the key in question.