[SOLVED] 代写 game GUI python Introduction

30 $

File Name: 代写_game_GUI_python_Introduction.zip
File Size: 329.7 KB

SKU: 5525476445 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


Introduction
The goalof thisassignmentisto extendtheexistingsupportcode ofa mariostyle2D-platformerwritteninPythonusing tkinter.
To be successfulincompletingthisassignmentyou willhavetouse theconceptsand skillsthatyou havelearntSpecifically,. you will need to have a good understanding of GUIinterprogramm-classing,teractions, extending classes a
This document outlines the tasks that you will need to implement for this assignment.
Basic Running of the Game
Getting Started
The archivefile a3_files.zip containsallthenecessaryfilestostartthisassignmentA.significantamountofsupportcode has been provided to allow for the basicfunctionalityworkinggameto be implemented relatively. easily
The m ain assignmentfileis app.py , whic containsan incompleteimplementatioof MarioApp , the top-levelGUI application classoushould.Y add codeappto.py and modifyMarioApp to implement the necessary functionalit.
Allfeaturesand code you writeshouldbe placedinsideapp.py , level.py or player.py . You arenotpermittedto modify any files insidegame directorythe.Your assignment must be able to be launchedapp.py by runni

Becausethisassignmentdealswithmultiplefiles,whilenotrequired,you may wishtoinvestigatemore sophisticatedIDE. One optionPyCharmis,which isfree for students.
Pymunk Library
Physicsisimplementedinthegame usingthePymunk library.Itmay be usefulincompletingtheassignment to have an understandingsomeof of the components of the Pymunk library as you may need to refer to these
You willneedtoinstallthislibraryinordertoimplementyourtasksforthisassignment.Pymunk can be installedby running the includedsetup.py .
Overview
The assignment is broken down into three main tasks:
1.The first task involves modifying the app.py file to implement basicand somelaunchingadditionalofthe gam functionality
2.The second task involves extending the game mechanics to add more functionality to the 3.The third task is for you to independently design and implement a sufficiently complex f
Forpostgraduates:Thereisan additionaltaskforyou tocompleteYou. willneed toappropriatelyimplementanimations using sprite sheetsspriteshinthee ets folder.
Task 1 – Basic GUI 1.1 – Working Game
For this task, you will need toappwrite.py,whichcode inwill start the game when the filerequireisrun.youThisto wiwr the main function to launchtheMarioApp GUI.
You should modifyMarioApp so that the windowsomethingtitleis appropriate (e.g. “Mario”)
Once thegame runs,you willneed toimplementkeyboardbindingsYou. shouldfind an appropriatelocationtheclassto make bind calls for each of thepresseskeyboardto the appropriate method. The binds should behave as
Key
W , UP, SPACE A, LEFT
S, DOWN
D, RIGHT
Action
Makes the player jump (Hint:MarioAppsee._jump ). Moves the player to the leftMarioApp(Hint:._movseee ). Makes the player duck (Hint:MarioAppsee._duck ). Moves the player to the rightMarioApp(Hint:._movseee ).
1.2 – File Menu and Dialogs
Implement a menu for the game which has a top levelWithin”Filthe””File”menu. menu, you will need the fol
Button
Load Level
Purpose
Prompts the user with a popup textWheninputhediaplayerog. inputs a level filename,level load tha replacing the currently loaded level.

Button Purpose
Reset Level
Reset all player progress (e.g. health, score, etc) in the current level.
Exit Exits the game.
When a playerunsoutofhealth,you shouldshow a dialogueaskingwhethertheywanttorestartthecurrentlevelorexithe game.
Note: On Mac OS X, the file menu should appear in the global menu bar (top of the screen).
1.3 – Status Display
Implementa customtkinterwidget(i.ea.classwhichinheritsfrom tk.Frame ) whichdisplaysthescore and healthofthe player at the bottom of .the window
The player’sscoreshould be shown as a singlenumber.The healthoftheplayershouldbe displayedasa ‘healthbar'(similar to the image below)Thehealth. bar should be coloured as follows:
When the player has greater than or equal to 50% of theiritshouldmaximumbe health,coloured green. When the player has between 25% and 50% of their maximumitshouldhealth,becoloured orange. When the player has less than or equal to 25% of theiritshouldmaximumbe heacolouredth, red.
This widget needs to be updated when the score and health of the player. updates during game
Animated Health Bar Example
1.4 – Bounce Block
Implement a type of block which will propelthe theair playerwhentheyintowalk over or jump on top of the b The velocity with which you propel the player butshouldnoticbeablesensible.
Hint:ouY should implement a bounce block by makingclass whichanew extendsBlock .
You may (and should) utilisebounce_theblock image files founda3_ filesin.zip
The bounce block is represented by ,theb incharacterlevelfiles. 1.5 – Mushroom Mob
Implement a new type of mob which has the following properties:

The mob should move at a reasonably slow rate
When the mob collides with a block,orotherplayermob itreverseshould its direction:Mob(HINT.settempo )
When the mob collides with the side,theofplayerplayershould lose 1 health point and beawayslightlyfrom r the mob When a player lands on top of the mob, thebounceplayeroftheshouldtop of the mob and the mob should destroyed
You may find it useful to look at the existing mob handlingclasses andmethodscollisibefonre commencing this tas You may (and should) utilisemushroomtheimage files founda3_filesin.zip
The mushroom mob is represented by the,@ charactinlevelr files.
Task 2 – Extending the Game 2.1 – Star Item
Implementa typeofitemthatmakes theplayerinvinciblefor10 seconds(thatis,theyshouldnotbe abletotakeany damage during this time)Anymobs. that the player collides with during this timedeshouldtroyedbe. immediately
During the time the player is invincible, the player’sbecolouredhealthyellow.barshould
You should utilistaretheimage files founda3_filesin.zip The star is represented by the,* characterinlevel files.
2.2 – Goals
Implementa new typeofblockthatactsas a goaland allowschangingbetweenlevelsThe. blockshouldbe constructedwith an id and the name of levelthenextfileour. Ymust include at least the following two types of goals:
Type SpritePurpose
Flagpole
Tunnel
When a player collides with this, immediately take the Ifplayerthe playertothe landsnext l top of the flag pole, their health should be increased.
By default this should act as a normal, blockifthe. Howeverplayerthepressesdown key while standing on top of this block, the player anothershould belveltaken. to
A player’s current state (coins, health, etc) should not changeapartwhenfromthetheirlevelpositionchanges,. You may find theGOAL_SIZES constant definedappin.py useful in determining the size of the various goa You may also find flagthe and tunnel image filesa3infiles.zip useful.
The flags and tunnels are represented by theIandcharacters,=respectively in level files.
The levels loaded by the flag and tunnel may be hardcoded until the next task is completed
2.3 – Loading Configuration
Implementhe abilitytoloada configurationfilefora game ofmarioWhen. thegame islaunched theusershouldbe prompted to enter the fileforpathconfiguration file.
The configuration file will be in a similar format to .the example given below

==World==
gravity : 400 start : level1.txt
==Player== character : luigi x : 30
y : 30
mass : 100
health : 4 max_velocity : 100
==level1.txt== tunnel : bonus.txt goal : level2.txt
==bonus.txt==
goal : level1.txt
==level2.txt==
tunnel : small_room.txt goal : level3.txt
==small_room.txt== goal : level2.txt
==level3.txt== goal : END
At the minimum, a configuration file ==World==willincludetag, a==Player==a tagand a tag forthelevelspecifiedas start in ==World==
A ==World== tagshouldave a gravity propertywhichwillsetthegravityofa worldwhen itisconstructedItshould.also contain start property which will be the filepath of the first level to load.
A ==Player== tag should have the following properties:
character: This can be either mario or luigi and will change the image displayed in gam x: This is the starting x co-ordinate. of the player
y: This is the starting y co-ordinate. of the player
mass: This is the weight of the player set when adding the player to the world.
health: This is the maximum amount of health a player will have.
max_velocity: This is the maximum x velocity that a player can reach when moving.
Each of the levels should have it’s==level==owntag,where.glevel. is the file path of that level.
A leveltagshouldhavea goal propertywhichisthefilenameoftheleveltoloadwhen theplayereaches flag goalblock. If the next level is END then it should prompt theoveruserandthatclosethe thegamegameis. window
A level tag may also tunnelhave aproperty which is theoffilenamethelevel to load when the player enters
Ifthe configurationfileisinvalid,ormissingand cannotbe parsed,you shouldalerttheuserviaa tkinter errormessage box and then exit the game.
2.4 – Switches
Implementanew typeofblockthatactslikeaswitchWhen. a playerlandson-topofa switch, all bricks within a cl the switch should disappear.Aplayershould not be able to trigger a switch by walking into the stopide o moving as if it were any other block).

When a switchispressed,itshouldremainina ‘pressed’state( )for 10 secondsDuring.thistime,theplayershouldnotbe abletocollidewiththisblock(HINT:returningFalse froma collisionhadlerwillturnofcollisions)After.thistime,theswitch should revert to its original state and all invisible bricks should become visible again.
It is up to you to pick a sensible radius for the switch.enItplayingneeds towithbe thenoticabsupplied level You may (and should) utilswitchse theand switch_pressed image files founda3_filesin.zip The switch is represented by the,S characterinlevel files.
2.5 – High Scores
In this task you should implement a way to store the high scores for each level in a file.
The highscoreinformatioshouldbe storedin(a)txtfile(s)ina reasonableformatThe. exactformatofthefile(s)and way the data is
stored is up to youmaybutbe marksdeducted for inappropriate save format.
When a playereaches goal(andthereforefinishesa level),prompttheuserviaa dialogfortheirname and storethescore theyhad attheend of theleveltotherelevantfileforthe level(creatingitifitdoesn’texist)Adding.a new entrytothefile shouldn’t remove any existing entries already in it.
Add a buttonto thefilemenu called”HighScores”When. clickedthiswillopen a new custom tk.TopLevel window displayingthenames and scoresfthetoptenhighestscorersforthecurrentlevel,sortedindescendingorderby scoreNote. thathe filemighthavemore orlessthantenentries,butyou shouldn’tdisplaymore thanthetoptenentriesinthewindow.If the file doesn’t exist, the dialog shouldn’t display any entries.
Task 3 – Over to You
Forthistaskyou areexpectedtodemonstrateyourabilitytointelligextendly thefeaturesofthebasegame.The features that you chooseimplementtoareleftup toyou.Forfullmarksinthistaskyourfeatureswillneed tobe ofsufficientcomplexity. For example, soundfectsefare generallynotdeemed to be of ‘sufficient complexity’.
Itishighlyencouragedthatyouonlyattemptthistaskifyoufeelconfidentinyourprogramingability.You willneedtodiscuss yourplansforthistaskwitha tutorina practicalorviaa privatequestion PiazzaThe. tutorwillbe abletoadviseyou as to whether your intended feature is of sufficient complexity to gain marks.
If you are attempting to implement this task then youPDFmustwhichsubmitoutlinaexactlysfeaturewhatfeaturesyouhave implemented and thousew themwhen runningyourassignmentThe. PDF shouldincludescreenshotsofthefeaturesand a brief description offeatureshowthe were implemented.
Hints
Ifyou arethinkingaboutusingpygame foryourtaskthreepleasensurethatyou discussitwitha tutor as pygame shouldbe avoided
where possible.
Ifyou attemptask3 and itrequiresadditionalassetsthenyou areallowedtozipyourentireprojectand submithatEnsure. thatextractingthezipwillhave app.pyat thetoplevelYou. must mentioninyourfeatures.pdfdocumentthatyou have submitted a zip and what additional assets were included.
If your feature wants ferenttohavefunctionalitydiftheW forandUP keys you may rebind those keys. If your feature.pdf does not clearlyfeatureexplainthenyour may not receive marks for that feature.
Postgraduate Task
The taskforpostgraduatestudentsistoimplementa classSpriteSheetLoader whichisabletoloadimagesfroma sprite sheetA. spritesheetisan imagewhichconsistsofmultiplesmallerimages,see thespritesheetsfolderforreferenceThe.

SpriteSheetLoader shouldbe abletoloadone ofthesmallerimages froma spritesheetbasedon thesmallerimages location and position within the sheet.
Hint:o Timplement this, you will want to investigatePillowlibraryusing the
Hint:To implementthis,you may alsowanttoinvestigatemakinga new ViewRenderer subclass tohandlespritesheets. Ensure that loaded images are storesself._imagesinthedictionary within theViewRenderernew subclass.
In addition to loading images from a spritesheet,toimplementyouwillanimationsneed for the following entiti
Player: When the player is walking, jumping or plfallingyerwithanimatethe appropriatethe sprites from characters sprite sheet.
Mushroom Mob: When the mushroom mob is walking, animate theappropriatewalkusingspritesthe fromenemiesthe sprite sheet.
Mushroom Mob: When the mushroom mob is jumped on, animate the squishingappropriateusingspritthes from enemies
sprite sheet.
Coins: Animate the coin to be spinningapproprusingatethesprites fromitems thesprite sheet.
Bounce Block: When the bounce block is used,exteansionimateofthethe bounce block using the sprit items sprite sheet.
Support Code
app.py
W orld creationMarioAppin.__init__ replaced withMarioApp.reset_world MarioApp.reset_world fixed when changing levels
MarioApp.scroll behaviour changed
level.py
load_world nowacceptsandpassesWorldBuilderargsto.add_entity
world.py
New methodWorld.get_things_in_range added
player.py and entities.py
Removed Player.is_jumping andPlayer.set_jumping
Added DynamicEntity.is_jumping andDynamicEntity.set_jumping

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 game GUI python Introduction
30 $