Hello, hope you guys can help me out.
The problem im having right now is that i have a wall. And when this wall is spawned nothing can go trough it.
Now i already made the part to remove the wall. But im stuck on the part to make the wall spawn on the same location as the old wall. So nothing can go trough it again.
Can anyone give me an example, or give me a few leads on how this works exactly. Been working on it for quite a bit now but nothing seems to work.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MagicWall here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MagicWall extends Actor
{
/**
* Act - do whatever the MagicWall wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
private int xWall = 625;
private int yWall = 211;
public void act()
{
removeWall();
makeWall();
}
public void removeWall()
{
if(Greenfoot.isKeyDown("space"))
{
getWorld().removeObject(this);
}
}
public void makeWall()
{
String key = Greenfoot.getKey();
if ("down".equals(key))
{
getWorld().addObject(new MagicWall(), xWall, yWall);
}
}
}

