Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <!-- quite definitely a work-in-progress
  2. see the description for more details
  3.  
  4. - move the tank with the arrow keys ← →
  5. - shoot projectiles with the up arrow key ↑
  6.  
  7. feel free to use the a-w-d keys or the buttons for the same result
  8. -->
  9.  
  10. <!-- define a blocky arrow pointing upwards -->
  11. <svg viewBox="0 0 100 100" style="display: none;">
  12. <defs>
  13. <rect id="square" x="-10" y="-10" width="20" height="20" fill="currentColor"></rect>
  14. <g id="arrow" transform="translate(50 50)">
  15. <use href="#square"></use>
  16. <use href="#square" y="40"></use>
  17. <use href="#square" x="40"></use>
  18. <use href="#square" x="-40"></use>
  19. <use href="#square" x="20" y="-20"></use>
  20. <use href="#square" x="-20" y="-20"></use>
  21. <use href="#square" x="0" y="-40"></use>
  22. </g>
  23. </defs>
  24. </svg>
  25.  
  26. <!-- in the controls re-use the blocky arrow changing the rotation to identify the left and right arrow keys -->
  27. <div class="controls">
  28. <!-- specify a negative tab index to avoid keyboard focus
  29. the game is played through the arrow or AWD keys
  30. -->
  31. <button tabindex="-1" id="left">
  32. <svg style="transform: rotate(-90deg);" viewBox="0 0 100 100" width="30" height="30">
  33. <use href="#arrow"></use>
  34. </svg>
  35. </button>
  36. <button tabindex="-1" id="fire">
  37. <svg viewBox="0 0 100 100" width="30" height="30">
  38. <use href="#arrow"></use>
  39. </svg>
  40. </button>
  41. <button tabindex="-1" id="right">
  42. <svg style="transform: rotate(90deg);" viewBox="0 0 100 100" width="30" height="30">
  43. <use href="#arrow"></use>
  44. </svg>
  45. </button>
  46. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement