Advertisement
Guest User

Untitled

a guest
Sep 8th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     var movements = {
  2.         upleft: {
  3.             up: -1,
  4.             left: -1
  5.         },
  6.         up: {
  7.             up: -1,
  8.             left: 0
  9.         },
  10.         upright: {
  11.             up: -1,
  12.             left: 1
  13.         },
  14.         left: {
  15.             up: 0,
  16.             left: -1
  17.         },
  18.         right: {
  19.             up: 0,
  20.             left: 1
  21.         },
  22.         downleft: {
  23.             up: 1,
  24.             left: -1
  25.         },
  26.         down: {
  27.             up: 1,
  28.             left: 0
  29.         },
  30.         downright: {
  31.             up: 1,
  32.             left: 1
  33.         },
  34.     };
  35.  
  36.     var x = 12,
  37.         y = 19;
  38.  
  39.  
  40.     var map = [
  41.  
  42.         [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 5, 0, 1, 0, 5, 0, 1, 1, 1, 1, 1, 1, 1],
  43.         [6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 6, 0, 0, 6, 6, 6, 6, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 5, 0, 1, 0, 5, 0, 1, 1, 1, 1, 1, 1, 1],
  44.         [6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 6, 6, 6, 6, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 5, 0, 0, 0, 5, 0, 0, 0, 0, 1, 1, 1, 1],
  45.         [6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 6, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 1, 1, 1, 1],
  46.         [6, 6, 6, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 6, 6, 1, 0, 1, 1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1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3],
  54.         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
  55.         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 3, 3, 1, 1, 1, 1, 3, 3, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3],
  56.         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 3, 3, 1, 1, 1, 1, 3, 3, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3],
  57.         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 11, 11, 0, 0, 1, 1, 1, 1, 0, 0, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3],
  58.         [1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 11, 11, 11, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3],
  59.         [1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 11, 11, 11, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3],
  60.         [1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3],
  61.         [1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0, 0, 0, 0, 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3],
  62.         [1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0, 0, 0, 0, 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 0, 0, 0, 0, 0],
  63.         [1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0, 0, 0, 0, 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 0, 0, 0, 0, 0],
  64.         [1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 0, 0, 0, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 0, 0, 0, 0, 0],
  65.         [7, 7, 7, 7, 7, 7, 7, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 0, 0, 0, 0, 0],
  66.         [7, 7, 0, 0, 7, 7, 7, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, 1, 1],
  67.         [7, 7, 0, 0, 7, 7, 7, 1, 1, 3, 3, 3, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],
  68.         [7, 7, 7, 7, 7, 7, 7, 1, 1, 3, 3, 3, 1, 1, 1, 1,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  83.         [11, 11, 11, 11, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 7, 7, 7, 7, 7, 1, 1, 7],
  84.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 7, 11, 11, 11, 0, 9, 0],
  85.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 1, 7, 7, 7, 7, 7, 7, 7, 7, 11, 11, 11, 0, 0, 0],
  86.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 9, 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 1, 1],
  87.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 0, 11, 11, 11, 11, 11, 11, 0, 0, 0, 11, 11, 11, 11, 11, 11, 11, 11, 0, 0, 0, 0, 0, 0],
  88.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 4, 0, 11, 11, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],
  89.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 0, 0, 0, 0, 0, 0, 4, 0, 11, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
  90.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1],
  91.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1],
  92.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1],
  93.         [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1]
  94.  
  95.     ];
  96.  
  97.     function Spielerbewegen(key) {
  98.         var result1 = $.ajax({
  99.             url: "ajax_call/walk_animation.php?map=1",
  100.             type: "post",
  101.             data: {
  102.                 animation: "laufen"
  103.             },
  104.             success: function(data) {
  105.                 laufeeeen = data;
  106.             }
  107.         });
  108.         var result2 = $.ajax({
  109.             url: "ajax_call/geschlecht.php?map=1",
  110.             type: "post",
  111.             data: {
  112.                 geschlecht: "weiber"
  113.             },
  114.             success: function(data) {
  115.                 geschlecht = data;
  116.             }
  117.         });
  118.         var Spieler = document.getElementById("mySprite");
  119.         var newX = x + movements[key].left;
  120.         var newY = y + movements[key].up;
  121.         if (typeof map[newY] !== "undefined" && typeof map[newY][newX] !== "undefined" && (map[newY][newX] == 1 || map[newY][newX] > 1)) {
  122.             x = newX;
  123.             y = newY;
  124.             Spieler.style.left = x * 16 + "px";
  125.             Spieler.style.top = y * 16 - 4 + "px";
  126.             $("#result").html("<img src='https://forum.ragezone.com/images/loading.gif' /></br>Please wait...");
  127.             $.get("ajax_call/map_ajax2.php?map=1&x=" + x + "&y=" + y, function(result) {
  128.                 var res = jQuery.parseJSON(result);
  129.                 if (typeof res.name !== "undefined") {
  130.                     var html = "";
  131.                     html += "<p>";
  132.                     html += "<span>";
  133.                     html += "<a href=" ? page = poke - info & pokemon = " + res.id + "
  134.                     " target="
  135.                     _blank "><img src='https://forum.ragezone.com/images/pokemon/' + res.id + '.gif' width='70px' /></a><br />";
  136.                     html += "<font size='4' style='text-shadow: 0 0 0.6em #000, 0 0 0.4em #000;color:#fff;'><b>A wild <a href='?page=poke-info&pokemon=' + res.id + '' target='_blank'>' + res.name + '</a>!</b></font><br />";
  137.                     html += "</div>";
  138.                     html += "</span>";
  139.                     html += "</p>";
  140.                     html += "<form action="
  141.                     index.php ? page = attack / beta_map & map = 1 & id = " + res.id + " & level = " + res.level + " & 382203 = 7 " method="
  142.                     post ">";
  143.                     html += " <input type="
  144.                     submit " value="
  145.                     Fight!" class="
  146.                     button "/>";
  147.                     html += "</form>";
  148.                     $("#result").html(html);
  149.                 } else {
  150.                     $("#result").html("<center><img src='http://www.national-dex.com/theme/image/pokeball-grey.png' width='55'/></center><br>Es wurde kein Pokemon gefunden.");
  151.                 }
  152.             });
  153.         }
  154.         if (map[y][x] == 1) {
  155.             $.ajax({
  156.                 url: "ajax_call/gebiet.php?map=1",
  157.                 type: "post",
  158.                 data: {
  159.                     gebiet: "undefined"
  160.                 },
  161.                 success: function(data) {
  162.                     console.log("Erfolgreich Gebiet ge\xC3\xA4ndert!");
  163.                 }
  164.             });
  165.         }
  166.         if (map[y][x] == 3) {
  167.             $.ajax({
  168.                 url: "ajax_call/gebiet.php?map=1",
  169.                 type: "post",
  170.                 data: {
  171.                     gebiet: "Gras"
  172.                 }
  173.             });
  174.         }
  175.         if (map[y][x] == 4) {
  176.             $.ajax({
  177.                 url: "ajax_call/gebiet.php?map=1",
  178.                 type: "post",
  179.                 data: {
  180.                     gebiet: "Grot"
  181.                 }
  182.             });
  183.         }
  184.         if (map[y][x] == 5) {
  185.             $.ajax({
  186.                 url: "ajax_call/gebiet.php?map=1",
  187.                 type: "post",
  188.                 data: {
  189.                     gebiet: "Spookhuis"
  190.                 }
  191.             });
  192.         }
  193.         if (map[y][x] == 6) {
  194.             $.ajax({
  195.                 url: "ajax_call/gebiet.php?map=1",
  196.                 type: "post",
  197.                 data: {
  198.                     gebiet: "Lavagrot"
  199.                 }
  200.             });
  201.         }
  202.         if (map[y][x] == 7) {
  203.             $.ajax({
  204.                 url: "ajax_call/gebiet.php?map=1",
  205.                 type: "post",
  206.                 data: {
  207.                     gebiet: "Strand"
  208.                 }
  209.             });
  210.         }
  211.         if (map[y][x] == 8) {
  212.             $.ajax({
  213.                 url: "ajax_call/gebiet.php?map=1",
  214.                 type: "post",
  215.                 data: {
  216.                     gebiet: "Vechtschool"
  217.                 }
  218.             });
  219.         }
  220.         if (map[y][x] == 9) {
  221.             $(function() {
  222.                 $("#dialog").dialog();
  223.             });
  224.             Spielerbewegen("up");
  225.         }
  226.         if (map[y][x] == 11) {
  227.             $(function() {
  228.                 $("#dialog_surfer").dialog();
  229.             });
  230.             if (key == "up") {
  231.                 Spielerbewegen("down");
  232.             } else if (key == "down") {
  233.                 Spielerbewegen("up");
  234.             } else if (key == "left") {
  235.                 Spielerbewegen("right");
  236.             } else if (key == "right") {
  237.                 Spielerbewegen("left");
  238.             }
  239.         }
  240.         if (map[y][x] == 20) {
  241.             setTimeout(function() {
  242.                 window.location.href = "?page=pokemarket";
  243.             }, 3000);
  244.             $(function() {
  245.                 $("#dialog_pokemarkt").dialog();
  246.             });
  247.             if (key == "up") {
  248.                 Spielerbewegen("down");
  249.             }
  250.         }
  251.         if (map[y][x] == 21) {
  252.             setTimeout(function() {
  253.                 window.location.href = "?page=pokemoncenter";
  254.             }, 3000);
  255.             $(function() {
  256.                 $("#dialog_pokecenter").dialog();
  257.             });
  258.             if (key == "up") {
  259.                 Spielerbewegen("down");
  260.             }
  261.         }
  262.         if (map[y][x] == 2) {
  263.             var Wasser1 = "https://forum.ragezone.com/images/sprites2/male/" + key + "/320.png";
  264.             var Wasser2 = "https://forum.ragezone.com/images/sprites2/male/" + key + "/320.png";
  265.             document.getElementById("mySprite").src = Wasser1;
  266.             setTimeout(function() {
  267.                 document.getElementById("mySprite").src = Wasser1;
  268.             }, 150);
  269.             setTimeout(function() {
  270.                 document.getElementById("mySprite").src = Wasser2;
  271.             }, 400);
  272.             $.ajax({
  273.                 url: "ajax_call/gebiet.php?map=1",
  274.                 type: "post",
  275.                 data: {
  276.                     gebiet: "Water"
  277.                 }
  278.             });
  279.         } else {
  280.             var WALK = "https://forum.ragezone.com/images/sprites2/" + geschlecht + "/" + key + "/0.png";
  281.             var WALK1 = "https://forum.ragezone.com/images/sprites2/" + geschlecht + "/" + key + "w" + laufeeeen + "/0.png";
  282.             setTimeout(function() {
  283.                 document.getElementById("mySprite").src = WALK1;
  284.             }, 100);
  285.             setTimeout(function() {
  286.                 document.getElementById("mySprite").src = WALK;
  287.             }, 300);
  288.         }
  289.     }
  290.  
  291.     function SpieleraufKarte() {
  292.         for (var i = 0; i < users.length; i++) {
  293.             var user = users[i];
  294.             var emotion = document.createElement("img");
  295.             emotion.src = "https://forum.ragezone.com/images/emotions/" + user.emotion + ".png";
  296.             emotion.style.position = "absolute";
  297.             emotion.style.marginTop = "-17px";
  298.             emotion.style.top = user.y * 16 - 4 + "px";
  299.             emotion.style.left = user.x * 16 + "px";
  300.             var wild_poke = document.createElement("img");
  301.             wild_poke.src = "https://forum.ragezone.com/images/pokemon/icon/" + user.map_wild + ".gif";
  302.             wild_poke.style.position = "absolute";
  303.             wild_poke.style.zIndex = 15;
  304.             wild_poke.style.top = user.y * 16 - 4 + "px";
  305.             wild_poke.style.left = user.x * 16 + "px";
  306.             var image2 = document.createElement("img");
  307.             image2.src = "https://forum.ragezone.com/images/in_battle" + user.in_battle + ".gif";
  308.             image2.style.position = "absolute";
  309.             image2.title = "Ist in einem Kampf";
  310.             image2.style.marginTop = "-16px";
  311.             image2.style.top = user.y * 16 - 4 + "px";
  312.             image2.style.left = user.x * 16 + "px";
  313.             var image = document.createElement("img");
  314.             image.src = "https://forum.ragezone.com/images/sprites2/" + user.gender + "/" + user.direction + "/" + user.sprite + ".png";
  315.             image.title = user.username;
  316.             image.style.position = "absolute";
  317.             image.style.top = user.y * 16 - 4 + "px";
  318.             image.style.left = user.x * 16 + "px";
  319.             image.onclick = (function(user) {
  320.                 return function() {
  321.                     var html = "";
  322.                     html += "<img src="
  323.                     https: //forum.ragezone.com/images/sprites2/" + user.gender + "/" + user.direction + "/" + user.sprite + ".png" /> ";
  324.                         html += "<a href=" ? page = profile & player = " + user.username + "
  325.                     ">" + user.username + "</a> &bull; ";
  326.                     html += "<a href=" ? page = send - message & player = " + user.username + "
  327.                     ">Nachricht</a> &bull; ";
  328.                     html += "<a href=" ? page = attack / duel / invite & player = " + user.username + "
  329.                     ">Duellieren</a> &bull; ";
  330.                     html += "<a href=" ? page = buddylist & player = " + user.username + "
  331.                     ">Freundschaftsanfrage</a> &bull; ";
  332.                     html += "<span onclick="
  333.                     document.getElementById('pInfo').style.display = 'none';
  334.                     ">";
  335.                     html += "<br>[Schliessen]";
  336.                     html += "</span>";
  337.                     document.getElementById("pInfo").style.display = "table-row";
  338.                     document.getElementById("info").innerHTML = html;
  339.                 };
  340.             })(user);
  341.             $(emotion).insertAfter("#mySprite");
  342.             $(wild_poke).insertAfter("#mySprite");
  343.             $(image).insertAfter("#mySprite");
  344.             $(image2).insertAfter("#mySprite");
  345.         }
  346.     }
  347.  
  348.  
  349.     function removeUsersFromMap() {
  350.         var mapImgs = document.querySelectorAll("#map img:not([id="
  351.             mySprite "])");
  352.         for (var i = 0; i < mapImgs.length; i++) {
  353.             mapImgs[i].parentNode.removeChild(mapImgs[i]);
  354.         }
  355.     }
  356.  
  357.  
  358.     function remove_emoticons() {
  359.         var mapImgs = document.querySelectorAll("#map img:not([id="
  360.             mySprite "])");
  361.         for (var i = 0; i < mapImgs.length; i++) {
  362.             mapImgs[i].parentNode.removeChild(mapImgs[i]);
  363.         }
  364.     }
  365.     var timer;
  366.  
  367.  
  368.     function startTimer() {
  369.         timer = setInterval(function() {
  370.             $.get("ajax_call/map_users.php?map=1", function(userData) {
  371.                 users = JSON.parse(userData);
  372.                 removeUsersFromMap();
  373.                 SpieleraufKarte();
  374.             });
  375.         }, 400);
  376.     }
  377.  
  378.  
  379.     function checkKeysUp(evt) {
  380.         if (evt.keyCode == 38) {
  381.             Spielerbewegen("up");
  382.             $.ajax({
  383.                 url: "ajax_call/direction.php?map=1",
  384.                 type: "post",
  385.                 data: {
  386.                     direction: "up"
  387.                 },
  388.                 success: function(data) {}
  389.             });
  390.         } else if (evt.keyCode == 37) {
  391.             Spielerbewegen("left");
  392.             $.ajax({
  393.                 url: "ajax_call/direction.php?map=1",
  394.                 type: "post",
  395.                 data: {
  396.                     direction: "left"
  397.                 },
  398.                 success: function(data) {}
  399.             });
  400.         } else if (evt.keyCode == 39) {
  401.             Spielerbewegen("right");
  402.             $.ajax({
  403.                 url: "ajax_call/direction.php?map=1",
  404.                 type: "post",
  405.                 data: {
  406.                     direction: "right"
  407.                 },
  408.                 success: function(data) {}
  409.             });
  410.         } else if (evt.keyCode == 40) {
  411.             Spielerbewegen("down");
  412.             $.ajax({
  413.                 url: "ajax_call/direction.php?map=1",
  414.                 type: "post",
  415.                 data: {
  416.                     direction: "down"
  417.                 },
  418.                 success: function(data) {}
  419.             });
  420.         }
  421.     }
  422.  
  423.  
  424.     function nachOben() {
  425.         Spielerbewegen("up");
  426.         $.ajax({
  427.             url: "ajax_call/direction.php?map=1",
  428.             type: "post",
  429.             data: {
  430.                 direction: "up"
  431.             },
  432.             success: function(data) {}
  433.         });
  434.     }
  435.  
  436.  
  437.     function nachRechts() {
  438.         Spielerbewegen("right");
  439.         $.ajax({
  440.             url: "ajax_call/direction.php?map=1",
  441.             type: "post",
  442.             data: {
  443.                 direction: "right"
  444.             },
  445.             success: function(data) {}
  446.         });
  447.     }
  448.  
  449.  
  450.     function nachLinks() {
  451.         Spielerbewegen("left");
  452.         $.ajax({
  453.             url: "ajax_call/direction.php?map=1",
  454.             type: "post",
  455.             data: {
  456.                 direction: "left"
  457.             },
  458.             success: function(data) {}
  459.         });
  460.     }
  461.  
  462.  
  463.     function nachUnten() {
  464.         Spielerbewegen("down");
  465.         $.ajax({
  466.             url: "ajax_call/direction.php?map=1",
  467.             type: "post",
  468.             data: {
  469.                 direction: "down"
  470.             },
  471.             success: function(data) {}
  472.         });
  473.     }
  474.  
  475.  
  476.     function checkKeysDown(evt) {
  477.         if (evt.keyCode >= 37 || evt.keyCode <= 40) {
  478.             if (evt.preventDefault) {
  479.                 evt.preventDefault();
  480.             }
  481.             if (evt.stopPropagation) {
  482.                 evt.stopPropagation();
  483.             }
  484.         }
  485.     }
  486.     window.addEventListener("load", function() {
  487.         SpieleraufKarte();
  488.         startTimer();
  489.     }, false);
  490.     window.addEventListener("keyup", checkKeysUp, false);
  491.     window.addEventListener("keydown", checkKeysDown, false);
  492.     $(function() {
  493.         $("#ziehen").draggable({
  494.             containment: "document",
  495.             stop: function(event, ui) {
  496.                 var offset = $(this).offset(),
  497.                     pos_x = offset.left,
  498.                     pos_y = offset.top;
  499.                 console.log(offset);
  500.                 $(this);
  501.                 $.ajax({
  502.                     url: "ajax_call/arrow_position.php?map=1",
  503.                     type: "post",
  504.                     data: {
  505.                         position_x: +pos_x
  506.                     }
  507.                 });
  508.                 $.ajax({
  509.                     url: "ajax_call/arrow_position.php?map=1",
  510.                     type: "post",
  511.                     data: {
  512.                         position_y: +pos_y
  513.                     }
  514.                 });
  515.             }
  516.         });
  517.     });
  518.     $(function() {
  519.         $("#ziehen").draggable({
  520.             containment: "parent",
  521.             scroll: false,
  522.             stop: function(event, ui) {
  523.                 var offset = $(this).offset(),
  524.                     pos_x = offset.left,
  525.                     pos_y = offset.top;
  526.                 $(this);
  527.                 $.ajax({
  528.                     url: "ajax_call/arrow_position.php?map=1",
  529.                     type: "post",
  530.                     data: {
  531.                         position_x: +pos_x
  532.                     }
  533.                 });
  534.                 $.ajax({
  535.                     url: "ajax_call/arrow_position.php?map=1",
  536.                     type: "post",
  537.                     data: {
  538.                         position_y: +pos_y
  539.                     }
  540.                 });
  541.             }
  542.         });
  543.     });
  544.  
  545.  
  546.     function reset_navi() {
  547.         reset_x = 924;
  548.         reset_y = 355;
  549.         $.ajax({
  550.             url: "ajax_call/arrow_position.php?map=1",
  551.             type: "post",
  552.             data: {
  553.                 position_x: +reset_x
  554.             }
  555.         });
  556.         $.ajax({
  557.             url: "ajax_call/arrow_position.php?map=1",
  558.             type: "post",
  559.             data: {
  560.                 position_y: +reset_y
  561.             },
  562.             success: function(data) {
  563.                 location.reload();
  564.             }
  565.         });
  566.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement