Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8. <head>
  9. <title>TODO supply a title</title>
  10. <meta charset="UTF-8">
  11. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  12. <script src="_Ludzik.js"></script>
  13. <style>
  14. .gracz {
  15. width: 80px;
  16. height: 105px;
  17. background: url('sprite.png');
  18. position: absolute;
  19. /*background-position: -80px -210px;*/
  20. }
  21.  
  22. </style>
  23. <script>
  24.  
  25. //window.innerWidth, window.innerHeight - wymiary viewportu(okna przegladarki)
  26. console.log('Szerokosc: '+window.innerWidth+'Wysokosc: '+window.innerHeight );
  27.  
  28.  
  29. //onload - zdarzenie zachodzi kiedy caly dokument zostanie zaladowany
  30. function start() {
  31. //utworzenie pionka
  32.  
  33. var p1 = new _Ludzik('gracz1');
  34. var p2 = new _Ludzik('gracz2');
  35.  
  36. }
  37.  
  38. function animacja() {
  39. klatka -= 80;
  40. pionek.style.backgroundPosition = klatka+"px "+wiersz+"px";
  41.  
  42. }
  43.  
  44.  
  45.  
  46. // function wPrawo() {
  47. // //offsetTop, offsetLeft = tylko do odczytu - pozycja
  48. // //offsetWidth, offsetHeight - tylko do odczytu - rozmiar
  49. // pionek.style.left = (pionek.offsetLeft)+krok+'px';
  50. // pionek.style.background = "yellow";
  51. // }
  52. //
  53. // function wLewo() {
  54. // pionek.style.left = (pionek.offsetLeft)-krok+'px';
  55. // pionek.style.background = "blue";
  56. // }
  57. //
  58. // function wGore() {
  59. // pionek.style.top = (pionek.offsetTop)-krok+'px';
  60. // pionek.style.background = "gray";
  61. // }
  62. //
  63. //
  64. // function wDol() {
  65. // pionek.style.top = (pionek.offsetTop)+krok+'px';
  66. // pionek.style.background = "black";
  67. // }
  68. </script>
  69. </head>
  70. <body onload="start()">
  71. <form>
  72. <input type="button" value="lewo" onclick="przesun(1)">
  73. <input type="button" value="góra" onclick="przesun(2)" >
  74. <input type="button" value="prawo" onclick="przesun(3)">
  75. <input type="button" value="dół" onclick="przesun(4)">
  76. <input type="button" value="STOP" onclick="clearInterval(interwal)">
  77.  
  78.  
  79. </form>
  80. <hr>
  81. <div id="plansza"></div>
  82. </body>
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement