Jump to content

Search the Community

Showing results for tags 'piłkarzyki'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Programowanie
    • Delphi
    • C / C++
    • Programowanie grafiki
    • Pascal
    • Inne języki programowania
    • Bazy danych
  • Tworzenie stron internetowych
    • Po stronie serwera
    • Po stronie przeglądarki
  • Inne
    • Projekty
    • Konkursy
    • Beczka
    • Wortal Unit1.pl
    • Śmiechowe tematy
    • Kamery i turystyka internetowa

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Witam Bawiłem się javascript i wymyśliłem silnik piłkarzyków. Trik polega na tym że punkty w canvas są przypisywane do tablicy w postaci punktów OX np... punkt 1515 czyli x to 15 a y to 15 przypisywane są do tabeli. W tabeli jest przypisywany łańcuch znaków w kierunku linia zrobiła ślad a tych śladów (kierunków) jest osiem... jak na papierze z zeszytu od matematyki czyli góra, skos prawy góra, prawo, skos prawy dół, na dól, skos lewy dół, lewy i skos lewy góra. Z każdym ruchem przypisuje 2 do kierunku dwóch punktów - kontynuacja śladu i koniec śladu czyli np... jeśli damy skos prawy góra to będzie to... "a"+str[1]+"a"+str[2]+"a3"+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8] dla ruchu z punktu start oraz... "a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a2"+"a"+str[8] dla końca linii. Jeśli natrafimy na wartość 1 z obydwu punktów to oznaczy to ze jest koniec śladu i nie ma ani odbicia od linii ani blokady. Oznacza to koniec kreślenia i rozpoczęcie ruchu gracza 2. Jeśli wartość 2 z punktów.... blokadę kreślenia bo nie wolno kreślić na liniach co już są oraz jeśli 1 ale nie punkty blokady kreślenia ani końca i zmiana na kreślenie drugiego gracza - odbijanie od linii. Nie wiem co jest nie tak gdyż nie do końca działa. Czasami pokazuje że jest koniec oraz odbijanie od linii. Czasami że kolej graczai koniec. Nie wiem jak sobie z tym poradzić. <script type="text/javascript" src="jquery.js"></script> <meta name="viewport" content="width=device-width"> <body > <center> <canvas id="myCanvas" width="400" height="400" > </canvas> <script> //----------------------------------var var akx=160; var aky=100; var first=1; var str = new Array(); var dotab; var loncz; var pom; var pom2; var rx; var ry; var tab = new Array(); var start=0; var notway; tab[1020]="a1a1a1a1a1a1a1a1";tab[1040]="a1a1a1a1a1a1a1a1";tab[1060]="a1a1a1a1a1a1a1a1";tab[1080]="a1a1a1a1a1a1a1a1";tab[10100]="a1a1a1a1a1a1a1a1";tab[10120]="a1a1a1a1a1a1a1a1";tab[10140]="a1a1a1a1a1a1a1a1";tab[10160]="a1a1a1a1a1a1a1a1";tab[10180]="a1a1a1a1a1a1a1a1";tab[10200]="a1a1a1a1a1a1a1a1";tab[10220]="a1a1a1a1a1a1a1a1";tab[10240]="a1a1a1a1a1a1a1a1";tab[10260]="a1a1a1a1a1a1a1a1";tab[10280]="a1a1a1a1a1a1a1a1";tab[10300]="a1a1a1a1a1a1a1a1";tab[12020]="a1a1a1a1a1a1a1a1";tab[12040]="a1a1a1a1a1a1a1a1";tab[12060]="a1a1a1a1a1a1a1a1";tab[12080]="a1a1a1a1a1a1a1a1";tab[120100]="a1a1a1a1a1a1a1a1";tab[120120]="a1a1a1a1a1a1a1a1";tab[120140]="a1a1a1a1a1a1a1a1";tab[120160]="a1a1a1a1a1a1a1a1";tab[120180]="a1a1a1a1a1a1a1a1";tab[120200]="a1a1a1a1a1a1a1a1";tab[120220]="a1a1a1a1a1a1a1a1";tab[120240]="a1a1a1a1a1a1a1a1";tab[120260]="a1a1a1a1a1a1a1a1";tab[120280]="a1a1a1a1a1a1a1a1";tab[120300]="a1a1a1a1a1a1a1a1";tab[14020]="a1a1a1a1a1a1a1a1";tab[14040]="a1a1a1a1a1a1a1a1";tab[14060]="a1a1a1a1a1a1a1a1";tab[14080]="a1a1a1a1a1a1a1a1";tab[140100]="a1a1a1a1a1a1a1a1";tab[140120]="a1a1a1a1a1a1a1a1";tab[140140]="a1a1a1a1a1a1a1a1";tab[140160]="a1a1a1a1a1a1a1a1";tab[140180]="a1a1a1a1a1a1a1a1";tab[140200]="a1a1a1a1a1a1a1a1";tab[140220]="a1a1a1a1a1a1a1a1";tab[140240]="a1a1a1a1a1a1a1a1";tab[140260]="a1a1a1a1a1a1a1a1";tab[140280]="a1a1a1a1a1a1a1a1";tab[140300]="a1a1a1a1a1a1a1a1";tab[16020]="a1a1a1a1a1a1a1a1";tab[16040]="a1a1a1a1a1a1a1a1";tab[16060]="a1a1a1a1a1a1a1a1";tab[16080]="a1a1a1a1a1a1a1a1";tab[160100]="a1a1a1a1a1a1a1a1";tab[160120]="a1a1a1a1a1a1a1a1";tab[160140]="a1a1a1a1a1a1a1a1";tab[160160]="a1a1a1a1a1a1a1a1";tab[160180]="a1a1a1a1a1a1a1a1";tab[160200]="a1a1a1a1a1a1a1a1";tab[160220]="a1a1a1a1a1a1a1a1";tab[160240]="a1a1a1a1a1a1a1a1";tab[160260]="a1a1a1a1a1a1a1a1";tab[160280]="a1a1a1a1a1a1a1a1";tab[160300]="a1a1a1a1a1a1a1a1";tab[18020]="a1a1a1a1a1a1a1a1";tab[18040]="a1a1a1a1a1a1a1a1";tab[18060]="a1a1a1a1a1a1a1a1";tab[18080]="a1a1a1a1a1a1a1a1";tab[180100]="a1a1a1a1a1a1a1a1";tab[180120]="a1a1a1a1a1a1a1a1";tab[180140]="a1a1a1a1a1a1a1a1";tab[180160]="a1a1a1a1a1a1a1a1";tab[180180]="a1a1a1a1a1a1a1a1";tab[180200]="a1a1a1a1a1a1a1a1";tab[180220]="a1a1a1a1a1a1a1a1";tab[180240]="a1a1a1a1a1a1a1a1";tab[180260]="a1a1a1a1a1a1a1a1";tab[180280]="a1a1a1a1a1a1a1a1";tab[180300]="a1a1a1a1a1a1a1a1";tab[110020]="a1a1a1a1a1a1a1a1";tab[110040]="a1a1a1a1a1a1a1a1";tab[110060]="a1a1a1a1a1a1a1a1";tab[110080]="a1a1a1a1a1a1a1a1";tab[1100100]="a1a1a1a1a1a1a1a1";tab[1100120]="a1a1a1a1a1a1a1a1";tab[1100140]="a1a1a1a1a1a1a1a1";tab[1100160]="a1a1a1a1a1a1a1a1";tab[1100180]="a1a1a1a1a1a1a1a1";tab[1100200]="a1a1a1a1a1a1a1a1";tab[1100220]="a1a1a1a1a1a1a1a1";tab[1100240]="a1a1a1a1a1a1a1a1";tab[1100260]="a1a1a1a1a1a1a1a1";tab[1100280]="a1a1a1a1a1a1a1a1";tab[1100300]="a1a1a1a1a1a1a1a1";tab[112020]="a1a1a1a1a1a1a1a1";tab[112040]="a1a1a1a1a1a1a1a1";tab[112060]="a1a1a1a1a1a1a1a1";tab[112080]="a1a1a1a1a1a1a1a1";tab[1120100]="a1a1a1a1a1a1a1a1";tab[1120120]="a1a1a1a1a1a1a1a1";tab[1120140]="a1a1a1a1a1a1a1a1";tab[1120160]="a1a1a1a1a1a1a1a1";tab[1120180]="a1a1a1a1a1a1a1a1";tab[1120200]="a1a1a1a1a1a1a1a1";tab[1120220]="a1a1a1a1a1a1a1a1";tab[1120240]="a1a1a1a1a1a1a1a1";tab[1120260]="a1a1a1a1a1a1a1a1";tab[1120280]="a1a1a1a1a1a1a1a1";tab[1120300]="a1a1a1a1a1a1a1a1";tab[114020]="a1a1a1a1a1a1a1a1";tab[114040]="a1a1a1a1a1a1a1a1";tab[114060]="a1a1a1a1a1a1a1a1";tab[114080]="a1a1a1a1a1a1a1a1";tab[1140100]="a1a1a1a1a1a1a1a1";tab[1140120]="a1a1a1a1a1a1a1a1";tab[1140140]="a1a1a1a1a1a1a1a1";tab[1140160]="a1a1a1a1a1a1a1a1";tab[1140180]="a1a1a1a1a1a1a1a1";tab[1140200]="a1a1a1a1a1a1a1a1";tab[1140220]="a1a1a1a1a1a1a1a1";tab[1140240]="a1a1a1a1a1a1a1a1";tab[1140260]="a1a1a1a1a1a1a1a1";tab[1140280]="a1a1a1a1a1a1a1a1";tab[1140300]="a1a1a1a1a1a1a1a1";tab[116020]="a1a1a1a1a1a1a1a1";tab[116040]="a1a1a1a1a1a1a1a1";tab[116060]="a1a1a1a1a1a1a1a1";tab[116080]="a1a1a1a1a1a1a1a1";tab[1160100]="a1a1a1a1a1a1a1a1";tab[1160120]="a1a1a1a1a1a1a1a1";tab[1160140]="a1a1a1a1a1a1a1a1";tab[1160160]="a1a1a1a1a1a1a1a1";tab[1160180]="a1a1a1a1a1a1a1a1";tab[1160200]="a1a1a1a1a1a1a1a1";tab[1160220]="a1a1a1a1a1a1a1a1";tab[1160240]="a1a1a1a1a1a1a1a1";tab[1160260]="a1a1a1a1a1a1a1a1";tab[1160280]="a1a1a1a1a1a1a1a1";tab[1160300]="a1a1a1a1a1a1a1a1";tab[118020]="a1a1a1a1a1a1a1a1";tab[118040]="a1a1a1a1a1a1a1a1";tab[118060]="a1a1a1a1a1a1a1a1";tab[118080]="a1a1a1a1a1a1a1a1";tab[1180100]="a1a1a1a1a1a1a1a1";tab[1180120]="a1a1a1a1a1a1a1a1";tab[1180140]="a1a1a1a1a1a1a1a1";tab[1180160]="a1a1a1a1a1a1a1a1";tab[1180180]="a1a1a1a1a1a1a1a1";tab[1180200]="a1a1a1a1a1a1a1a1";tab[1180220]="a1a1a1a1a1a1a1a1";tab[1180240]="a1a1a1a1a1a1a1a1";tab[1180260]="a1a1a1a1a1a1a1a1";tab[1180280]="a1a1a1a1a1a1a1a1";tab[1180300]="a1a1a1a1a1a1a1a1";tab[120020]="a1a1a1a1a1a1a1a1";tab[120040]="a1a1a1a1a1a1a1a1";tab[120060]="a1a1a1a1a1a1a1a1";tab[120080]="a1a1a1a1a1a1a1a1";tab[1200100]="a1a1a1a1a1a1a1a1";tab[1200120]="a1a1a1a1a1a1a1a1";tab[1200140]="a1a1a1a1a1a1a1a1";tab[1200160]="a1a1a1a1a1a1a1a1";tab[1200180]="a1a1a1a1a1a1a1a1";tab[1200200]="a1a1a1a1a1a1a1a1";tab[1200220]="a1a1a1a1a1a1a1a1";tab[1200240]="a1a1a1a1a1a1a1a1";tab[1200260]="a1a1a1a1a1a1a1a1";tab[1200280]="a1a1a1a1a1a1a1a1";tab[1200300]="a1a1a1a1a1a1a1a1"; //------------------------------------------------------canvas var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); ctx.fillStyle = "#000000"; for (var i=0;i<=10;i++){ for(var j=1;j<=15;j++){ ctx.fillRect(i*20,j*20,5,5); } } ctx.fillRect(80,0,5,5); ctx.fillRect(100,0,5,5); ctx.fillRect(120,0,5,5); ctx.fillRect(80,320,5,5); ctx.fillRect(120,320,5,5); ctx.fillRect(100,320,5,5); ctx.beginPath(); ctx.rect(100,160,5,5); ctx.fillStyle = "red"; ctx.fill(); ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.rect(0,20,205,285); ctx.stroke(); ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="white"; ctx.moveTo(80,20); ctx.lineTo(120,20); ctx.moveTo(80,305); ctx.lineTo(120,305); ctx.stroke(); document.addEventListener("DOMContentLoaded", init, false); //------------------------cookie function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } //----------------------------------------init function init() { var canvas = document.getElementById("myCanvas"); canvas.addEventListener("mousedown", getPosition, false); } //--------------------------------------onclick function getPosition(event) { obtocz=$("#obtocz").val(); var x = new Number(); var y = new Number(); var canvas = document.getElementById("canvas"); if (event.x != undefined && event.y != undefined) { x = event.x; y = event.y; } else // Firefox method to get the position { x = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; y = event.clientY + document.body.scrollTop + document.documentElement.scrollTop; } x -= myCanvas.offsetLeft; y -= myCanvas.offsetTop; rx=x; ry=y; rx=rx/20; ry=ry/20; rx=Math.round(rx); ry=Math.round(ry); rx=rx*20; ry=ry*20; /* if(start==1){ akx=readCookie("akxc"); aky=readCookie("akyc"); } */ start=1; if (first==1){ //1 -20 +20 if ((rx == (aky-20)) && (ry == (akx+20))){ alert("-20 +20 badane"); str=tab["1"+rx+""+ry].split("a"); if(str[1] == 1 && str[5] == 1){ ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a2"+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a2"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a2"+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ends"); } if (str[1] == "2" || str[5] == "2") { alert("not way");notway=1; } if(str[2] == "2" || str[3] == "2" || str[4] == "2" || str[6] == "2" || str[7] == "2" || str[8] == "2"){ ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a2"+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a2"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a2"+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ping"); } } //----------end //2 0 +20 if (rx == aky && ry == akx+20){ //alert(end1); str=tab["1"+rx+""+ry].split("a"); if(str[2] == "1" && str[6] == "1"){//----------------- ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a2"+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a2"+"a"+str[7]+"a"+str[8]; tab["1"+akx+""+aky]=dotab; alert("ends"); } if (str[2] == "2" || str[6] == "2") { alert("not way");notway=1; } if(str[1] == "2" || str[3] == "2" || str[4] == "2" || str[5] == "2" || str[7] == "2" || str[8] == "2"){ ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a2"+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a2"+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ping"); } } //----------end //3 +20 +20 if (rx == aky+20 && ry == akx+20){ //alert(end1); str=tab["1"+rx+""+ry].split("a"); if(str[3] == "1" && str[7] == "1"){//----------------- ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a3"+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a2"+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ends"); } if (str[3] == "2" || str[7] == "2") { alert("not way");notway=1; } if(str[1] == "2" || str[2] == "2" || str[4] == "2" || str[5] == "2" || str[6] == "2" || str[8] == "2"){ ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a3"+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a2"+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ping"); } } //----------end //4 +20 0 if (rx == aky+20 && ry == akx){ //alert(end1); str=tab["1"+rx+""+ry].split("a"); if(str[4] == "1" && str[8] == "1"){//----------------- ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a2"+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a2"; tab["1"+aky+""+akx]=dotab; alert("ends"); } if (str[4] == "2" || str[8] == "2") { alert("not way");notway=1; } if(str[1] == "2" || str[2] == "2" || str[3] == "2" || str[5] == "2" || str[6] == "2" || str[7] == "2"){ ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a2"+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a2"; tab["1"+aky+""+akx]=dotab; alert("ping"); } } //----------end //5 +20 -20 var pomaky = aky+20; var pomakx = akx-20; if ((rx == aky+20) && ((ry) == akx-20)){ alert("+20 -20"); str=tab["1"+rx+""+ry].split("a"); if(str[5] == "1" && str[1] == "1"){//----------------- ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a2"+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a2"+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ends"); } if (str[5] == "2" && str[1] == "2") { alert("not way");notway=1; } if(str[2] == "2" || str[3] == "2" || str[4] == "2" || str[6] == "2" || str[7] == "2" || str[8] == "2"){ ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a2"+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a2"+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ping"); } } //----------end //6 0 -20 if (rx == aky && ry == akx-20){ //alert(end1); str=tab["1"+rx+""+ry].split("a"); if(str[6] == "1" && str[2] == "1"){//----------------- ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a2"+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a2"+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ends"); } if (str[6] == "2" && str[2] == "2") { alert("not way");notway=1; } if(str[1] == "2" || str[3] == "2" || str[4] == "2" || str[5] == "2" || str[7] == "2" || str[8] == "2"){ ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a2"+"a"+str[7]+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a2"+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ping"); } } //----------end //7 -20 -20 if (rx == aky-20 && ry == akx-20){ //alert(end1); str=tab["1"+rx+""+ry].split("a"); if(str[7] == "1" && str[3] == "1"){//----------------- ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a2"+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a2"+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ends"); } if (str[7] == "2" && str[3] == "2") { alert("not way");notway=1; } if(str[1] == "2" || str[2] == "2" || str[4] == "2" || str[5] == "2" || str[6] == "2" || str[8] == "2"){ ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a2"+"a"+str[8]; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a2"+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ping"); } } //----------end //8 -20 0 if (rx == aky-20 && ry == akx){ //alert(end1); str=tab["1"+rx+""+ry].split("a"); if(str[8] == "1" && str[4] == "1"){//----------------- ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a2"; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a4"+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ends"); } if (str[8] == "2" || str[4] == "2") { alert("not way");notway=1; } if(str[1] == "2" || str[2] == "2" || str[3] == "2" || str[5] == "2" || str[6] == "2" || str[7] == "2"){ ctx.beginPath(); ctx.lineWidth="2"; ctx.strokeStyle="black"; ctx.moveTo(aky,akx); ctx.lineTo(rx,ry); ctx.stroke(); dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a"+str[4]+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a2"; tab["1"+rx+""+ry]=dotab; dotab="a"+str[1]+"a"+str[2]+"a"+str[3]+"a4"+"a"+str[5]+"a"+str[6]+"a"+str[7]+"a"+str[8]; tab["1"+aky+""+akx]=dotab; alert("ping"); } } //----------end //console.log(dotab+"8"); //console.log(str); console.log(aky+" aky"+akx+" akx"+rx+" rx"+ry+" ry"); console.log(tab["1"+rx+""+ry]+" tab"); console.log(str[1]+" str1"+str[5]+" str5"); //setCookie("akxc",ry,30); //setCookie("akyc",rx,30); if(notway!=1){ if((ry==akx-20 && rx==aky+20)||(ry==akx && rx==aky+20)||(ry==akx+20 && rx==aky+20)||(ry==akx+20 && rx==aky)||(ry==akx+20 && rx==aky-20)||(ry==akx && rx==aky-20)||(ry==akx-20 && rx==aky-20)||(ry==akx-20 && rx==aky)){ akx=ry; aky=rx; } } notway=0; } } </script> 2
×
×
  • Create New...