With these problems, I like to change everything to 3D coordinates to make it easier for me to understand.
Currently, the room is a rectangular prism with important vertices of \((0,0,0)\) and \((12,10,8)\).
Now we should find out the gecko's current position. It shouldn't matter what side wall is chosen for the lil guy to be on, because the answer will be the same in this case, so we can choose the side wall closest to the origin, with an x-value of 0. Also depending on what you choose to be the front and back wall, this will affect the coordinates. I have illustrated how I chose such. Definitely not to scale.
In this sense, the Gecko's coordinates are \((0,0+1,8-1) = (0,1,7)\) and the fly's are \((12,10-1,0+1) = (12,9,1)\). With the tricky bit out of the way, we can now just use the 3D distance formula.
\(D = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}\), or in our case \(D = \sqrt{(x_F-x_G)^2+(y_F-y_G)^2+(z_F-z_G)^2}\)
\(D = \sqrt{(12-0)^2+(9-1)^2+(1-7)^2} = \sqrt{144+64+36} = \sqrt{244} = 2\sqrt{61}\)
.