Jump to content

Need help with a Java game

C.G.F.Sabre

I am attempting to build a game in java that is like a group style thing were it chooses someone randomly and they have to enter a question. The questions and all the users would be inputed by the end user. I don't know were to start or really what to do. I have some background knowledge in java but not  much.

Link to comment
Share on other sites

Link to post
Share on other sites

lynda.com 

24 fps for that "cinematic" feel


After a couple weeks of behavioral sciences at my school I can easily conclude my parents need to grow up.

Link to comment
Share on other sites

Link to post
Share on other sites

Can you describe in more detail what you're trying to build? How is the game played? Is only one person controlling the program? Are people taking turns using the program? Or is each person running the program on their own computers? Is it GUI based or console based?

Link to comment
Share on other sites

Link to post
Share on other sites

Can you describe in more detail what you're trying to build? How is the game played? Is only one person controlling the program? Are people taking turns using the program? Or is each person running the program on their own computers? Is it GUI based or console based?

I am hoping to do ui based and my dad is a teacher and he asked me to do this for him as a summer project because he knew that I know a bit a java but I can't think of how to start. So it would be a teacher from one computer.

Link to comment
Share on other sites

Link to post
Share on other sites

I am hoping to do ui based and my dad is a teacher and he asked me to do this for him as a summer project because he knew that I know a bit a java but I can't think of how to start. So it would be a teacher from one computer.

 

So the teacher uses the program. There's a setup part and a game part. In the setup part they enter the students and questions into the program. In the game part, it randomly chooses a student and they have to answer one of the questions?

 

Is that what you're going for?

Link to comment
Share on other sites

Link to post
Share on other sites

So the teacher uses the program. There's a setup part and a game part. In the setup part they enter the students and questions into the program. In the game part, it randomly chooses a student and they have to answer one of the questions?

 

Is that what you're going for?

yeah.

Link to comment
Share on other sites

Link to post
Share on other sites

First, get familiar with a Java UI framework, like JavaFX or Swing, if you aren't already.

Link to comment
Share on other sites

Link to post
Share on other sites

First, get familiar with a Java UI framework, like JavaFX or Swing, if you aren't already.

ok I just got a bunch of books to read through and thanks for the help.

Link to comment
Share on other sites

Link to post
Share on other sites

Go for swing, it's easy.  

DO a setup.

Then you need to have some representation of student.  
You can do it like integer so: 
int sudents= 23; (for example)
askStudent(new Random().nextInt(students));

public void askStudent(int student_umber){
println(" Question : " +  Question.getQuestion());
}

Where you can have an abstract class called Question which withdraws questions from text file and in getQuestion method will randomly get on of the questions and outputs the String .

and instead of prinln you can use your UI  , so like  textbox.setText(" Questions : " + Question.getQuestion());

But this all is lazy coded, but will work, some things are overkill, some are not.

For isntance you can directly get a question from file (or excel or whatever), but if you organize it into multiple classes (cleverly) the code will be cleaner and easier for troubleshooting / maintanance.

Nevermind the fact that you will learn some good coding habbits throughout.

And remember, my code is semy-good habbit   ,  it can be so much more improwed.

this is the solution that is half easy / half clean.  

Cheers.
 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×