I got a problem with display a specific text in my world. Actually, there should be displaying a question in my world. But for any reason, it doesn’t. Why? The code is correct.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | public firstCategory_questionone() { super ( 1920 , 1080 , 1 ); GreenfootImage bg = new GreenfootImage( "london-background.png" ); bg.scale(getWidth(), getHeight()); setBackground(bg); firstDescription(); } //This shows a simple background for a question private void firstDescription() { Quiztemplate quiztemplate = new Quiztemplate(); addObject(quiztemplate, 960 , 540 ); } //should display a text block with the question and its possible answers. The user is able to click on each button for a right or a wrong answer. private void firstQuestion() { GreenfootImage img = new GreenfootImage ( 630 , 270 ); img.drawString( "Frage 1: Wie schreibt sich das Englische Wort für 'Erfahrung'?" , 2 , 20 ); setBackground(img); } //goes to the next question when user is ready public void act() { if (Greenfoot.isKeyDown( "enter" )) { Greenfoot.playSound( "mouse-click.mp3" ); } } |