How do I use a method from my subclass in the code for my superclass?
Basically I have this code to create an options menu:
And I need it to run in my main menu when I press the options button.
I've done this before but I don't remember how.. I tried searching for it but didn't find what I was looking for.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | public void loadOptions() { Background Background = new Background(); getWorld().addObject(Background, 800 , 450 ); Title Title = new Title(); getWorld().addObject(Title, 800 , 175 ); Controls Controls = new Controls(); getWorld().addObject(Controls, 800 , 325 ); Control_List Control_List = new Control_List(); getWorld().addObject(Control_List, 800 , 550 ); Exit Exit = new Exit(); getWorld().addObject(Exit, 800 , 800 ); Selector Selector = new Selector(); getWorld().addObject(Selector, 800 , 800 ); } |
1 2 3 4 5 6 | if (Greenfoot.isKeyDown( "enter" )) { unloadHome(); loadOptions(); selPos = 3 ; } |