This site requires JavaScript, please enable it in your browser!
Greenfoot back
RedPanda98
RedPanda98 wrote ...

2016/2/27

Cannot find symmbol - class wall.

RedPanda98 RedPanda98

2016/2/27

#
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);
        
        
    }
}
danpost danpost

2016/2/27

#
Do you have a subclass of the Actor class called Wall? If so, show its code. Also, please indicate which line the error occurs on. Line 13 calls a method called 'Wall' which is not currently in the class given. However, that would not produce the error message you show in the title.
You need to login to post a reply.