Java版坦克大战
摘要
Java是近几十年来随着各种技术的发展,尤其是编程语言飞速发展而诞生的一项新的开发语言。随着信息技术的飞速发展,计算机的使用也日渐普及,各种各样游戏也纷纷出现在我们的视野中。本论文从实际应用出发,向大家介绍坦克大战游戏的设计与实现。
该版本的坦克大战是基于Java语言设计开发的,本设计采用面向对象的设计模式,对游戏中的所有物体赋予对象的概念和属性。在开始游戏后,启动客户端,在主程序运行的线程中,画面刷新将以一定的频率采用双缓冲技术对屏幕重绘,实时反映整个游戏的进行状态。用户控制的坦克运行在主线程中,随屏幕刷新的频率而移动。坦克将在游戏开始时进行初始化,然后将坦克绘制在地图的上层。本设计主要实现的功能是让坦克能向八个方向移动,并且打出炮弹,子弹击中敌人坦克,子弹和敌人坦克同时消失,产生爆炸,敌方坦克能智能的移动并且打出炮弹。能够支持单人对战和两人对战两种模式。?
完成这个项目的主要目的是让自己尽可能全面的掌握Java的基础知识。在整个坦克大战的开发过程中将涉及到Java基本知识的大部分内容,这个自己本身对Java知识的巩固有很好的作用。
关键词: Java;坦克;游戏;智能
Java version of the Battle City
Abstract
Java is a new development language in recent decades with the development of various technologies, especially the rapid development of the programming language and birth. With the rapid development of information technology, the use of computers has become more popular, a variety of games have also appeared in our field of vision. From the practical application of this paper, we introduce the design and implementation of Battle City game.
This version of the Battle City is designed and developed based on the Java language , the design of object-oriented design patterns, for all objects in the game to give the concept of objects and attributes . After the beginning of the game , start the client, in the main threads running , the screen will refresh certain frequency using double buffering technology to redraw the screen in real time to reflect the state of the entire game . User-controlled tanks run in the main thread , with the screen refresh frequency and movement. Tanks will be initialized when the game starts , and then draw in the upper tank of the map. The main function is designed so that the tank can be moved to eight directions , and shot shells, bullets hit the enemy tanks, bullets and enemy tanks simultaneously disappear , resulting in an explosion , enemy tanks can move and play smart bombs . Able to support both single- player game and battle modes.
The main objective of this project is to complete as