Share the Java-written tank war game, I believe many people played in childhood

Source: Internet
Author: User
Write in front

The program is written five or six years ago when reading, there will be some irregular, I have put the code on GitHub, there is time to optimize the changes.

Program operating mechanism

Defines a jpanel, and then redraws it once every other short period of time.

The redraw content is as follows:

  • Map information;
  • Enemy tanks;
  • our tanks;
  • The right game basic information;
  • The bomb exploded.

involves some logic:

  • overlapping judgment;
  • When does the tank change direction;
  • When does the tank shoot;
  • The handling of tanks after being shot;
  • Bricks, iron blocks, rivers are shot, collision logic;
  • 。。。 Wait a minute
How to execute a program

Download Source:

  1. Execute the MAVEN command clean package to generate jar packages in the target directory and execute the jar package directly;
  2. or import the source code directly with Eclipse, find the Startgame class, right-click Run as Java application. If you find that the main class cannot be found or cannot be loaded, clean up the project.
Program run

Program source Code

Https://github.com/peterchenhdu/tankbattle

Share the Java-written tank war game, I believe many people played in childhood

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.