I have one, I think, easy to solve problem, just syntax problem. I want to make Clouds disappear after touching this actor. The error shows - "cannot find symbol - variable Cloud". Even "Cloud.class" isnt working. Thanks a lot^^
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Lietadlo here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Lietadlo extends Actor
{
/**
* Act - do whatever the Lietadlo wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
posuvanie();
checkIfPlaneisTouchingCloud();
}
public void posuvanie()
{
if(Greenfoot.isKeyDown("d"))
setLocation(getX()+1, getY());
if(Greenfoot.isKeyDown("a"))
setLocation(getX()-1, getY());
if(Greenfoot.isKeyDown("w"))
setLocation(getX(), getY()-1);
if(Greenfoot.isKeyDown("s"))
setLocation(getX(), getY()+1);
}
private void checkIfPlaneisTouchingCloud(){
if(isTouching(Cloud.class)){
setImage("game_over.png");
removeObject(Cloud);
Greenfoot.stop();
}
}
}
