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

2017/5/18

Wall combine corner and rotation

Yannickk Yannickk

2017/5/18

#
Hello everyone, I am making a maze and i want to combine a rotation with a corner image in one class. so you have 90,180,270,360 degree. I hope someone can help me.
    public Wall()
    {
        setRotation(0);
    }
    
    public Wall(int options)
    {
        
        /**
         * The variable has different options from 1 to 5
         */
        
        if(options==1)
        {
            setRotation(90);
        }
        
        if(options==2)
        {
            setRotation(180);
        }
        
        if(options==3)
        {
            setRotation(270);
        }
        
        if(options==4)
        {
            setRotation(360);
        }
        
        if(options==5)
        {
            setImage("corner.png");
        }
    }
    
    public Wall(int options, int options2)
    {
        /**
         * I want to combine option 5 to the other options
         */
        
        if(Wall()){
            options=options;
        }
        else{
            options2=options;
        }
    }
}
danpost danpost

2017/5/18

#
I cannot tell what you are trying to do with lines 45 through 49. Line 45 seems like it would error. It is also unclear as to why you have a fifth option.
Yannickk Yannickk

2017/5/18

#
I did everything i could but it won't work. Sorry i am trying to do my best i can but i can't understand it.
Yehuda Yehuda

2017/5/19

#
Yannickk wrote...
I did everything i could but it won't work. Sorry i am trying to do my best i can but i can't understand it.
What can't you understand, it's your class (I would think). The only (other) reply that's here is the one by danpost and that's saying how he doesn't understand your code.
You need to login to post a reply.