Advertisement
Aveneid

JS Map Loading

Dec 3rd, 2016
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function setup(){
  2.     context.fillStyle="#000000";
  3.     context.fillRect(0,0,canvas.width,canvas.height);
  4.     context.fillStyle="#FFFFFF";
  5.     context.fillStyle="16 px Tahoma";
  6.     context.textBaseline = 'middle';
  7.     context.textAlign = "center";
  8.     context.fillText("Loading, please wait...",canvas.width/2,canvas.height/2)
  9.    
  10.         $(document).ready(function() {
  11.         for(var i=0;i<2;i++)
  12.         {$.getJSON('map'+i+'.json', function(data){
  13.                 mapData[i] = data;
  14.             });
  15.             wait(1000);
  16.         }
  17.         /*     
  18. var i = 0;
  19. getJson(i);
  20.  
  21. var getJson = function(i) {
  22.   if (i < 2) {
  23.     $.getJSON('map' + i + '.json', function(data) {
  24.         mapData[i] = data;
  25.       i++;
  26.       getJson(i);
  27.     }
  28.   }
  29. }
  30. */
  31.  
  32.  
  33.         //wait(10000);
  34.             context.fillStyle="#000000";
  35.             context.fillRect(0,0,canvas.width,canvas.height);
  36.         });
  37.    
  38.    
  39. //setInterval("game();",1000/144); 
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement