单机版坦克大战代码(计算机体系结构课内实验)
立即下载
资源介绍:
java语言编写
基于案例代码设计自己的坦克大战游戏(单机版),并为以后扩展为网络对战版预留接口。
1. 基于MVC或者分成架构设计,设计每个层各负责什么职责,提供什么功能;
2. 使用依赖倒置原则、以及回调函数技术,改写案例代码,将图形绘制功能移植到View层,并阐述这样做的好处,比如如何更换显示图片以及是否支持3D显示等;
3. 修改控制层,修改为:我方坦克跟随鼠标位置作为方向,使用鼠标右键开炮;键盘的空格支持我方坦克开炮;界面上我方坦克最多可以同时(1个屏幕)发射3发炮弹;地方坦克随机出生,且地方坦克同时不多于5辆;
4. 新增一些组件完成如下要求:
(1)控制游戏开始、结束、存档功能,并统计游戏时长和击毁敌方坦克数;
(2)支持地图功能,新增草丛、河流,坦克在草丛中时不显示(练习碰撞检测)、坦克不能跨过河流;
["{\"Destroyed\":false,\"MapPosition\":0,\"count\":1,\"dir\":96.0474630339223,\"height\":10,\"hp\":200,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":17,\"moving\":true,\"rect\":{\"x\":734,\"y\":44,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":96.0474630339223,\"width\":10,\"x\":739,\"y\":49}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":104.71886425212547,\"height\":10,\"rect\":{\"x\":1886,\"y\":200,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":2,\"dir\":230.58762076311007,\"height\":10,\"hp\":200,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":17,\"moving\":true,\"rect\":{\"x\":-4,\"y\":-3,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":230.58762076311007,\"width\":10,\"x\":1,\"y\":2},\"width\":10,\"x\":1891,\"y\":205}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":133.09661115007572,\"height\":10,\"rect\":{\"x\":1657,\"y\":1449,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":true,\"MapPosition\":0,\"count\":4,\"dir\":309.3375977981636,\"height\":10,\"hp\":-0.10000000000511164,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":28,\"moving\":true,\"rect\":{\"x\":96,\"y\":235,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":121.80938928779315,\"width\":10,\"x\":101,\"y\":240},\"width\":10,\"x\":1662,\"y\":1454}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":148.3280915539084,\"height\":10,\"rect\":{\"x\":1120,\"y\":1507,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":3,\"dir\":19.735145295603658,\"height\":10,\"hp\":114.39999999999691,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":33,\"moving\":true,\"rect\":{\"x\":386,\"y\":-2,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":148.3280915539084,\"width\":10,\"x\":391,\"y\":3},\"width\":10,\"x\":1125,\"y\":1512}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":119.29541908378022,\"height\":10,\"rect\":{\"x\":1236,\"y\":779,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":2,\"dir\":230.58762076311007,\"height\":10,\"hp\":200,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":17,\"moving\":true,\"rect\":{\"x\":-4,\"y\":-3,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":230.58762076311007,\"width\":10,\"x\":1,\"y\":2},\"width\":10,\"x\":1241,\"y\":784}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":3,\"dir\":191.43306018344006,\"height\":10,\"hp\":184.29999999999293,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":17,\"moving\":true,\"rect\":{\"x\":280,\"y\":146,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":191.43306018344006,\"width\":10,\"x\":285,\"y\":151}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":130.7321066997092,\"height\":10,\"rect\":{\"x\":1822,\"y\":1568,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":1,\"dir\":201.25887167626365,\"height\":10,\"hp\":134.3999999999969,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":34,\"moving\":true,\"rect\":{\"x\":195,\"y\":61,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":130.7321066997092,\"width\":10,\"x\":200,\"y\":66},\"width\":10,\"x\":1827,\"y\":1573}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":146.27664033394765,\"height\":10,\"rect\":{\"x\":886,\"y\":1258,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":true,\"MapPosition\":0,\"count\":4,\"dir\":309.3375977981636,\"height\":10,\"hp\":-0.10000000000511164,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":28,\"moving\":true,\"rect\":{\"x\":96,\"y\":235,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":121.80938928779315,\"width\":10,\"x\":101,\"y\":240},\"width\":10,\"x\":891,\"y\":1263}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":2,\"dir\":230.58762076311007,\"height\":10,\"hp\":200,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":17,\"moving\":true,\"rect\":{\"x\":-4,\"y\":-3,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":230.58762076311007,\"width\":10,\"x\":1,\"y\":2}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":159.60903524863636,\"height\":10,\"rect\":{\"x\":963,\"y\":1293,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":3,\"dir\":191.43306018344006,\"height\":10,\"hp\":184.29999999999293,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":17,\"moving\":true,\"rect\":{\"x\":280,\"y\":146,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":191.43306018344006,\"width\":10,\"x\":285,\"y\":151},\"width\":10,\"x\":968,\"y\":1298}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":152.3909499455507,\"height\":10,\"rect\":{\"x\":1018,\"y\":1414,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":3,\"dir\":191.43306018344006,\"height\":10,\"hp\":184.29999999999293,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":17,\"moving\":true,\"rect\":{\"x\":280,\"y\":146,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":191.43306018344006,\"width\":10,\"x\":285,\"y\":151},\"width\":10,\"x\":1023,\"y\":1419}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":155.48383885640683,\"height\":10,\"rect\":{\"x\":929,\"y\":1310,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":1,\"dir\":96.0474630339223,\"height\":10,\"hp\":200,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":18,\"moving\":true,\"rect\":{\"x\":737,\"y\":44,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":96.0474630339223,\"width\":10,\"x\":742,\"y\":49},\"width\":10,\"x\":934,\"y\":1315}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":151.20689924035946,\"height\":10,\"rect\":{\"x\":627,\"y\":1117,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":2,\"dir\":230.58762076311007,\"height\":10,\"hp\":200,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":17,\"moving\":true,\"rect\":{\"x\":-4,\"y\":-3,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":230.58762076311007,\"width\":10,\"x\":1,\"y\":2},\"width\":10,\"x\":632,\"y\":1122}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":171.2977762100532,\"height\":10,\"rect\":{\"x\":298,\"y\":1627,\"width\":10,\"height\":10},\"speed\":300,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":0,\"dir\":-37.67359333983043,\"height\":10,\"hp\":200,\"hp_recovery_per_sec\":0.5,\"hpmax\":200,\"moveSteps\":1243,\"moving\":true,\"rect\":{\"x\":196,\"y\":169,\"width\":10,\"height\":10},\"speed\":200,\"team\":0,\"turretDir\":-37.67359333983043,\"width\":10,\"x\":201,\"y\":174},\"width\":10,\"x\":303,\"y\":1632}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":153.92464441605125,\"height\":10,\"rect\":{\"x\":273,\"y\":418,\"width\":10,\"height\":10},\"speed\":200,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":3,\"dir\":191.43306018344006,\"height\":10,\"hp\":184.29999999999293,\"hp_recovery_per_sec\":0.1,\"hpmax\":200,\"moveSteps\":17,\"moving\":true,\"rect\":{\"x\":280,\"y\":146,\"width\":10,\"height\":10},\"speed\":200,\"team\":1,\"turretDir\":191.43306018344006,\"width\":10,\"x\":285,\"y\":151},\"width\":10,\"x\":278,\"y\":423}","{\"Destroyed\":false,\"MapPosition\":0,\"count\":-1,\"damage\":20,\"dir\":180,\"height\":10,\"rect\":{\"x\":297,\"y\":1615,\"width\":10,\"height\":10},\"speed\":300,\"tank\":{\"Destroyed\":false,\"MapPosition\":0,\"count\":0,\"dir\":-37.67359333983043,\"height\":10,\"hp\":200,\"hp_r
资源文件列表:
TankWarmaster(1).zip 大约有194个文件