The Zurich release has arrived! Interested in new features and functionalities? Click here for more

AM_Guy
Tera Contributor

We decided to have some fun and implemented Pong in Service-Now.   Yes we cheated a little by using someone else's code.   It is also one player.   But still fun.

Pong.png

Here is the tutorial we used: http://cssdeck.com/labs/ping-pong-game-tutorial-with-html5-canvas-and-sounds

He conveniently already has the code broken out to make it easy to put into a UI Page.

Steps

  1. In the left-nav filter, type "ui pages"
  2. Click on UI Pages, then click New
  3. For the name, type "pong"
  4. Copy the HTML from the blog referenced above and paste it into the HTML on the UI Page
  5. We skipped the CSS he put on the body
  6. Copy the Javascript from the blog and paste it into the Client Script section of the UI Page
  7. [Optional] We also changed line 26 and line 27 to a set width and height
    1. Line 26 was changed to: W = 800,
    2. Line 27 was changed to: H = 600,
  8. Save the page and click Try It
  9. Try going to https://{instance}/service-now.com/nav_to.do?uri=pong.do

We also made some other modifications to the Client Script section to track high scores.   We query the user record and write their score to a scores table, then present it at the end of the game.

Pong2.png

Maybe someday we'll write a version that let's two help desk techs play against each other