Advertisement
EduzZiTo

Jogo das minas

Dec 10th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.04 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Bombs</title>
  5. <style type="text/css">
  6. table {
  7. border: 1px solid black;
  8. width: 450px;
  9. height: 25px;
  10. margin: auto;
  11. border-radius: 5px;
  12. text-align: center;
  13. background-color:black;
  14. color:white;
  15. }
  16. td,tr{
  17. width:50px;
  18. height:50px;
  19. text-align:center;
  20. border:1px solid black;
  21. position:relative;
  22. background-color:black;
  23. color:white;
  24. }
  25.  
  26. body{
  27. background-image: url("https://image.freepik.com/free-vector/word-pow-with-bomb-explosive_1308-3299.jpg");
  28. }
  29.  
  30.  
  31. .off {
  32. background-color: white;
  33. }
  34.  
  35. .on {
  36. background-color: lightblue;
  37. }
  38.  
  39. p {
  40. text-align: center;
  41. }
  42. #tb1{
  43. color:transparent;
  44. }
  45. #bt1{
  46. background-color: lightblue;
  47. color:black;
  48. border-radius: 5px;
  49. width: 150px;
  50. height: 50px;
  51.  
  52.  
  53. }
  54. #bt2{
  55. background-color: lightblue;
  56. color:black;
  57. border-radius: 5px;
  58. width: 150px;
  59. height: 50px;
  60. }
  61. </style>
  62. </head>
  63.  
  64.  
  65. <body >
  66. <iframe style="display:none;"width="560" height="315" src="https://www.youtube.com/embed/ad5TszNUVYI?rel=0&autoplay=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
  67. <h1>Evita a tua morte neste jogo escapando de todas as bombas escondidas</h1>
  68. <p> Existem 11 bombas e 38 campos sem bomba, o objetivo é conseguir acertar nos sem bomba... Boa sorte :)!</p><br>
  69. <table id="tb1">
  70. <h2 style="text-align:center; color:Purple;">Campo de JOGO</h2>
  71. <tr>
  72. <td class="off" id="1" onclick="marca('1');">&nbsp;</td>
  73. <td class="off" id="2" onclick="marca('2');">&nbsp;</td>
  74. <td class="off" id="3" onclick="marca('3');">&nbsp;</td>
  75. <td class="off" id="4" onclick="marca('4');">&nbsp;</td>
  76. <td class="off" id="5" onclick="marca('5');">&nbsp;</td>
  77. <td class="off" id="6" onclick="marca('6');">&nbsp;</td>
  78. <td class="off" id="7" onclick="marca('7');">&nbsp;</td>
  79. </tr>
  80. <tr>
  81. <td class="off" id="8" onclick="marca('8');">&nbsp;</td>
  82. <td class="off" id="9" onclick="marca('9');">&nbsp;</td>
  83. <td class="off" id="10" onclick="marca('10');">&nbsp;</td>
  84. <td class="off" id="11" onclick="marca('11');">&nbsp;</td>
  85. <td class="off" id="12" onclick="marca('12');">&nbsp;</td>
  86. <td class="off" id="13" onclick="marca('13');">&nbsp;</td>
  87. <td class="off" id="14" onclick="marca('14');">&nbsp;</td>
  88. </tr>
  89. <tr>
  90. <td class="off" id="15" onclick="marca('15');">&nbsp;</td>
  91. <td class="off" id="16" onclick="marca('16');">&nbsp;</td>
  92. <td class="off" id="17" onclick="marca('17');">&nbsp;</td>
  93. <td class="off" id="18" onclick="marca('18');">&nbsp;</td>
  94. <td class="off" id="19" onclick="marca('19');">&nbsp;</td>
  95. <td class="off" id="20" onclick="marca('20');">&nbsp;</td>
  96. <td class="off" id="21" onclick="marca('21');">&nbsp;</td>
  97. </tr>
  98. <tr>
  99. <td class="off" id="22" onclick="marca('22');">&nbsp;</td>
  100. <td class="off" id="23" onclick="marca('23');">&nbsp;</td>
  101. <td class="off" id="24" onclick="marca('24');">&nbsp;</td>
  102. <td class="off" id="25" onclick="marca('25');">&nbsp;</td>
  103. <td class="off" id="26" onclick="marca('26');">&nbsp;</td>
  104. <td class="off" id="27" onclick="marca('27');">&nbsp;</td>
  105. <td class="off" id="28" onclick="marca('28');">&nbsp;</td>
  106. </tr>
  107. <tr>
  108. <td class="off" id="29" onclick="marca('29');">&nbsp;</td>
  109. <td class="off" id="30" onclick="marca('30');">&nbsp;</td>
  110. <td class="off" id="31" onclick="marca('31');">&nbsp;</td>
  111. <td class="off" id="32" onclick="marca('32');">&nbsp;</td>
  112. <td class="off" id="33" onclick="marca('33');">&nbsp;</td>
  113. <td class="off" id="34" onclick="marca('34');">&nbsp;</td>
  114. <td class="off" id="35" onclick="marca('35');">&nbsp;</td>
  115. </tr>
  116. <tr>
  117. <td class="off" id="36" onclick="marca('36');">&nbsp;</td>
  118. <td class="off" id="37" onclick="marca('37');">&nbsp;</td>
  119. <td class="off" id="38" onclick="marca('38');">&nbsp;</td>
  120. <td class="off" id="39" onclick="marca('39');">&nbsp;</td>
  121. <td class="off" id="40" onclick="marca('40');">&nbsp;</td>
  122. <td class="off" id="41" onclick="marca('41');">&nbsp;</td>
  123. <td class="off" id="42" onclick="marca('42');">&nbsp;</td>
  124. </tr>
  125. <tr>
  126. <td class="off" id="43" onclick="marca('43');">&nbsp;</td>
  127. <td class="off" id="44" onclick="marca('44');">&nbsp;</td>
  128. <td class="off" id="45" onclick="marca('45');">&nbsp;</td>
  129. <td class="off" id="46" onclick="marca('46');">&nbsp;</td>
  130. <td class="off" id="47" onclick="marca('47');">&nbsp;</td>
  131. <td class="off" id="48" onclick="marca('48');">&nbsp;</td>
  132. <td class="off" id="49" onclick="marca('49');">&nbsp;</td>
  133. </tr>
  134. </table>
  135. <br >
  136. <p><input id="bt1" type="button" name="reset" value="Reset" onclick="reset();" disabled=true;><input id="bt2"type="button" name="Start" value="START" onclick="começa();"></p>
  137. <table>
  138. <tr>
  139. <td id="vida">Vidas: 3 &#10084;</td>
  140. </tr>
  141. </table>
  142.  
  143. <br >
  144. <table>
  145. <tr>
  146. <td id="h">00</td>
  147. <td id="m">00</td>
  148. <td id="s">00</td>
  149. <td id="c">00</td>
  150. </tr>
  151.  
  152. </table>
  153. <br >
  154. <br >
  155. <table>
  156. <tr>
  157. <td >Tempo ate perder:</td>
  158. <td id="tmp"></td>
  159. </tr>
  160. </table>
  161. <script type="text/javascript">
  162. var vida=3;
  163. var ta = 0;
  164. var win = 1;
  165. var c = 0;
  166. var s=0;
  167. var a=0;
  168. var t=0;
  169. var start;
  170. var sorteio = new Array(49);
  171. var mina = new Array(6);
  172. //Criar vetores iniciais
  173. function iniciar() {
  174. for (i = 1; i <= 49; i++) {
  175. document.getElementById(i).innerHTML='&nbsp;';
  176. sorteio[i] = 0;
  177. }
  178. for (i = 1; i <= 11; i++) {
  179. mina[i] = 0;
  180. }
  181. document.getElementById('vida').innerHTML=3 + '&#10084;';
  182. }
  183. //Local on se clica
  184. function marca(x) {
  185. if(start==1){
  186. document.getElementById('bt1').disabled = false;
  187. document.getElementById('bt2').disabled = true;
  188. if(document.getElementById(x).innerHTML=='&nbsp;'){
  189. d++;
  190. a++;
  191. if(d==1){
  192. myFunction();
  193. }
  194. document.getElementById(x).className='on';
  195.  
  196. switch(sorteio[x]){
  197. case 1: document.getElementById(x).innerHTML='&#10084;';
  198. document.getElementById('vida').innerHTML=parseInt(document.getElementById('vida').innerHTML)+1 + '&#10084;';
  199. break;
  200. case 2: document.getElementById(x).innerHTML='&#128163;';
  201. document.getElementById('vida').innerHTML=parseInt(document.getElementById('vida').innerHTML)-1 + '&#10084;';
  202. d--;
  203. break;
  204. }
  205.  
  206. if(parseInt(document.getElementById('vida').innerHTML)==0 ){
  207. start=0;
  208. alert("Perdeu :((");
  209. clearInterval(mytime);
  210. registar();
  211.  
  212. }
  213. }
  214. }
  215. else
  216. if(win==2 ){
  217. alert('O jogo já acabou! Boa WIN MPT!');
  218.  
  219. }
  220. else
  221. if(document.getElementById('vida').innerHTML==0){
  222. alert('Infelizmente já perdeu');
  223.  
  224. }
  225. else
  226.  
  227. alert('O JOGO AINDA NAO COMEÇOU');
  228.  
  229.  
  230. }
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238. //gerar as bombas e coraçoes
  239. function começa(){
  240. gera(2,11);
  241. gera(1,3);
  242. start=1;
  243. }
  244.  
  245.  
  246. //funcao de verdade para gerar
  247. function gera(t,q){
  248. for(i=1;i<=parseInt(q);i++){
  249. do{
  250. x=Math.floor(Math.random() * 49);
  251. }while(sorteio[x]!=0);
  252. sorteio[x]=parseInt(t);
  253.  
  254.  
  255. }
  256.  
  257. }
  258.  
  259.  
  260.  
  261. //resetar
  262. function reset(){
  263. for(i=1;i<=49;i++){
  264. sorteio[i]=0;
  265. document.getElementById(i).className="off";
  266. document.getElementById(i).innerHTML='&nbsp;';
  267. document.getElementById('vida').innerHTML= 3 + '&#10084;';
  268.  
  269. }
  270. for(i=0;i<11;i++){
  271. mina[i]=0;
  272. }
  273. start=0;
  274. clearInterval(mytime);
  275. c=0;
  276. m=0;
  277. s=0;
  278. h=0;
  279. document.getElementById('c').innerHTML='0'+c;
  280. document.getElementById('s').innerHTML='0'+s;
  281. document.getElementById('m').innerHTML='0'+m;
  282. document.getElementById('h').innerHTML='0'+h;
  283. d=0;
  284. document.getElementById('bt2').disabled = false;
  285. document.getElementById('bt1').disabled = true;
  286. }
  287.  
  288. iniciar();
  289. //cronometro
  290. var d=0;
  291. var c=0;
  292. var s=0;
  293. var m=0;
  294. var h=0;
  295. var z=0;
  296. var mytime;
  297. function myFunction() {
  298. mytime=setInterval(contagem, 10);
  299.  
  300. }
  301. function contagem(){
  302. c++;
  303. if(c==100){
  304. c=0;
  305. s++;
  306. }
  307. if(s==60){
  308. s=0;
  309. m++;
  310. }
  311. if (m==60) {
  312. m=0;
  313. h++;
  314. }
  315. if(c<10){
  316. document.getElementById('c').innerHTML='0'+c;
  317. }
  318. else {
  319. document.getElementById('c').innerHTML=c;
  320. }
  321.  
  322. if(s<10){
  323. document.getElementById('s').innerHTML= '0' +s;
  324. }
  325. else
  326. document.getElementById('s').innerHTML=s;
  327. if (m<10) {
  328. document.getElementById('m').innerHTML='0'+m;
  329. }
  330. else {
  331. document.getElementById('m').innerHTML=m;
  332. }
  333. if (h<10) {
  334. document.getElementById('h').innerHTML='0'+h;
  335. }
  336. else
  337. document.getElementById('h').innerHTML=h;
  338.  
  339. }
  340. //Registar o valor no cronometro
  341. function registar(){
  342. if(h<10 && m<10 && s<10 && c<10){
  343. document.getElementById('tmp' ).innerHTML='0'+h+':'+'0'+m+':'+'0'+s+':'+'0'+c;
  344. }
  345. if(h<10 && m<10 && s<10 && c>10){
  346. document.getElementById('tmp' ).innerHTML='0'+h+':'+'0'+m+':'+'0'+s+':'+c;
  347. }
  348. if(h<10 && m<10 && s>10 && c<10){
  349. document.getElementById('tmp' ).innerHTML='0'+h+':'+'0'+m+':'+s+':'+'0'+c;
  350. }
  351. if(h<10 && m>10 && s<10 && c<10){
  352. document.getElementById('tmp' ).innerHTML='0'+h+':'+m+':'+'0'+s+':'+'0'+c;
  353. }
  354. if(h>10 && m<10 && s<10 && c<10){
  355. document.getElementById('tmp' ).innerHTML=h+':'+'0'+m+':'+'0'+s+':'+'0'+c;
  356. }
  357. if(h<10 && m<10 && s>10 && c>10){
  358. document.getElementById('tmp' ).innerHTML='0'+h+':'+'0'+m+':'+s+':'+c;
  359. }
  360. if(h<10 && m>10 && s<10 && c>10){
  361. document.getElementById('tmp' ).innerHTML='0'+h+':'+m+':'+'0'+s+':'+c;
  362. }
  363. if(h>10 && m<10 && s<10 && c>10){
  364. document.getElementById('tmp' ).innerHTML=h+':'+'0'+m+':'+'0'+s+':'+c;
  365. }
  366. if(h<10 && m>10 && s>10 && c<10){
  367. document.getElementById('tmp' ).innerHTML='0'+h+':'+m+':'+s+':'+'0'+c;
  368. }
  369. if(h>10 && m<10 && s>10 && c<10){
  370. document.getElementById('tmp' ).innerHTML=h+':'+'0'+m+':'+s+':'+'0'+c;
  371. }
  372. if(h>10 && m>10 && s<10 && c<10){
  373. document.getElementById('tmp' ).innerHTML=h+':'+m+':'+'0'+s+':'+'0'+c;
  374. }
  375. if(h<10 && m>10 && s>10 && c>10){
  376. document.getElementById('tmp' ).innerHTML='0'+h+':'+m+':'+s+':'+c;
  377. }
  378. if(h>10 && m<10 && s>10 && c>10){
  379. document.getElementById('tmp' ).innerHTML=h+':'+'0'+m+':'+s+':'+c;
  380. }
  381. if(h>10 && m>10 && s<10 && c>10){
  382. document.getElementById('tmp' ).innerHTML=h+':'+m+':'+'0'+s+':'+c;
  383. }
  384. if(h>10 && m>10 && s>10 && c<10){
  385. document.getElementById('tmp' ).innerHTML=h+':'+m+':'+s+':'+'0'+c;
  386. }
  387. if(h>10 && m>10 && s>10 && c>10){
  388. document.getElementById('tmp' ).innerHTML=h+':'+m+':'+s+':'+c;
  389. }
  390. }
  391. </script>
  392.  
  393.  
  394. </body>
  395.  
  396. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement