import greenfoot.*;
import java.awt.Color;
/**
* Write a description of class masinutza here.
* @author (your name) @version (a version number or a date)
*/
public class masinutza extends Actor
{
/**
* Act - do whatever the masinutza wants to do. This method is called whenever the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if ( Greenfoot.isKeyDown("up") )
{ move(3);
}
if ( Greenfoot.isKeyDown("down") )
{ move(-3);
}
if ( Greenfoot.isKeyDown("right") )
{ turn(3); }
if ( Greenfoot.isKeyDown("left") )
{ turn(-3);
}
Color color1 = new Color(34,177,76); // Culoarea ierbii
Color color2 = new Color(239,228,176); // Culoarea drumului
if (color1.equals(getWorld().getBackground().getColorAt(getX(),getY())))
{setLocation(106,448);}
if (Greenfoot.isKeyDown("g"))
{
Color color = getWorld().getBackground().getColorAt(getX(), getY());
System.out.println("Color: "+color);
Greenfoot.stop();
}
}
}
