Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.

Get a Professional Answer

Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.

100% Satisfaction Guarantee

Rate the answer you receive.

Ask Scott Your Own Question

Scott, MIT Graduate

Category: Homework

Satisfied Customers: 3040

Experience: MIT Graduate (Math, Programming, Science, and Music)

3546829

Type Your Homework Question Here...

Scott is online now

Create a heads-up display (HUD) at the top of the screen

Customer Question

Create a heads-up display (HUD) at the top of the screen (using a new

element and associated CSS) that displays the following. The game title Player position (measured in cells (e.g., 1,2 or 4,5) Coding needs: a new method for player named showPosition() that captures the current position on each iteration of the game loop and displays the text in the HUD Percentage of the distance to the goal (measured as %) completed at the current position Coding needs: need to code an addition for the showPosition() method above that calculates the diagonal distance to the end of the maze from the current position, and then calculates the ratio of that current distance to the total distance (which is the diagonal from position 1,1 to position 14,14). The result is then displayed as text in the HUD. For example, total distance on a diagonal from 14,14 to 1,1 would be 13 / sin(45) or sqrt(13 * 13 + 13 * 13) = 18.3. So, if player is at position coordinates of 5,13, the distance from that point is sqrt(4 * 4 + 12 * 12) = 12.6. So the ratio is 12.6 / 18.3 = 0.69 or 69%—but the percentage completed would be 100% - 69% = 31%. Success when the goal is reached (defined as arriving at 1,1 on the minimap)