Video Games and Coordinate Planes

U
UNPLUGGED
VideoGamesand
CoordinatePlanes
Lessontime:30-60Minutes
LESSONOVERVIEW
Studentsdiscussthecomponentsoftheirfavoritevideogamesanddiscoverthattheycanbereducedtoaseries
ofcoordinates.TheythenexplorecoordinatesinCartesianspace,identifyingthecoordinatesforthecharactersin
agameatvariouspointsintime.Oncetheyarecomfortablewithcoordinates,theybrainstormtheirowngames
andcreatesamplecoordinatelistsfordifferentpointsintimeintheirowngame.
LESSONOBJECTIVES
Studentswill:
Createadatamodelthatdescribesasimplevideogame.
Describethemovementsofvideogamecharactersbytheirchangeincoordinates.
ANCHORSTANDARD
CommonCoreMathStandards
6.NS.8:Solvereal-worldandmathematicalproblemsbygraphingpointsinallfourquadrantsofthecoordinate
plane.Includeuseofcoordinatesandabsolutevaluetofinddistancesbetweenpointswiththesamefirst
coordinateorthesamesecondcoordinate.
Additionalstandardsalignmentcanbefoundattheendofthislesson
TEACHINGSUMMARY
GettingStarted
1)Vocabulary
2)LearningaLanguage
Activity:VideoGamesandtheCoordinatePlane
3)ReverseEngineeraDemo
4)CoordinatePlanes
Wrap-up
5)BrainstormingaGame
TEACHINGGUIDE
MATERIALS,RESOURCES,ANDPREP
FortheStudent
ReverseEngineeringTable(inthestudentworkbook)
VideogameDesignTemplate(inthestudentworkbook)
FortheTeacher
Lessonslidedeck
ExampleGame
PrintedcutoutsoftheNinja,Dragon,andUnicorn
GETTINGSTARTED
1)Vocabulary
Thislessonhasthreenewandimportantwords:
Apply-useagivenfunctiononsomeinputs
ReverseEngineer-toextractknowledgeordesigninformationfromanexistingproduct
Sprite-agraphiccharacteronthescreen.Sometimescalledabitmaporanimage.
2)LearningaLanguage
WelcometoCode.orgCSinAlgebra!Inthiscourseyou’llbelearninganewprogramminglanguage-awaytotell
computersexactlywhatyouwantthemtodo.JustlikeEnglish,SpanishorFrench,aprogramminglanguagehas
itsownvocabularyandgrammarthatyou’llhavetolearn.Fortunately,thelanguageyou’llbeusingherehasalot
incommonwiththesimplemaththatyoualreadyknow!
Connectthismaterialwiththingsstudentsalreadyknow:
Whatmakesalanguage?
Doesanyonespeakasecond(orthird)language?Doyouspeakadifferentlanguagethanyour
parents/grandparents?
Aretherelanguagesthatsharefeatures,suchasacommonroot(Romance,Germanic)orasimilaralphabet
(Latin,Cyrillic,Arabic,Kanji)?
Aretherelanguagesthataredesignedforspecificpurposesorwithincertainconstraints(signlanguage,
Esperanto)?
Mathisalanguage,justlikeEnglish,Spanish,oranyotherlanguage!
Weusenouns,like"bread","tomato","mustard"and"cheese"todescribephysicalobjects.Mathhasvalues,
likethenumbers1,2or3,todescribequantities.
Wealsouseverbslike"toast","slice","spread"and"melt"todescribeoperationsonthesenouns.
Mathematicshasfunctionslikeadditionandsubtraction,whichareoperationsperformedonnumbers.
Justasyoucan"slicepieceofbread",apersoncanalso"addfourandfive".
Amathematicalexpressionislikeasentence:it’saninstructionfordoingsomething.Theexpression4+5tellsus
toadd4and5.Toevaluateanexpression,wefollowtheinstructionsintheexpression.Theexpression4+5
evaluatesto9.
ACTIVITIES:
3)ReverseEngineeraDemo
Let’sbeginbyexploringasimplevideogame,andthenfiguringouthowitworks.Openthislinktoplaythegame,
andspendaminuteortwoexploringit.Youcanusethearrowkeystomovetheupanddown-trytocatchthe
unicornandavoidthedragon!
Thisgameismadeupofcharacters,eachofwhichhasitsownbehavior.Theunicornmovesfromthelefttothe
right,whilethedragonmovesintheoppositedirection.Theninjaonlymoveswhenyouhitthearrowkeys,and
canmoveupanddown.Wecanfigureouthowthegameworksbyfirstunderstandinghoweachcharacterworks.
Directions:
1)Dividestudentsintogroupsof2-4.
2)Provideeachstudentwithacopyofthereverse-engineeringtable.
3)Asstudentsdemothegame,askthemtofillinthe"Thinginthegame..."columnwitheveryobject
theyseeinthegame.
4)Discusswiththewholegroupwhichthingstheycameupwith.Characters?Background?Score?
5)Next,foreachofthethingsinthegame,fillinthecolumndescribingwhatchanges.Size?
Movement?Value?
6)Askstudentstosharebackwiththewholegroup.Notehowstudentsdescribedchanges-how
detailedwerethey?Whatwordsdidtheyusetodescribemovement?
4)CoordinatePlanes
Computersusenumberstorepresentacharacter’spositiononscreen,using
numberlinesasrulerstomeasurethedistancefromthebottom-leftcornerofthe
screen.Forourvideogame,wewillplacethenumberlinesothatthescreenruns
from0(ontheleft)to400(ontheright).WecantaketheimageoftheDragon,stickit
anywhereontheline,andmeasurethedistancebacktothelefthandedge.Anyone
elsewhoknowsaboutournumberlinewillbeabletoduplicatetheexactpositionof
theDragon,knowingonlythenumber.WhatisthecoordinateoftheDragonontherighthandsideofthescreen?
Thecenter?WhatcoordinatewouldplacetheDragonbeyondthelefthandedgeofthescreen?
LESSONTIP
Thekeypointforstudentshereisprecisionandobjectivity.Therearemanypossiblecorrect
answers,butstudentsshouldunderstandwhyanysolutionshouldbeaccurateandunambiguous.
Thisrequiresstudentstoproposesolutionsthatshareacommon"zero"(thestartingpointoftheir
numberline)anddirection(literally,thedirectionfromwhichacharacter’spositionismeasured).
Byaddingasecondnumberline,wecanlocateacharacteranywhereonthescreen
ineitherdimension.Thefirstlineiscalledthex-axis,whichrunsfromlefttoright.The
secondline,whichrunsupanddown,iscalledthey-axis.A2-dimensionalcoordinate
consistsofboththex-andy-locationsontheaxes.Supposewewantedtolocatethe
Ninja’spositiononthescreen.Wecanfindthex-coordinatebydroppingalinedown
fromtheNinjaandreadthepositiononthenumberline.They-coordinateisfoundby
runningalinetothey-axis.
Acoordinaterepresentsasinglepoint,andanimageis(bydefinition)manypoints.
Somestudentswillaskwhetheracharacter’scoordinatereferstothecenterofthe
image,oroneofthecorners.Inthisparticularprogram,thecenterservesasthecoordinate-butotherprograms
mayuseanotherlocation.Theimportantpointindiscussionwithstudentsisthatthereisflexibilityhere,aslongas
theconventionisusedconsistently.
Whenwewritedownthesecoordinates,wealwaysputthexbeforethey(justlikeinthealphabet!).Mostofthe
time,you’llseecoordinateswrittenlikethis:(200,50)meaningthatthex-coordinateis200andthey-coordinateis
50.
Dependingonhowacharactermoves,theirpositionmightchangeonlyalongthex-axis,onlyalongthey-axis,or
both.Lookbacktothetableyoumade.CantheNinjamoveupanddowninthegame?Canhemoveleftand
right?Sowhat’schanging:hisx-coordinate,hisy-coordinate,orboth?Whatabouttheclouds?Dotheymoveup
anddown?Leftandright?Both?
OPTIONALACTIVITY:Dependingontimingandthebackgroundofyourstudents,havingonestudentplacea
characteronalargegraphandanotherstudentstatingthecoordinatesisexcellentpractice.Studentsoftenneed
extrapracticerememberingwhichcoordinatecomesfirst.Coordinatesdonothavetobeexactbuttheyshouldbe
inthecorrectorder.Extendingthistoallfourquadrantstoincludenegativenumbersisalsoexcellentpractice.
Fillintherestofthereverse-engineeringtable,identifyingwhatischangingforeachofyourcharacters.
WRAP-UP
5)BrainstormingforaGame
Usethegameplanningtemplatetomakeyourowngame.JustlikewemadealistofeverythingintheNinja
game,we’regoingtostartwithalistofeverythinginyourgame.Tostart,yourgamewillhavefourthingsinit:
ABackground,suchasaforest,acity,space,etc.
APlayer,whocanmovewhentheuserhitsakey.
ATarget,whichfliesfromtherighttotheleft,andgivestheplayerpointsforhittingit.
ADanger,whichfliesfromtherighttotheleft,whichtheplayermustavoid.
LESSONTIP
Thestructureofyourstudents'gameswillverycloselyresemblethedemothey'vejustplayed.Many
studentswillwanttoreachforthestarsanddesignthenextHalo.Remindthemthatmajorgameslike
thattakemassiveteamsmanyyearstobuild.Someofthemostfunandenduringgamesarebuilton
verysimplemechanics(thinkPacman,Tetris,orevenFlappyBird).
Derivedfrom
ThiscurriculumisavailableunderaCreativeCommonsLicense(CCBY-NC-SA4.0)
IfyouareinterestedinlicensingCode.orgmaterialsforcommercialpurposes,contactus:https://code.org/contact