I'm creating a gas law simulation which requires me to create a container consisting of 4 walls for the particles. However I get errors.
Here's the code so far:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class MyWorld extends World
{
public int Width =600;
public int Height=600;
public MyWorld()
{
super(1000, 600, 1);
GenerateWalls();
Wall();
}
public void GenerateWalls()
{
int LineLength= 450;
int LineWidth= 450;
//topwall
Wall WallOne = new Wall();
WallOne.HorzontalWall(LineWidth);
addObject(WallOne,((600/2)),(600/2)-LineLength/2);
//rightwall
Wall WallTwo = new Wall();
WallTwo.VerticalWall(LineLength);
addObject(WallTwo, WallOne.getX()+LineWidth/2,WallOne.getY()+LineLength/2);
//bottomwall
Wall WallThree = new Wall();
WallThree.Horizontal(LineWidth);
addObject(WallThree,WallTwo.getX()-LineWidth/2,WallTwo.getY()+LineLength/2);
//leftwall
Wall WallFour = new Wall();
WallFour.VerticalWall(LineLength);
addObject(WallFour,WallThree.getX()-LineWidth/2,WallThree.getY()-LineLength/2);
}
}
