Well im really really new to green foot and I want to make a Quiz type game But I have absolutely no clue how I gave it a try but that not getting me any where so can You guys help me Im not trying to make anything anything to complicated just a simple quiz question game that has right and wrong answers and can Go from question to question after you answer . This is what i had so far:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.util.ArrayList;
/**
* Write a description of class MyWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MyWorld extends World
{
ArrayList questions = new ArrayList<Question>();
int currentQuestion = 0;
int score = 0;
/**
* Constructor for objects of class MyWorld.
*
*/
public MyWorld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
//Define Questions
String[] awnsers = {"15%","20%","30%","40%"};
questions.add(new Question("How many percent of the worlds population live in Asia?",
awnsers,
3));
showQuestion(currentQuestion);
showScore();
checkClick();
}
public void checkClick(){
MouseInfo mouse = Greenfoot.getMouseInfo();
if(mouse==null)return;
int x = mouse.getX();
int y = mouse.getY();
}
public void showScore(){
this.showText("Score: "+score, 50, 375);
}
public void showQuestion(int index){
Question q = (Question) questions.get(index);
this.showText(q.question, 300, 50);
this.showText(q.awnsers[0], 300, 100);
this.showText(q.awnsers[1], 300, 150);
this.showText(q.awnsers[2], 300, 200);
this.showText(q.awnsers[3], 300, 250);
}
}

