CSSE1001 Semester

10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 1/11
Ninedraft
Assignment 3
CSSE1001/7030
Semester 1, 2019
Version 1.0.0
20 marks
Due Friday 31 May, 2019, 20:30
1. Introduction
This assignment provides you the opportunity to apply concepts taught throughout the course
to extend the functionality of a basic 2d sandbox game, in the style of Minecraft & Terraria.
The main concepts involved are Graphical User Interfaces (GUIs) and object-oriented
programming. The assignment tasks are to add features to the game, as described in the
requirements below.
You are encouraged to review some similar games, to better understand how this type of game
is played, and for inspiration on advanced features. It is better to do this after reading through
this document in its entirety.
Because this assignment deals with multiple files, while not required, you may wish to
investigate a more sophisticated IDE. A popular option is PyCharm, which is free for students.
VS Code, which is also free, is another common option. Please note that these tools have
significantly more complex user-interfaces than IDLE, so you may find them a little
overwhelming if you are only familiar with IDLE.
2. Overview
2.1. Getting Started
The archive contains all the necessary files to start this assignment. A
significant amount of support code has been supplied so that you begin with a simple
application that is almost working.
The main assignment file is , which contains an incomplete implementation of
, the top-level GUI application class. The other files are support code which
must not be edited. Initially, you do not need to understand much of this code, but as you
st
a3_files.zip
app.py
NinedraftApp
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 2/11

代写CSSE1001作业、代做Python课程设计作业、代写Python程序设计作业
progress through the tasks, you will need to understand more of this code. You should add
code to and modify to implement the necessary functionality.
You are permitted to create additional files to simplify the separation of tasks (i.e. task1.py,
task2.py, etc.), although this is not required. If you do this, must be the entry point to
your application. One way to achieve this is to move to a separate file, such
as . Regardless of how you structure your files, the code must always be able to be
demonstrated by running .
2.2. Pymunk Library
Physics is implemented in the game using the Pymunk library. You will need to install this
library in order to implement your tasks for this assignment. Pymunk can be installed by
running the included .
3. Assignment Tasks
3.1. Task Overview
This assignment is broken down into three main tasks:
1. The first task involves adding lines of code to clearly marked sections within the main
assignment file.
2. The second task involves extending the design to add more interesting functionality to the
game.
3. And the third task involves adding sophisticated functionality to further improve the
gameplay experience.
For CSSE7030 students only, there is an extra task that involves doing independent
research.
In general, as the tasks progress, they are less clearly prescribed and increase in difficulty.
3.2. Task Breakdown
CSSE1001 students will be marked out of 20 & CSSE7030 students will be marked out of 26
based on the following breakdown. Tasks may be attempted in any order, but it is
recommended to follow this breakdown, top-down, completing as much as possible of each
task before moving on to the next.
Sub–Task Marks
Task 1
Basic Features
9 marks
app.py NinedraftApp
app.py
NinedraftApp
base.py
app.py
setup.py
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 3/11
Sub–Task Marks
App Class 1 mark
Mouse Controls 2 marks
StatusView Class 2 marks
Basic Items 2 marks
Keyboard Controls 1 mark
File Menu & Dialogs 1 mark
Task 2
Intermediate Features
7 marks
More Items 2 mark
Crafting 3 marks
CraftingTableBlock 2 marks
Task 3
Advanced Features
4 marks
Bees 1.5 marks
Furnace 2.5 marks
Post-Graduate Task
Independent Research
6 marks
Arrow Movement 4 marks
Interaction with Blocks 2 marks
3.3. Mark Breakdown
For each task, marks will scaled according to the following breakdown.
Description Marks
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 4/11
Description Marks
Code Quality
Code is readable. Appropriate and meaningful identifier names
have been used. Simple and clear code structure. Repeated code
has been avoided.
15%
Code has been simplified where appropriate and is not overly
convoluted.
10%
Documented clearly and concisely, without excessive or extraneous
comments.
15%
Functionality
Components are functional, without major bugs or unhandled
exceptions.
Assessed through user testing/playing, not automated testing.
60%
4. Task 1 – Basic GUI
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 5/11
There are a significant number of comments in intended to help you complete this
task.
4.1. App Class
Write a function that launches the GUI. Call this function inside
an block.
Modify so that the title of the window is set to something appropriate (i.e.
Ninedraft, etc.).
4.2. Mouse Controls
Allow the user to attack the target by clicking the left mouse button. While their mouse is being
moved the game window ( ), show the target cursor over the block position they
have moused over. If the mouse is out of range or leaves the window ( ), hide the
target cursor.
Allow the user to use the currently selected item by clicking the right mouse button. When the
user is holding a block (dirt, stone, etc.) and right clicks on empty space, which is in range, the
block is placed at that location. If the user is instead holding a Item (tool, weapon, bare hand,
etc.), then right clicking on the target will attempt to use that item on the target.
See the , and methods in .
4.3. StatusView Class
Define a class named which inherits from . This class is used to
display information to the user about their status in the game. The ‘s widgets
must:
1. be updated whenever necessary (i.e. when gaining or losing health or food – see
comments)
2. be laid out approximately according to Basic GUI Example
3. contain the following widgets:
Health (first row; left) A label to display the amount of health the player has
remaining, with an image of a heart to the left. The health must be rounded to the
nearest 0.5 (i.e. half or whole).
Food (first row; right) A label to display the amount of food the player has
remaining, with an image of a drumstick to the left. The food must be rounded to the
Basic GUI Example
app.py
main NinedraftApp main
if __name__ == ...
NinedraftApp
GameView
GameView
_left_click _right_click _mouse_move NinedraftApp
StatusView tk.Frame
StatusView
Task
1.3 (Status View): Update ...
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 6/11
nearest 0.5 (i.e. half or whole).
Note: For convenience, you should have a setter method for each of the relevant widgets. i.e.
, etc.
The class should be added to the application in a frame below the .
4.4. Basic Items
Modify the function so that it can generate wood & stone. These should be
instances of the class, which drops a block form of itself when placed. E.g.
4.5. Keyboard Controls
4.5.1. Movement
When the player presses the space bar, they should jump into the air. This can be achieved by
modifying their velocity.
Set the velocity to something reasonable, that meets the following requirements:
The y-component must be negative (because computer graphics are drawn with the
positive y-axis facing down)
The x-component must not be zero, but should be different to what it was (i.e. if the user
was moving left, when they jump, they should also keep moving left, but at a different
speed)
Double/triple/etc. jumping is allowed, so you do not need to check that the player is on the
ground before jumping
4.5.2. Hotbar
When the user presses a number key (1-9, 0), the corresponding item in the hotbar should be
selected. If the corresponding item is already selected, it should instead be deselected. Note
that 1 corresponds to the first (leftmost) item in the hotbar, and 0 to the last (rightmost), etc.
4.6. File Menu & Dialogs
Implement a menu bar, with a menu. The File menu should have the following entries:
: Restarts the game
: Exits the application
set_health(health)
StatusView GameView
create_item
BlockItem
>>> wood = create_item(‘wood‘)
>>> wood # Is an object of BlockItem(‘wood‘)
>>> wood.place(...) # Returns an object of ResourceBlock(‘wood‘)
File
New Game
Exit
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 7/11
When the player attempts to exit the application, either by the file menu or otherwise, they
should first be prompted with a dialog to confirm that they indeed want to quit the application.
Further, if the player dies, they should be informed of this with a dialog, and asked if they want
to restart the game.
Note: On Mac OS X (and similar), the file menu should appear in the global menu bar (top of
the screen).
5. Task 2 – Intermediate Features
For any subclasses you implement, in addition to the required methods listed, you will also
need to override any relevant methods from the super class that would raise
. You will also need to modify the relevant functions to
allow your new things/items to be created.
5.1. More Items
Implement the following subclasses of the class and add them to the game:
5.1.1. FoodItem
Implement a class called which inherits from . When a
object is instantiated, it needs to be given an item identifier and a strength. The
class must have the following method:
get_strength() -> Returns the amount of food/health the item recovers the player by when
used.
Add a stack of 4 of these to the starting hotbar, and modify the function so that
leaf blocks can drop apples (a food item with 2-strength)
5.1.2. ToolItem
Implement a class called which inherits from . When equipped, the tools
damage certain blocks faster than the hands, and are able to mine materials that the hands
cannot (such as stone from stone blocks). A tool is depleted when its durability reaches zero.
When a object is instantiated, it needs to be
given an item identifier, the type of tool it will be and the tool‘s durability. The class must have
the following methods:
get_type() -> Returns the tool‘s type.
get_durability() -> Returns the tool‘s remaining durability.
can_attack() -> Returns True iff the tool is not depleted.
NotImplementedError create_*
Item
FoodItem Item FoodItem(item_id,
strength)
create_item
ToolItem Item
ToolItem(item_id, tool_type, durability)
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 8/11
attack(successful) -> Attacks with the tool; if the attack was not successful, the tool‘s
durability should be reduced by one.
Note: For tools made of a material, such as the stone axe, the should be
, according to the break tables in
For example
5.2. Crafting
The process of turning items into new items is called Crafting. The user can craft items and
reorder their inventory/hotbar in a crafting screen. When the user presses the ‘e‘ key, the basic
crafting screen should toggle (switch between showing in a new window & hiding).
Allow the user to reorder items in their inventory/hotbar by calling & hooking into the relevant
methods on the class. Further, allow the user to move items to and from the
simple crafter to craft new items.
5.3. CraftingTableBlock
Implement a class called which inherits from . When
used, this block should trigger the crafting table screen. From the block‘s perspective, this can
be achieved by returning an effect from the method.
Lastly, extend the method to open the crafting screen.
6. Task 3 – Advanced Features
6.1. Mobs
Mobs are non-player-characters in the game. They are living (have health) and can move
around. Some mobs can harm the player.
item_id
{material}_{tool_type} item.py
>>> diamond_axe = ToolItem(‘diamond_axe‘, ‘axe‘, 1337)
>>> diamond_axe.get_type() # => ‘axe‘
>>> diamond_axe.get_max_stack() # => 1
>>> for _ in range(995):
... diamond_axe.attack(False)
>>> diamond_axe.get_durability() # => 42
InventoryView
CraftingTableBlock ResourceBlock
use
>>> table = CraftingTableBlock()
>>> table.use() # => (‘crafting‘, ‘crafting_table‘)
>>> table.get_drops(0, True) # => [(‘item‘, (‘crafting_table‘,))]
NinedraftApp._trigger_crafting
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 9/11
To complete this sub-task, in addition to subclassing , you will need to add additional
blocks & items to the game, including the relevant function, and drawing method(s)
to the class.
6.1.1. Sheep
Implement a class called which inherits from .
Sheep move around randomly and do not damage the player.
When attacked, a sheep should drop wool ( ), without taking damage.
6.1.2. Bees
Implement a class called which inherits from .
Bees swarm the player, and individually cause a small amount of damage. They move slightly
quicker than the player, and swarm toward the player in a semi-random fashion. If there is a
honey block ( ) nearby (within 10 blocks), they will
instead swarm to the honey.
The player can attack bees, and with simple tools they should individually be destroyed in one
hit.
When the player mines a hive block ( ), 5 bees should spawn
and begin to swarm toward the player.
6.2. Furnace
The furnace allows the player access to another form of crafting, called smelting (also known
as cooking, baking, melting, drying, or burning). This process involves two items, a fuel source
and the item to be heated. For example, the player can cook grain on wood to produce bread.
See details on furnaces & smelting.
Implement the class which inherits from . Connect it to your code,
such that the player can craft a furnace on their crafting table using a ring of stone (a ring is a
3x3 grid, with nothing in the centre). This should yield an item that can be placed as a furnace
block, which when used opens the smelting screen.
Ensure that the smelting screen shows some sort of icon to represent the smelting — you may
use a simple canvas shape in place of the flame shown above.
7. CSSE7030 Task – Independent Research
7.1. Advanced Feature
Mob
create_*
WorldViewRouter
Sheep Mob
wool = Item(‘wool‘)
Bee Mob
honey = ResourceBlock(‘honey‘, ...)
hive = HiveBlock("hive")
FurnaceCrafter Crafter
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 10/11
This task involves adding a bow & arrow tool to the game. Add it to the player‘s starting
inventory.
When attacking, the bow should fire a flaming arrow at a trajectory matching the mouse‘s
position relative to the player. For example, if the player is centred at , and the
cursor is at , the bow should fire at a 45 degree angle to the left. The further the
mouse is from the player, the stronger the arrow should fire, up to some maximum (i.e. 4
blocks away).
It is intended that gravity should cause the arrow to drop, and not necessarily pass through the
position on the cursor. Further, the bow should always fire, regardless of whether the target is
in range.
Physics in Ninedraft is implemented in the class using the pymunk library, so to
successfully complete this task, you will need to research this library and subclass .
Further, to achieve full marks for this task, the flaming arrow must immediately destroy certain
blocks on contact:
Wood is instantly destroyed and drops nothing
Hive blocks are instantly destroyed, and drop honey ( ) without
spawning any bees.
8. Assignment Submission
Note: There will not be a practical interview for the third assignment.
Your assignment must be submitted via the assignment three submission link on Blackboard.
You must submit a zip file, , containing and all the files required to run your
application (including images). Your zip file must include all the support code.
Late submission of the assignment will not be accepted. Do not wait until the last minute to
submit your assignment, as the time to upload it may make it late. Multiple submissions are
allowed, so ensure that you have submitted an almost complete version of the assignment well
before the submission deadline. Your latest, on time, submission will be marked. Ensure that
you submit the correct version of your assignment. An incorrect version that does not work will
be marked as your final submission.
In the event of exceptional circumstances, you may submit a request for an extension. See the
course profile for details of how to apply for an extension. Requests for extensions must be
made no later than 48 hours prior to the submission deadline. The expectation is that with less
than 48 hours before an assignment is due it should be substantially completed and
submittable. Applications for extension, and any supporting documentation (e.g. medical
certificate), must be submitted via my.UQ. You must retain the original documentation for a
minimum period of six months to provide as verification should you be requested to do so.
(200, 200)
(100, 100)
World
World
BlockItem(‘honey‘)
a3.zip app.py
10/05/2019 Assignment 3 — CSSE1001 Semester 1, 2019
file:///Users/ben/university/tutoring/CSSE1001/2019s1/a3/2019s1a3/spec/dist/index.html 11/11
Change Log
Any changes to this document will be listed here.

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected]

微信:codinghelp

原文地址:https://www.cnblogs.com/xifua/p/10886772.html

时间: 2024-10-08 15:55:56

CSSE1001 Semester的相关文章

FIT9131 Semester 1 2019 Assignment

FIT9131 Semester 1 2019 Assignment 122 March 2019 1Nature Trail GameIntroductionAssignment 1 has two components: a programming task and a unit test. These components areassessed independently but BOTH are required. The programming component is worth

COSC2309/2347 Semester 1, 2019

Mobile Application DevelopmentCOSC2309/2347 Semester 1, 2019Movie Night PlannerAssignment 1 (20 marks)You are to implement a simple Movie Night Planner app to create andschedule movie viewing events and invite attendees. In this first assignment,you

CSSE1001 Supplementary Programming Exercise

CSSE1001 Supplementary Programming ExerciseCreate a simple banking application with a graphical user interface (GUI) for a banking system.The GUI is to be written from the perspective that the user is an employee of the bank (e.g. a teller).A bank ha

HCI - Interface -- 2015 -Year2 semester 4 - Coursework

一,本文为写essay所用,是一种思路的记录,也可视为我essay写作时的日志记录. 二,目前还处在资料搜集阶段.我是准备写 可穿戴式设备上的交互(interface),尤其是讨论用在 apple watch 和 Google glass上的技术. 三,就目前可知,用于apple watch上的新技术是 force touch,苹果自己给他取了个带逼格的名字叫做 force touch,其实这就是在新一代MacBook Air的触摸板上有应用的一项技术 - haptic technology.截

schedule of 2016-09-05~2016-09-11(Monday~Sunday)——1st semester of 2nd Grade

2016/9/5 Monday 1.modify the paper of emotiw2016 according to the suggestions made by editors & list some professors to contact 2.swimming 3.recite 50 words of baicizhan 4.do some exercises about TOEFL 5.write ieee paper & arrange the following wo

schedule of 2016-10-31~2016-11-6(Monday~Sunday)——1st semester of 2nd Grade

most important things to do 1.joint phd preparations 2.journal paper to write 3.solid fundamental knowledge including English 4.body fitness 2016/10/31 Monday 1.prepare ppt for this afternoon's group meeting 2.join the group meeting 3.modify ppt for

schedule of 2016-09-12~2016-09-18(Monday~Sunday)——1st semester of 2nd Grade

2016/9/12 Monday send present to Teacher Wei&hu 2016/9/13 Tuesday listen to the class as an assistant 2016/9/14 Wednesday 2016/9/15 Thursday 2016/9/16 Friday 2016/9/17 Saturday 2016/9/18 Sunday hold a meeting about BNU-LSVED 2.0 #####################

2017浙江省赛 E - Seven Segment Display ZOJ - 3962

地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3962 题目: A seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix

听力总结

段子1(不小心把出自哪套弄没了) 听力没掌握的发音: comparison participatory trading roads that led into town 好的表达: thought-provoking architecture geography come up with a new paper topic curious I am much more into history they didn't build towns so much as they built tradi