悉尼大學(xué)1113Assignment2課業(yè)解析

悉尼大學(xué)1113Assignment2課業(yè)解析

悉尼大學(xué)1113Assignment2課業(yè)解析

題意:

Java制作一個(gè)名為Invadem的射擊游戲

解析:

異形入侵第409天,作為人類(lèi)最后的生存者,你駕駛一輛無(wú)限彈藥造壮、裝備220主炮的紅狼坦克,繼續(xù)抵御訓(xùn)練有素的怪物的攻擊锐秦。活下去就是希望盗忱!你必須頂著敵人的火力酱床,消滅所有怪物才能爭(zhēng)取喘息的時(shí)間。逝去的戰(zhàn)友給你留下的最后裝備——“希望之光”——就在身邊售淡,往事一幕幕浮現(xiàn)斤葱,警報(bào)聲卻再次響起,你登上了戰(zhàn)痕累累的裝甲車(chē)……

玩家坦克:22*14像素大小揖闸,出生于屏幕底部的中間位置揍堕;炮彈1*3像素大小,汤纸;鍵盤(pán)上下左右控制坦克以每幀1像素的速度移動(dòng)衩茸;F發(fā)射炮彈,炮彈會(huì)摧毀敵人和屏障贮泞;玩家每關(guān)有3滴血楞慈,碰到敵人或敵人子彈血量-1

敵人:每關(guān)有40個(gè)敵人幔烛,分為4波,出生于屏幕頂部囊蓝,向下移動(dòng)饿悬,敵人體積16*16像素大小聚霜;每隔5s狡恬,敵人中的隨機(jī)一個(gè)發(fā)射炮彈向下移動(dòng),速度一樣蝎宇,玩家炮彈與敵人炮彈不可以相互摧毀弟劲;敵人動(dòng)作整齊劃一,先向右移動(dòng)30步姥芥,向下移動(dòng)8個(gè)像素后再向左移動(dòng)30步兔乞,每2幀進(jìn)行一次移動(dòng);敵人到達(dá)屏障前10像素的位置凉唐,敵人獲勝庸追;

屏障:分為3塊,均勻分布在玩家坦克出生地上方10個(gè)像素的位置台囱;左邊的距離屏幕左側(cè)20像素锚国,右邊的距右側(cè)20像素,中間的居中玄坦;每塊屏障最多抵抗3次炮彈的攻擊,無(wú)論是來(lái)自玩家還是敵人绘沉,由sprite[]數(shù)組監(jiān)控煎楣,不同受損狀態(tài)屏障看起來(lái)不一樣,可以用像素多少來(lái)顯示屏障(無(wú)損傷9像素排開(kāi)车伞,1級(jí)損傷丟失3像素保留6像素择懂,2級(jí)損傷保留3像素,3級(jí)損傷屏障消失)

游戲輸贏:玩家擊敗所有敵人另玖,玩家獲勝困曙,游戲進(jìn)入下一關(guān);玩家血量為0或敵人到達(dá)屏障谦去,玩家輸

涉及知識(shí)點(diǎn): 面向?qū)ο罂独觥㈩?lèi)、碰撞檢測(cè)算法鳄哭、gradle

更多可+薇?討論:qing1119X

pdf

Assignment 2

You are working for a company called PipeDream which produces desktop and mobile games. The company

is currently developing a new game called Invadem. Invadem is a simple shoot'em up game where the player

controls a tank that fights off a horde of invading space ships.

You have been given the task of building a demo. You will need to implement the tank, barriers, invaders and

a single level that will be repeated if the player wins or loses. Additional requirements will be released after

your milestone submission.

An artist has created a simple demonstration of the game and has posted it on your online forum (Ed). Use

this demo to help layout your entities and develop your game mechanics.

Project and Build

You have been given a scaffold which will help you get started with this assignment. You can download the

scaffold onto your own computer and invoke gradle build to compile and resolve dependencies.

You will be using the Processing library within your project to allow you to create a window and draw

graphics. You can access the documentation from the following link

Game Objects

The project contains a number of entities that will need to be modelled within your application. You have

been provided some basic test cases to help develop and implement their functionality.

Tank

This is a player controlled entity that can be moved by pressing the left and right arrow keys on the keyboard

and moves at a rate of 1 pixel per a frame . The tank is 22x14 pixels, it starts at the bottom-middle of the

display. A tank can fire projectiles which can hit the barriers or enemy invaders. It can shoot multiple

projectiles towards the invaders. If an enemy projectile hits the tank, it will lose a hit point, if the tank is hit 3

times, the game should transition to a Game Over screen since the tank has been destroyed.

Invader

Each invader has a unique starting position but move in time with every other invader. The invader swarm

moves from the top-middle of the screen to the player's barriers. Once an invader has reached the barriers,

the game should transition to a Game Over screen.

Invaders will move 30 steps in one direction before moving down and heading 30 steps in the other direction.

Each sideways step will constitute a movement of 1 pixel, each step is made every two frames. When an

invader moves downward, it will move 8 pixels down and transition to it's other sprite.

The invaders are part of a larger swarm, the swarm starts with 40 invaders (10 invaders per row, 4 rows). Each

invader is 16x16 pixels, this will correspond with the size of their sprites. They will have the same collision

area as their sprites.

Once an invader is hit, it is considered to have been destroyed and should no longer be rendered by the

game. When all invaders have been hit, this will result in the player winning the game and transitioning to the

Next Level screen.

Every 5 seconds, an invader will be randomly selected to fire a projectile downwards.

Barrier

A barrier is composed of 9 different components, each component can sustain 3 hits. Once a component has

been destroyed, it no longer offers protection for the tank. When a barrier sustains a hit, it will change to a

different sprite, indicating that it has been damaged. The player is provided with 3 barriers, each barrier, left

barrier is at least 20 pixels away from the left boundary described in the application section, the center barrier

starts in the centre of the screen, right barrier is at least 20 pixels away from the right boundary. Each barrier

is at least 10 pixels above the tank's location.

A barrier can be hit by the tank and an invader.

Projectile

A projectile can be fired by both the tank and an invader, however, an invader's projectile will not hit any other

invader (only the barrier and tank). The tank can hit the barrier as well as any invader. Once a projectile

impacts with another entity, it will cease to exist.

The projectile is 1x3 pixels and travels upwards 1px per frame.

Game Conditions

The goal of the game is for the player to destroy all invaders before either the tank is destroyed or the

invaders land.

The player wins when the following conditions have been met:

All invaders are destroyed.

The computer wins when one of the following conditions have been met:

An invader reaches the barriers (10px away from the barriers).

The tank is hit 3 times and destroyed.

Application

Your application will need to adhere to the following specification

640 width 480 height window with a black background.

Left boundary (tank cannot move past this point) at x 180, Right boundary at x 460.

Must maintain a frame rate of 60 frames per second.

Your application must be able to compile and run on any the university lab machines using gradle

build & gradle run

Failure to do so, will result in 0% for Final Code Submission.

Your program must not exhibit any memory leak, try to load all assets prior to usage.

You must use the processing library, you cannot use any other framework such as javafx, awt or jogl.

Assets

Artists within the company have produced sprites for your game. You have been provided a /resources

folder which your code access directly. These assets are loadable using the loadImage method attached the

PApplet type. Please refer to the processing documentation when loading and drawing an image.

Algorithms that may come in handy!

It is likely you will need to utilise the following algorithms and patterns within your project. You will need to

identify where you will utilise these algorithms and document them in your report.

Collision Detection (AABB)

Since all entities within the game can contain an axis aligned bounding box. You may implement the following

collision detection method.

Assume the following variables (r1, r2) have the properties: x, y, width, height.

Animation

You have been given sprites to associate to entities. Due to the simplicity of the game there isn't a lot of

animation that is required but you may find it beneficial to maintain an animation state within each entity.

Each entity will contains a list of sprites which can be swapped to.

check_collection(r1, r2):

if ( r1.x < (r2.x + r2.width) ) and

( (r1.x + r1.width) > r2.x ) and

( r1.y + (r2.y + r2.height) ) and

( (r1.height + r1.y) > r2.y ):

//Collision has been detected

return true;

else:

return false

AnimationData {

sprites[];

currentSpriteIndex;

delay;

tick() {

//Action to take on a draw call

//use information to delay a sprite transition

//Loop around if index >= length of sprites

}

}

Marking Criteria (12%)

Your final submission is due on 10th of November at 11:59PM AEST. Please make sure you submit your code

to Ed and your report to Canvas.

Final Code Submission (5%)

You will need to have implemented and satisfied requirements listed in this assignment. Make sure you

have addressed the following and any other requirements outlined previously.

Window launches and shows black background

Tank is rendered and can be moved by the user

Invaders are rendered, move according to the pattern described and change sprites on movement

Barriers are rendered, can be hit by both tank and invader

Win condition can be reached by the player

Loss condition can be reached by the computer

Ensure your application does not repeat large sections of logic, try to minimise repetition.

Ensure your application code exhibits good OO principles (Utilising inheritance, interfaces and

classes effectively)

Additional requirements will be announced after the milestone deadline which will need to

be implemented

Milestone (1%)

To ensure progress has been made within on your project. You will need to submit a working submission

of your project by Tuesday on October 29th by 11:59pm AEST.

You must achieve the following:

Draw the tank on the screen.

At least one invader is drawn in its starting position.

At least one barrier is set up.

The tank can be moved using left and right arrow keys.

However, try to aim to complete as much as you can so your tutor can provide as much feedback on

your milestone submission.

Additional Test Cases (2%) During development of your code, add additional test cases to your project

and test as much functionality as possible. You will need to construct unit test cases within the src/test

folder.

To test the state of your entities without drawing, implement a simple game loop that will update the

state of each object but not draw the entity.

Some suggestion for test cases you should create:

Tank (movement, change sprites, fires projectile, intersection, state changes)

Projectile (checks for intersection, travel velocity)

Invader (checks movement pattern, projectile firing, state change)

Barrier (It can be hit, changes state after hit, can be hit by different entities, it's current placement in

the application)

Code coverage, common and corner cases

Ensure your test cases cover over 90% of execution paths (Use jacoco in your gradle build)

Ensure your test cases cover common cases.

Ensure your test cases cover edge cases.

Each test cases must contain a brief comment explaining what it is testing.

Design, Report and Comments (3%), (400 words minimum, 1200 words maximum) You will need to

submit a report that elaborates on your application design and development progress. Please include:

Documentation on your progress, highlighting what you have identified from the problem

description, requirements gathering and how you have represented concepts within your

application.

Provide a high level overview of your implementation

For each class created, state what you used it for and why it was incorporated into your design.

Highlight changes you have made after the milestone submission, identifying how your initial design

at the milestone hindered or helped your final submission.

Reflection, highlight issues that you encountered while modelling your application and any

improvements you can identify.

Your code should be clear, well commented and concise, try not to repeat yourself and utilise OOP

constructs within your application.

Your code should be easy to follow, help the reader and avoid distraction. The code and design

should aim provide a cohesive layout and concise comments; well chosen names; and idiomatic use

of the Java language

Extension (1%) You really want to impress! Add an additional feature to the game. We have provided

some extension ideas but you are free to implement your own extension, please check with your tutor

for approval.

You will need to outline your extension idea within your report so the marker knows what to look for.

Some ideas that you can implement:

2 Player mode, two players can play the game at the same time on the same computer, this tank

will be using a different sprite to the one provided.

Network play, Your game can create a server where two people can play the game from different

computers.

Add sound effects to your game, make those visual pop with some sound effects.

Warning : Any attempts to deceive or disrupt the marking system will result in an immediate zero for the

entire assignment. Negative marks can be assigned if you do not properly follow the assignment specification,

or your code is unnecessarily or deliberately obfuscated.

Academic Declaration

By submitting this assignment you declare the following:

I declare that I have read and understood the University of Sydney Student Plagiarism: Coursework Policy and

Procedure, and except where specifically acknowledged, the work contained in this assignment/project is my own

work, and has not been copied from other sources or been previously submitted for award or assessment.

I understand that failure to comply with the Student Plagiarism: Coursework Policy and Procedure can lead to severe

penalties as outlined under Chapter 8 of the University of Sydney By-Law 1999 (as amended). These penalties may

be imposed in cases where any significant portion of my submitted work has been copied without proper

acknowledgement from other sources, including published works, the Internet, existing programs, the work of other

students, or work previously submitted for other awards or assessments.

I realise that I may be asked to identify those portions of the work contributed by me and required to demonstrate

my knowledge of the relevant material by answering oral questions or by undertaking supplementary work, either

written or in the laboratory, in order to arrive at the final assessment mark.

I acknowledge that the School of Computer Science, in assessing this assignment, may reproduce it entirely, may

provide a copy to another member of faculty, and/or communicate a copy of this assignment to a plagiarism

checking service or in-house computer program, and that a copy of the assignment may be maintained by the

service or the School of Computer Science for the purpose of future plagiarism checking.

更多可+薇?討論:qing1119X

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末要糊,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子妆丘,更是在濱河造成了極大的恐慌锄俄,老刑警劉巖局劲,帶你破解...
    沈念sama閱讀 217,084評(píng)論 6 503
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異奶赠,居然都是意外死亡鱼填,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,623評(píng)論 3 392
  • 文/潘曉璐 我一進(jìn)店門(mén)毅戈,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)苹丸,“玉大人,你說(shuō)我怎么就攤上這事竹祷√铬耍” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 163,450評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵塑陵,是天一觀的道長(zhǎng)感憾。 經(jīng)常有香客問(wèn)我,道長(zhǎng)令花,這世上最難降的妖魔是什么阻桅? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,322評(píng)論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮兼都,結(jié)果婚禮上嫂沉,老公的妹妹穿的比我還像新娘。我一直安慰自己扮碧,他們只是感情好趟章,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,370評(píng)論 6 390
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著慎王,像睡著了一般蚓土。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上赖淤,一...
    開(kāi)封第一講書(shū)人閱讀 51,274評(píng)論 1 300
  • 那天蜀漆,我揣著相機(jī)與錄音,去河邊找鬼咱旱。 笑死确丢,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的吐限。 我是一名探鬼主播鲜侥,決...
    沈念sama閱讀 40,126評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼诸典!你這毒婦竟也來(lái)了剃毒?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 38,980評(píng)論 0 275
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎赘阀,沒(méi)想到半個(gè)月后益缠,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,414評(píng)論 1 313
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡基公,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,599評(píng)論 3 334
  • 正文 我和宋清朗相戀三年幅慌,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片轰豆。...
    茶點(diǎn)故事閱讀 39,773評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡胰伍,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出酸休,到底是詐尸還是另有隱情骂租,我是刑警寧澤,帶...
    沈念sama閱讀 35,470評(píng)論 5 344
  • 正文 年R本政府宣布斑司,位于F島的核電站渗饮,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏宿刮。R本人自食惡果不足惜互站,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,080評(píng)論 3 327
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望僵缺。 院中可真熱鬧胡桃,春花似錦、人聲如沸磕潮。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,713評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)自脯。三九已至亡容,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間冤今,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 32,852評(píng)論 1 269
  • 我被黑心中介騙來(lái)泰國(guó)打工茂缚, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人龟糕。 一個(gè)月前我還...
    沈念sama閱讀 47,865評(píng)論 2 370
  • 正文 我出身青樓讲岁,卻偏偏與公主長(zhǎng)得像缓艳,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子衙吩,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,689評(píng)論 2 354

推薦閱讀更多精彩內(nèi)容