java.lang.Objectgreenfoot.Actor
SmoothMover
Snail
public class Snail
This class creates a Snail object.
| 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 |
|---|
public static int LEVEL
| Constructor Detail |
|---|
public Snail(int size)
size(int) - the desirable size
public Snail(int size,
Vector speed)
size(int) - the desirable sizespeed(Vector) - the speed of the snail| Method Detail |
|---|
public void act()
act in class greenfoot.Actorpublic void changeImage()
public void checkKeys()
public void checkNextLevel()
public void makeSmoke()
public void makeSound(boolean correct)
correct(boolean) - true if the key is correctpublic void resetLives()
public void setSize(int size)
size(int) - the desirable sizepublic void showEncouragementMessage(java.lang.String message)