danpost wrote...
Lavenger wrote...
when I remove the PIP, do I remove PIP as a whole or pip1, I plan to using the pip actor again after removing itimport greenfoot.*;
public class MiniTaihei extends greenfoot.Actor
{
Timer actTimer = new Timer(40);
private boolean once = false;
private boolean run = false;
public MiniTaihei()
{
getImage().scale(30, 30);
}
public void act()
{
int nx = 0, ny = 0, fx = 0, fy = 0;
if (actTimer.iterating()) return;
if(Wall.class == null)
{
if (Greenfoot.isKeyDown("a")&&(getOneObjectAtOffset(fx - 1, fy, Wall.class) == null))
{fx--;}
if (Greenfoot.isKeyDown("d")&&(getOneObjectAtOffset(fx + 1, fy, Wall.class) == null))
{fx++;}
if (Greenfoot.isKeyDown("w")&&(getOneObjectAtOffset(fx, fy - 1, Wall.class) == null))
{fy--;}
if (Greenfoot.isKeyDown("s")&&(getOneObjectAtOffset(fx, fy + 1, Wall.class) == null))
{fy++;}
if (fx*fy == 0 && fx+fy != 0)
{
nx = fx;
ny = fy;
setLocation(getX()+nx, getY()+ny);
actTimer.start();
}
}
if (!getObjectsAt(this.getX(),this.getY() , MiniKirie.class).isEmpty())
{
getWorld().removeObjects(getObjects(Actor.class));
getWorld().removeObjects(getObjects(PIP.class));
}
}
} if (!getObjectsAt(this.getX(),this.getY() , MiniKirie.class).isEmpty())
{
getWorld().removeObjects(getObjects(Actor.class));
getWorld().removeObjects(getObjects(PIP.class));
}

