Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 528287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:58:16+00:00 2026-05-13T08:58:16+00:00

For quite awhile I have been trying to make a simple game in Java

  • 0

For quite awhile I have been trying to make a simple “game” in Java that is really just an applet with a square and a grid. What I want it to do in the end is the user clicks and the square will move to where the user clicked rounded to the nearest grid square.

The problem is I am a self taught beginner and I am having a hard time figuring out how to actually structure the program, some examples:

  • should I have a separate class listening for mouse clicks?
  • When I receive a click should I send it to some other object that represents the box and let it decide what it wants to do or just call some function that makes the box move?

I really want to learn all this “when to use what” stuff for myself so any links or general advice is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:58:16+00:00Added an answer on May 13, 2026 at 8:58 am

    What you’re really asking is how to develop a game, which is notably different from a typical Java application. However, I’ll give you a few ideas to at least point you in the right direction.

    • Take advantage of the fact that Java is an object-oriented language. That is, objects should each have their own responsibility.
    • Separate your game into three key layers: the application layer, the game logic layer, and the presentation layer.

      • The application layer should contain all of your helpers and generic subsystems, things like random number generators, text parsers, file access modules, mesh loaders, etc.
      • The game logic layer should implement all of the rules of your game, and be responsible for maintaining canonical state. Basically, when you press the “W” on the keyboard to move forward, the game logic layer should receive MOVE_FORWARD_REQUEST from the UI.
      • The presentation layer should be responsible for two things: getting input, and rendering your world. When it gets input, like the “W” key, it should map that to an action, and send that to the game logic layer to be processed. Then, it should render the world based on whatever the game logic told it to do.

    Game development is obviously an entire realm with many books dedicated to it. One of my favorites is Game Coding Complete, which does focus on C/C++, but should give you a good idea about how you ought to structure your game.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying for quite a while to check if submitted links are
I've been looking around for quite a while and feel that I have a
I have been stuck on this problem for quite awhile... I hope someone out
for quite a while I have been trying to solve an issue with a
I have been trying for quite a while to work out how to accomplish
I have been trying to get this working for quite a while now but
Hi everyone i've been trying to make this work for quite a while and
I have been trying to understand OpenGL ES 2.0 on the iPhone for quite
I have been trying for quite a while now to resize the desktop work
I have been trying to understand joins for a while now, I've noticed quite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.