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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 310k
  • Answers 310k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes: use ArrayList. In Java, "normal" arrays are fixed-size. You… May 13, 2026 at 10:11 pm
  • Editorial Team
    Editorial Team added an answer No. Also native apps can't do this consistently (only for… May 13, 2026 at 10:11 pm
  • Editorial Team
    Editorial Team added an answer You can use Ctrl+Shift+DEL. It is defined in Tools >… May 13, 2026 at 10:11 pm

Related Questions

There is very simple task I want to do, that somehow makes the program
I have two separate installs of WebSphere. (Actually one is WebSphere Application Server V6.1
I have been trying for quite a while to check if submitted links are
I'm sure I'm going to have to write supporting javascript code to do this.
What is the best compilable scripting language for Win32? I prefer .EXE's because I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.