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

2016/4/8

help with question level advancement?

keeganlink29 keeganlink29

2016/4/8

#
i have the following code, and i want to make it so that when i am on level 1 it asks the level 1 question, and if i am on level 2 it asks the level 2 question etc. public void question() { if (canSee(portal.class)) { String name =JOptionPane.showInputDialog("what does RAM stand for"); if (name.matches("random access memory")) { Greenfoot.setWorld(new labarynth2()); } else { lives--; Greenfoot.setWorld(new labarynth()); } } } can anyone help?
danpost danpost

2016/4/8

#
Put your questions in an array. Use a Level superclass for your different labarynth worlds and assign each level a value that can be accessed by the actor to use as an index for the question to ask. For help on specific issues on this, post a reply here. You could review the code (or even import my Level superclass for use in your scenario) of my Super Level Support Class scenario for help.
You need to login to post a reply.