import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Snake here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Snake extends Animal
{
/**
* Act - do whatever the Snake wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
moveAround();
}
private void moveAround()
{
if (getX() <= 550 || getX() >= getWorld() . getWidth() -5)
{
setImage("snakeLeft.png");
setLocation(getX() + 2, getY());
}
if (getX() >= 5 || getX() <= getWorld() . getWidth() -5)
{
setImage("snake2.png");
setLocation(getX() + 2, getY());
}}}

