Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8.     <title>Document</title>
  9.     <style>
  10.         @font-face {
  11.             font-family: czcionka;
  12.             src: url(fonts/PressStart2P.ttf);
  13.         }
  14.  
  15.         font {
  16.             color: rgb(165, 162, 178);
  17.         }
  18.  
  19.         * {
  20.             font-family: czcionka;
  21.             /* background-color: rgb(57, 57, 57); */
  22.             background-color: black;
  23.             color: lightgrey;
  24.         }
  25.  
  26.         p {
  27.             color: lightgrey;
  28.         }
  29.  
  30.  
  31.         #plansza {
  32.             height: 160px;
  33.             width: 256px;
  34.             background-repeat: no-repeat;
  35.             background-size: cover;
  36.             border: 2px outset white;
  37.         }
  38.  
  39.         button {
  40.             color: white;
  41.         }
  42.  
  43.         #inter {
  44.             width: 800px;
  45.             position: relative;
  46.         }
  47.  
  48.         #divInfo {}
  49.  
  50.  
  51.         input[type=text] {
  52.             color: white;
  53.             border: none;
  54.  
  55.         }
  56.  
  57.         #kompas {
  58.             position: absolute;
  59.             left: 350px;
  60.             top: 60px;
  61.             height: 160px;
  62.             width: 256px;
  63.             background-size: 100%;
  64.             background-image: url('img/kompass.bmp');
  65.             background-repeat: no-repeat;
  66.  
  67.         }
  68.  
  69.         #S {
  70.             position: absolute;
  71.             bottom: 20px;
  72.             left: 120px;
  73.         }
  74.  
  75.         #W {
  76.             position: absolute;
  77.             top: 25px;
  78.             left: -10px;
  79.         }
  80.  
  81.         #N {
  82.             position: absolute;
  83.             left: 115px;
  84.             top: -22px;
  85.         }
  86.  
  87.         #E {
  88.             position: absolute;
  89.             right: -10px;
  90.             top: 25px;
  91.         }
  92.  
  93.         /* .location{
  94.     border:solid 1px;
  95.     width: 50px;
  96.     height:50px;
  97.     margin: 5px;
  98.     float:left;
  99. }
  100. .location:nth-child(2n+1){
  101.     clear:both;
  102. } */
  103.     </style>
  104.     <script>
  105.         function _It(id, przedmiot, flaga, nazwa) {
  106.             this.id = id;
  107.             this.przedmiot = przedmiot;
  108.             this.flaga = flaga;
  109.             this.nazwa = nazwa;
  110.         }
  111.  
  112.         function _Location(miejsce, grafika, tlo, moze, przedmiot) {
  113.             this.miejsce = miejsce;
  114.             this.grafika = grafika;
  115.             this.tlo = tlo
  116.             this.moze = moze
  117.             this.element = null;
  118.             this.item = []
  119.             this.przedmiot = przedmiot;
  120.             // this.init = function () {
  121.             //     var div = document.createElement("div");
  122.             //     div.className = "location";
  123.             //     this.element = div;
  124.             //     document.getElementById("plansza").appendChild(div);
  125.             // }
  126.             // this.init();
  127.         }
  128.         var zmien = 0
  129.         var strona
  130.         var c = []
  131.         var kierunki = ["S", "W", "N", "E"]
  132.         var czy = false
  133.  
  134.  
  135.         document.addEventListener("DOMContentLoaded", function (event) {
  136.             var ekwipunek = []
  137.             var kompas = document.createElement("div")
  138.             kompas.setAttribute("id", "kompas")
  139.             document.body.appendChild(kompas)
  140.             for (var i = 0; i < 4; i++) {
  141.                 var pe = document.createElement("p")
  142.                 pe.setAttribute("id", kierunki[i])
  143.                 kompas.append(pe)
  144.             }
  145.             function ustawKompas(kierunek) {
  146.                 for (var i = 0; i < 4; i++) {
  147.                     document.getElementById(kierunki[i]).innerHTML = ""
  148.                 }
  149.                 setTimeout(function () {
  150.                     document.getElementById(kierunek).innerHTML = kierunek
  151.                 }, 0);
  152.             }
  153.             przedmioty = {
  154.                 przedmiot: {
  155.                     "10": ["10", "a KEY", 1, "KEY"],
  156.                     "11": ["11", "an AXE", 1, "AXE"],
  157.                     "12": ["12", "STICKS", 1, "STICKS"],
  158.                     "13": ["13", "sheeplegs", 0, "sheeplegs"],
  159.                     "14": ["14", "MUSHROOMS", 1, "MUSHROOMS"],
  160.                     "15": ["15", "MONEY", 1, "MONEY"],
  161.                     "16": ["16", "a BARREL", 1, "BARREL"],
  162.                     "17": ["17", "a sheeptrunk", 0, "sheeptrunk"],
  163.                     "18": ["18", "BERRIES", 1, "BERRIES"],
  164.                     "19": ["19", "WOOL", 1, "WOOL"],
  165.                     "20": ["20", "a sheepskin", 0, "sheepskin"],
  166.                     "21": ["21", "a BAG", 1, "BAG"],
  167.                     "22": ["22", "a RAG", 1, "RAG"],
  168.                     "23": ["23", "a sheephead", 0, "sheephead"],
  169.                     "24": ["24", "a SPADE", 1, "SPADE"],
  170.                     "25": ["25", "SULPHUR", 1, "SULPHUR"],
  171.                     "26": ["26", "a solid poison", 0, "solid poison"],
  172.                     "27": ["27", "a BUCKET", 1, "BUCKET"],
  173.                     "28": ["28", "TAR", 1, "TAR"],
  174.                     "29": ["29", "a liquid poison", 0, "liquid poison"],
  175.                     "30": ["30", "a dead dragon", 0, "dead dragon"],
  176.                     "31": ["31", "a STONE", 1, "STONE"],
  177.                     "32": ["32", "a FISH", 1, "FISH"],
  178.                     "33": ["33", "a KNIFE", 1, "KNIFE"],
  179.                     "34": ["34", "a DRAGONSKIN", 1, "DRAGONSKIN"],
  180.                     "35": ["35", "a dragonskin SHOES", 1, "SHOES"],
  181.                     "36": ["36", "a PRIZE", 1, "PRIZE"]
  182.                 },
  183.             }
  184.             game = {
  185.                 board: [
  186.                     [
  187.                         new _Location("You are inside a brimstone mine", "img/11.gif", "rgb(235,211,64)", [right = 1, left = 0, up = 0, down = 0]),
  188.                         new _Location("You are at the entrance to the mine", "img/12.gif", "rgb(89,93,87)", [right = 1, left = 1, up = 0, down = 0]),
  189.                         new _Location("A hill", "img/13.gif", "rgb(117,237,243)", [right = 1, left = 1, up = 0, down = 1], [przedmioty.przedmiot["31"]]),
  190.                         new _Location("Some bushes", "img/14.gif", "rgb(202,230,51)", [right = 1, left = 1, up = 0, down = 0]),
  191.                         new _Location("An old deserted hut", "img/15.gif", "rgb(220,204,61)", [right = 1, left = 1, up = 0, down = 0], [przedmioty.przedmiot["27"]]),
  192.                         new _Location("The edge of a forest", "img/16.gif", "rgb(167,245,63)", [right = 1, left = 1, up = 0, down = 0]),
  193.                         new _Location("A dark forest", "img/17.gif", "rgb(140,253,99)", [right = 0, left = 1, up = 0, down = 1], [przedmioty.przedmiot["31"]]),
  194.                     ],
  195.                     [
  196.                         new _Location("A man nearby making tar", "img/21.gif", "rgb(255,190,99)", [right = 1, left = 0, up = 0, down = 1]),
  197.                         new _Location("A timber yard", "img/22.gif", "rgb(255,190,99)", [right = 1, left = 1, up = 0, down = 1]),
  198.                         new _Location("You are by a roadside shrine", "img/23.gif", "rgb(167,245,63)", [right = 1, left = 1, up = 1, down = 1], [przedmioty.przedmiot["10"]]),
  199.                         new _Location("You are by a small chapel", "img/24.gif", "rgb(212,229,36)", [right = 1, left = 1, up = 0, down = 0]),
  200.                         new _Location("You are on a road leading to a wood", "img/25.gif", "rgb(167,245,63)", [right = 1, left = 1, up = 0, down = 1]),
  201.                         new _Location("You are in a forest", "img/26 i 65.gif", "rgb(167,245,63)", [right = 1, left = 1, up = 0, down = 0]),
  202.                         new _Location("You are in a deep forest", "img/27 i 67.gif", "rgb(140,253,99)", [right = 0, left = 1, up = 1, down = 0], [przedmioty.przedmiot["18"]])
  203.                     ],
  204.                     [
  205.                         new _Location("You are by the Vistula River", "img/31.gif", "rgb(122,232,252)", [right = 1, left = 0, up = 1, down = 0]),
  206.                         new _Location("You are by the Vistula River", "img/32.gif", "rgb(140,214,255)", [right = 0, left = 1, up = 1, down = 0], [przedmioty.przedmiot["32"]]),
  207.                         new _Location("You are on a bridge over river", "img/33.gif", "rgb(108,181,242)", [right = 0, left = 0, up = 1, down = 1]),
  208.                         new _Location("You are by the old tavern", "img/34.gif", "rgb(255,189,117)", [right = 1, left = 0, up = 0, down = 0]),
  209.                         new _Location("You are at the town's end", "img/35.gif", "rgb(255,190,99)", [right = 0, left = 1, up = 1, down = 1]),
  210.                         new _Location("You are in a butcher's shop", "img/36.gif", "rgb(255,188,102)", [right = 0, left = 0, up = 0, down = 1]),
  211.                         new _Location("You are in a cooper's house", "img/37.gif", "rgb(255,188,102)", [right = 0, left = 0, up = 0, down = 1])
  212.                     ],
  213.                     [
  214.                         new _Location("You are in the Wawel Castle", "img/41.gif", "rgb(255,176,141)", [right = 1, left = 0, up = 0, down = 0]),
  215.                         new _Location("You are inside a dragon's cave", "img/42.gif", "rgb(198,205,193)", [right = 1, left = 0, up = 1, down = 0]),
  216.                         new _Location("A perfect place to set a trap", "img/43.gif", "rgb(255,176,141)", [right = 0, left = 1, up = 1, down = 0]),
  217.                         new _Location("You are by the water mill", "img/44.gif", "rgb(255,190,99)", [right = 1, left = 0, up = 0, down = 0], [przedmioty.przedmiot["21"]]),
  218.                         new _Location("You are at a main crossroad", "img/45.gif", "rgb(255,190,99)", [right = 1, left = 1, up = 1, down = 1]),
  219.                         new _Location("You are on a town street", "img/46.gif", " rgb(255,190,99)", [right = 1, left = 1, up = 1, down = 0]),
  220.                         new _Location("You are in a frontyard of your house", "img/47.gif", "rgb(255,190,99)", [right = 0, left = 1, up = 1, down = 1])
  221.  
  222.                     ],
  223.                     [
  224.                         null, null, null,
  225.                         new _Location("You are by a swift stream", "img/54.gif", "rgb(108,181,242)", [right = 1, left = 0, up = 0, down = 0]),
  226.                         new _Location("You are on a street leading forest", "img/55.gif", "rgb(255,190,99)", [right = 0, left = 1, up = 1, down = 1], [przedmioty.przedmiot["33"]]),
  227.                         new _Location("You are in a woodcutter's backyard", "img/56.gif", "rgb(255,190,99)", [right = 0, left = 0, up = 0, down = 1]),
  228.                         new _Location("You are in a shoemaker's house", "img/57.gif", " rgb(254,194,97)", [right = 0, left = 0, up = 1, down = 0])
  229.                     ],
  230.                     [
  231.                         null, null, null,
  232.                         new _Location("You are in a bleak funeral house", "img/64.gif", "rgb(254,194,97)", [right = 1, left = 0, up = 0, down = 0], [przedmioty.przedmiot["24"]]),
  233.                         new _Location("You are on a path leading to the wood", "img/26 i 65.gif", "rgb(167,245,63)", [right = 1, left = 1, up = 1, down = 0]),
  234.                         new _Location("You are at the edge of a forest", "img/66.gif", "rgb(167,245,63)", [right = 1, left = 1, up = 1, down = 0]),
  235.                         new _Location("You are in a deep forest", "img/27 i 67.gif", "rgb(140,253,99)", [right = 0, left = 1, up = 0, down = 0]),
  236.                     ]
  237.  
  238.                 ],
  239.                 player: {
  240.                     pos_x: 6, //6
  241.                     pos_y: 1, //3
  242.                     sprawdzGdzie: function () {
  243.                         c = []
  244.                         strona = []
  245.  
  246.                         var tab = [right = 1, left = 1, up = 1, down = 1]
  247.                         var person = game.board[this.pos_y][this.pos_x]
  248.                         person.moze.forEach(function (s, i) {
  249.                             c.push(person.moze[i] == tab[i])
  250.                         })
  251.  
  252.                         if (c[0] == true) {
  253.                             strona.push("EAST")
  254.                             ustawKompas("E")
  255.                         }
  256.                         if (c[1] == true) {
  257.                             strona.push("WEST")
  258.                             ustawKompas("W")
  259.                         }
  260.                         if (c[2] == true) {
  261.                             strona.push("NORTH")
  262.                             ustawKompas("N")
  263.                         }
  264.                         if (c[3] == true) {
  265.                             strona.push("SOUTH")
  266.                             ustawKompas("S")
  267.                         }
  268.                         // console.log(strona)
  269.                         document.getElementById("pierwszy").innerHTML = "You can go " + strona
  270.                         return strona
  271.  
  272.                     },
  273.                     ekwipunek: {
  274.  
  275.                     },
  276.                     report: function (p) {
  277.                         // console.log(p.przedmiot[1])
  278.                         // console.log("x: " + this.pos_x)
  279.                         // console.log("y: " + this.pos_y)
  280.                     },
  281.                     ustaw: function (p) {
  282.                         document.getElementById("plansza").style.backgroundImage = "url('" + p.grafika + "')";
  283.                         document.getElementById("plansza").style.backgroundColor = p.tlo
  284.                         document.getElementById("glownyText").innerHTML = p.miejsce
  285.                     },
  286.                     go: function (direction) {
  287.                         c = []
  288.                         strona = []
  289.                         //   console.log(game.board)
  290.                         //console.log(game.board[this.pos_y][this.pos_x].moze)
  291.                         var tab = [right = 1, left = 1, up = 1, down = 1]
  292.                         var person = game.board[this.pos_y][this.pos_x]
  293.                         person.moze.forEach(function (s, i) {
  294.                             c.push(person.moze[i] == tab[i])
  295.                         })
  296.                         if (c[0] == true) {
  297.                             if (direction == "right" && this.pos_x < 6) {
  298.                                 this.pos_x++;
  299.                             }
  300.                         }
  301.                         if (c[1] == true) {
  302.                             if (direction == "left" && this.pos_x > 0) {
  303.                                 this.pos_x--;
  304.                             }
  305.                         }
  306.                         if (c[2] == true) {
  307.                             if (direction == "up" && this.pos_y > 0) {
  308.                                 this.pos_y--;
  309.                             }
  310.                         }
  311.                         if (c[3] == true) {
  312.                             if (direction == "down" && this.pos_y < 6) {
  313.                                 this.pos_y++;
  314.                             }
  315.                         }
  316.  
  317.                         this.highlight();
  318.                     },
  319.                     highlight: function () {
  320.                         var person = game.board[this.pos_y][this.pos_x];
  321.                         this.ustaw(person)
  322.                         game.player.sprawdzPrzedmiot();
  323.                         game.player.sprawdzGdzie();
  324.                         game.player.report(person)
  325.  
  326.                     },
  327.                     podnies: function (rzecz) {
  328.                         var person = game.board[this.pos_y][this.pos_x]
  329.                         var rzecz = rzecz
  330.                         console.log(rzecz)
  331.                         if (person.przedmiot == undefined) {
  332.                             // console.log("cojekurwa")
  333.                             // console.log(ekwipunek.length)
  334.                         } else if (person.przedmiot != undefined) {
  335.                             person.przedmiot.forEach(function (to, ito) {
  336.                                 // console.log(to)
  337.                                 person.przedmiot[ito].forEach(function (to2, ito2) {
  338.                                     if (to2 == rzecz) {
  339.                                         ekwipunek.push(person.przedmiot[ito])
  340.                                         person.przedmiot.pop()
  341.                                         if (person.przedmiot.length == 0) {
  342.                                             document.getElementById("drugi").innerHTML = "You see nothing"
  343.                                         } else if (ekwipunek.length >= 1) {
  344.                                             document.getElementById("label").innerHTML = "Masz już cos"
  345.                                             setTimeout(function () {
  346.                                                 document.getElementById("label").innerHTML = "What now?"
  347.                                                 document.getElementById("pole").value = ""
  348.                                                 document.getElementById("pole").disabled = false;
  349.                                             }, 1000);
  350.                                         }
  351.                                     }
  352.                                 })
  353.                             })
  354.                             document.getElementById("trzecie").innerHTML = "You are carrying " + ekwipunek[0][1]
  355.                         }
  356.  
  357.                     },
  358.                     wyrzuc: function (rzecz) {
  359.                         var person = game.board[this.pos_y][this.pos_x]
  360.                         var rzecz = rzecz
  361.                         if (ekwipunek.length > 0) {
  362.                             if (person.przedmiot != undefined) {
  363.                                 person.przedmiot.push(ekwipunek[0])
  364.                             }
  365.                         }
  366.                         if (person.przedmiot == undefined) {
  367.                             person.przedmiot = [ekwipunek[0]]
  368.                             document.getElementById("drugi").innerHTML = person.przedmiot[0]
  369.                         }
  370.                         if (person.przedmiot.length > 1) {
  371.                             document.getElementById("drugi").innerHTML = "You see "
  372.                             for (var i = 0; i < person.przedmiot.length; i++) {
  373.                                 document.getElementById("drugi").innerHTML += person.przedmiot[i][1] + ","
  374.                                 document.getElementById("trzecie").innerHTML = "You are carrying nothing"
  375.  
  376.                             }
  377.                             ekwipunek = []
  378.                         } else {
  379.                             //  console.log(person)
  380.                             document.getElementById("drugi").innerHTML = "You see " + person.przedmiot[0][1]
  381.                             document.getElementById("trzecie").innerHTML = "You are carrying nothing"
  382.                             ekwipunek = []
  383.                         }
  384.                     },
  385.                     sprawdzPrzedmiot: function () {
  386.                         var person = game.board[this.pos_y][this.pos_x]
  387.                         if (person.przedmiot != undefined) {
  388.                             person.przedmiot.forEach(function (to, ito) {
  389.                                 person.przedmiot[ito].forEach(function (to2, ito2) {
  390.                                     document.getElementById("drugi").innerHTML = "You see " + person.przedmiot[ito][1]
  391.                                 })
  392.                             })
  393.  
  394.                             if (person.przedmiot.length > 1) {
  395.  
  396.                                 document.getElementById("drugi").innerHTML = "You see "
  397.                                 for (var i = 0; i < person.przedmiot.length; i++) {
  398.                                     if (i > 0) {
  399.                                         document.getElementById("drugi").innerHTML += "," + person.przedmiot[i][1] + " "
  400.                                         document.getElementById("trzecie").innerHTML = "You are carrying nothing"
  401.  
  402.                                     } else {
  403.                                         document.getElementById("drugi").innerHTML += person.przedmiot[i][1]
  404.                                         document.getElementById("trzecie").innerHTML = "You are carrying nothing"
  405.                                     }
  406.                                 }
  407.                             }
  408.                         } else {
  409.                             document.getElementById("drugi").innerHTML = "You see nothing"
  410.                         }
  411.                     },
  412.                     comam: function () {
  413.                         //  console.log(ekwipunek[0][1])
  414.                         var person = game.board[this.pos_y][this.pos_x]
  415.                         // console.log(person)
  416.                     }
  417.                 }
  418.             }
  419.             game.player.highlight();
  420.             document.getElementById("pierwszy").innerHTML = "You can go " + strona
  421.  
  422.         });
  423.  
  424.         function polecenia(co) {
  425.             var co = co
  426.  
  427.             // if (co == "VOCABULARY" || co == "V") {
  428.             //     clearInterval(myVar)
  429.             //     czy = true
  430.             //     document.getElementById("info").innerHTML = ""
  431.             //     var tekst = ["NORTH or N, SOUTH or S",
  432.             //         "WEST or W, EAST or E",
  433.             //         "TAKE (object) or T (object)",
  434.             //         "DROP (object) or D (object)",
  435.             //         "USE (object) or U (object)",
  436.             //         "GOSSIPS or G, VOCABULARY or V",
  437.             //         "Press any key"]
  438.             //     //     document.getElementById("info").innerHTML = ""
  439.  
  440.             //     console.log(tmp)
  441.  
  442.             //     // document.getElementById("label").innerHTML = ""
  443.  
  444.             //     for (var i = 0; i < tekst.length; i++) {
  445.             //         document.getElementById("inter").innerHTML = ""
  446.             //         var p = document.createElement("p")
  447.             //         p.innerHTML = tekst[i]
  448.             //         document.getElementById("info").append(p)
  449.             //         var szybko = setInterval(aktywnosc, 0)
  450.             //     }
  451.  
  452.             //     function aktywnosc() {
  453.             //         document.getElementById("info").focus()
  454.             //     }
  455.  
  456.             //     document.getElementById("info").addEventListener('keydown', function (e) {
  457.             //         console.log(e.key)
  458.             //         if (e.key) {
  459.             //             clearInterval(szybko)
  460.             //             document.getElementById("info").innerHTML = ""
  461.  
  462.             //         }
  463.             //         czy = false
  464.             //     })
  465.             // }
  466.             //  console.log(co)
  467.  
  468.             if (co.indexOf("TAKE") == 0) {
  469.                 console.log(co.substr(5, co.length))
  470.                 game.player.podnies(co.substr(5, co.length))
  471.             }
  472.             if (co.indexOf("DROP") == 0) {
  473.                 console.log(co.substr(5, co.length))
  474.                 game.player.wyrzuc(co.substr(5, co.length))
  475.             }
  476.         }
  477.  
  478.  
  479.         var myVar = setInterval(ffff, 0);
  480.  
  481.         function ffff() {
  482.             document.getElementById("pole").focus()
  483.         }
  484.  
  485.         function cos(d) {
  486.             var litera = d.value.toString().toUpperCase()
  487.             var zapis = litera
  488.             var x = event.charCode || event.keyCode;
  489.  
  490.             if (x == 13) {
  491.                 polecenia(litera)
  492.  
  493.                 if (litera.substr(0, 4) != 'D' && litera.substr(0, 4) != 'DROP' && litera.indexOf("VALUE") != 0 && litera.substr(0, 4) != 'TAKE' && litera.substr(0, 4) != "take" && litera.substr(0, 4) != "t" && litera.substr(0, 4) != "T" && litera.substr(0, 5) != "E" && litera.substr(0, 5) != "e" && litera.substr(0, 5) != "EAST" && litera.substr(0, 5) != "W" && litera.substr(0, 5) != "w" && litera.substr(0, 5) != "WEST" && litera.substr(0, 5) != "N" && litera.substr(0, 5) != "n" && litera.substr(0, 5) != "NORTH" && litera.substr(0, 5) != "S" && litera.substr(0, 5) != "s" && litera.substr(0, 5) != "SOUTH") {
  494.                     document.getElementById("label").innerHTML = "Zły krok"
  495.                 }
  496.                 document.getElementById("pole").disabled = true;
  497.                 document.getElementById("pole").value = ""
  498.  
  499.  
  500.                 setTimeout(function () {
  501.                     document.getElementById("label").innerHTML = "What now?"
  502.                     document.getElementById("pole").value = ""
  503.                     document.getElementById("pole").disabled = false;
  504.                 }, 100);
  505.                 return litera
  506.             }
  507.         }
  508.  
  509.         function sprawdz(kl) {
  510.             var x = cos(event.target)
  511.             // var klawisze = [
  512.             // right = 69,
  513.             // left = 87,
  514.             // up = 78,
  515.             // down = 83]
  516.             //  var x = event.which || event.keyCode;
  517.             // console.log(strona)
  518.             var direction
  519.             strona.forEach(function (z) {
  520.                 if ("EAST" == z) {
  521.                     if (x == "E" || x == "e" || x == "EAST") {
  522.                         direction = 'right'
  523.                         document.getElementById("label").innerHTML = "You are going east..."
  524.                     }
  525.                 }
  526.                 if ("WEST" == z) {
  527.                     if (x == "W" || x == "w" || x == "WEST") {
  528.                         direction = 'left'
  529.                         document.getElementById("label").innerHTML = "You are going west..."
  530.                     }
  531.                 }
  532.                 if ("NORTH" == z) {
  533.                     if (x == "N" || x == "n" || x == "NORTH") {
  534.                         direction = 'up'
  535.                         document.getElementById("label").innerHTML = "You are going north..."
  536.                     }
  537.                 }
  538.                 if ("SOUTH" == z) {
  539.                     if (x == "S" || x == "s" || x == "SOUTH") {
  540.                         direction = 'down'
  541.                         document.getElementById("label").innerHTML = "You are going south..."
  542.                     }
  543.                 }
  544.             })
  545.  
  546.             return game.player.go(direction)
  547.         }
  548.  
  549.  
  550.         function tab(el) {
  551.             //    console.log(document.getElementById("pole").value = el.value.toUpperCase())
  552.             if (event.which == 9) {
  553.                 event.preventDefault();
  554.             }
  555.             // if (event.which == 20) {
  556.             //     document.getElementById("pole").value = el.value.toLowerCase()
  557.             // }
  558.             // else if (event.which == 16) {
  559.             //     document.getElementById("pole").value = el.value.toLowerCase()
  560.             // }
  561.  
  562.         }
  563.  
  564.     </script>
  565. </head>
  566.  
  567. <body>
  568.     <p id="glownyText">Cos tu bedzie</p>
  569.     <div id="plansza"></div>
  570.     <div id="info" tabindex="0">
  571.         <p id="pierwszy">You can go </p>
  572.         <p id="drugi">You see nothing </p>
  573.         <p id="trzecie">You are carrying nothing </p>
  574.         <!-- <p id="czwarte">&nbsp;</p> -->
  575.     </div>
  576.     <div id="inter">
  577.         <label id="label">What now?</label><input type="text" id="pole" autofocus onblur="cos(this)"
  578.             onkeypress="sprawdz(this)" onkeydown="tab(this)">
  579.         <!--
  580.             <input type="text" id="pole" autofocus onblur="cos(this)"
  581.             onkeypress="sprawdz(this)" onkeydown="tab(this)"> -->
  582.  
  583.  
  584.     </div>
  585.     <!-- <button onclick="game.player.go('left')">LEFT</button>
  586.     <button onclick="game.player.go('up')">UP</button>
  587.     <button onclick="game.player.go('down')">DOWN</button>
  588.     <button onclick="game.player.go('right')">RIGHT</button> -->
  589. </body>
  590.  
  591. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement