hi, im having trouble with my code. i managed to make the first actor fall ( the patty) but i dont know how to make the other actors fall
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class patty here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class patty extends Actor
{
public void act()
{
//move(-10);
setLocation(getX(),getY()+1);
if(isAtEdge())
{
getWorld().removeObject(this);
}
if(isTouching(player.class))
{
//Greenfoot.playSound("ding.mp3");
//removeTouching(player.class);
getWorld().removeObject(this);
//MyWorld world=(MyWorld) getWorld();
}
}
public void moveDown(){
int xpos = getX(); // find out the current Y position and store it
if (xpos < getWorld().getWidth() - 10)
{
xpos = xpos +2;
setLocation(getY(), xpos);
} else {
getWorld().removeObject(this);
}
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class lettuce here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class lettuce extends Actor
{
public void act()
{
//move(-5);
setLocation(getX(),getY()+1);
if(isAtEdge())
{
getWorld().removeObject(this);
}
/*
if(isTouching(player.class))
{
//Greenfoot.playSound("ding.mp3");
//removeTouching(player.class);
getWorld().removeObject(this);
//MyWorld world=(MyWorld) getWorld();
}
*/
}
public void moveDown(){
int xpos = getX(); // find out the current Y position and store it
if (xpos < getWorld().getWidth() - 10)
{
xpos = xpos +2;
setLocation(getY(), xpos);
} else {
getWorld().removeObject(this);
}
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class cheese here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class cheese extends Actor
{
public void act()
{
//move(-5);
setLocation(getX(),getY()+1);
if(isAtEdge())
{
getWorld().removeObject(this);
}
/*
if(isTouching(player.class))
{
//Greenfoot.playSound("ding.mp3");
//removeTouching(player.class);
getWorld().removeObject(this);
//MyWorld world=(MyWorld) getWorld();
}
*/
}
public void moveDown(){
int xpos = getX(); // find out the current Y position and store it
if (xpos < getWorld().getWidth() - 10)
{
xpos = xpos +2;
setLocation(getY(), xpos);
} else {
getWorld().removeObject(this);
}
}
}
