Class Snail

java.lang.Object
  extended by greenfoot.Actor
      extended by SmoothMover
          extended by Snail

public class Snail
extends SmoothMover

This class creates a Snail object.

Version:
12.06.2015
Author:
Maria - Despoina Gkaintatzi

Field Summary
static int LEVEL
           
 
Constructor Summary
Snail(int size)
          Constructor for the objects of class Snail.
Snail(int size, Vector speed)
          Constructor for the objects of class Snail.
 
Method Summary
 void act()
          Act - do whatever the Snail wants to do.
 void changeImage()
          Changes the image of the Snail to create a movement effect.
 void checkKeys()
          Checks whether the appropriate key is being pressed and acts accordingly.
 void checkNextLevel()
          Checks if Snail has reached the desirable speed to get to the next level.
 void makeSmoke()
          Put out a puff of smoke (only on every second call).
 void makeSound(boolean correct)
          Makes a sound every time a key is pressed.
 void resetLives()
          Resets life counter to five.
 void setSize(int size)
          Sets the size of this snail.
 void showEncouragementMessage(java.lang.String message)
          Displays a message from the snail to the user.
 
Methods inherited from class SmoothMover
accelerate, addForce, getExactX, getExactY, getMovement, getSpeed, increaseSpeed, move, moveOneStep, setLocation, setLocation, setMovement, stop
 
Methods inherited from class greenfoot.Actor
addedToWorld, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWorld, getX, getY, intersects, isAtEdge, isTouching, move, removeTouching, setImage, setImage, setRotation, turn, turnTowards
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL

public static int LEVEL
Constructor Detail

Snail

public Snail(int size)
Constructor for the objects of class Snail.

Parameters:
size(int) - the desirable size

Snail

public Snail(int size,
             Vector speed)
Constructor for the objects of class Snail.

Parameters:
size(int) - the desirable size
speed(Vector) - the speed of the snail
Method Detail

act

public void act()
Act - do whatever the Snail wants to do. This method is called whenever the 'Act' or 'Run' button gets pressed in the environment.

Overrides:
act in class greenfoot.Actor

changeImage

public void changeImage()
Changes the image of the Snail to create a movement effect.


checkKeys

public void checkKeys()
Checks whether the appropriate key is being pressed and acts accordingly.


checkNextLevel

public void checkNextLevel()
Checks if Snail has reached the desirable speed to get to the next level.


makeSmoke

public void makeSmoke()
Put out a puff of smoke (only on every second call).


makeSound

public void makeSound(boolean correct)
Makes a sound every time a key is pressed. The sound differs according to whether the key is the key in question.

Parameters:
correct(boolean) - true if the key is correct

resetLives

public void resetLives()
Resets life counter to five.


setSize

public void setSize(int size)
Sets the size of this snail.

Parameters:
size(int) - the desirable size

showEncouragementMessage

public void showEncouragementMessage(java.lang.String message)
Displays a message from the snail to the user.