Sowecanassumethatsell X isequaltothemouse's location.
X interviewdividedbythetileswidthandit's theinterviewdivide.
That's importantbecausethatwillgiveus a wholenumberanddiscardanyremainderispartofthedivision, sothatwillalwaysgiveus a locationthatrepresentsthecellconvenientlyweaken.
Sothiswillgiveus a offsetinscreenpixelsofhowfarthemousecoordinatesisintothetile.
Andnaturally, wehave a correspondingforwhy.
Sometimesit's helpfultonormalizethisvaluebydividingaswellbytilewhippedandtellheighttogiveus a valuebetweenzeroandonetorepresentwherethemouseiswithinthecell.
Andifweknowtheoverallwidthofourworld, thenwecaneasilytakeourcells X and Y locationandconvertthatinto a onedimensionalindexintoanarraythatrepresentsthisworld.
I'm justgoingtodraw a rectangleatthecell's location, multipliedbythesizeofthetile, and I'm alsogoingtothrowinsomeonscreentextsowecanvisualizethecoordinates.
Sohereyoucanseeas I movethemousearound, a screamcellisselected, andif I movedtothetopleft, itevensayssell 00 Thisissomethingwe'vedonemany, manytimes.
As I moveuponeinworldspace, I havedeckremittedinboththe X onDwightaxesandas I movedownwards, I'veincriminatedinboththe X and Y axesinworldspace.
As I moveleft, I haveDeckermintedinthe X axis, butincrementIDinthe Y axis, andas I movedright.
I'veincrementIDinthe X axis, butdeckremittedinthe Y axisasbefore, we'regoingtoneed a transformationthattakesournowscreencellspacecoordinateandtransformsitinto a worldcoordinate.
Andagain, it's a multicomponentequationasboth X andwindscreenspacefactorintotheIndividual X's and y's inourworld.