Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. IN APP.JS
  2.  
  3. (currentGameState == gameStates.running)
  4.     {
  5.         context.textBaseline = 'middle';
  6.         context.textAlign = "center";
  7.         context.font = '40pt Calibri';
  8.         policeSize = 40;
  9.         context.fillStyle = 'white';
  10.         context.textBaseline = 'middle';
  11.         context.textAlign = 'center';
  12.         clearCanvas();
  13.         dessinerMap(1,context); // NO ERRORS BUT NOT DRAWING :(
  14.         context.fillStyle = "#FF0000";
  15.  
  16. context.fillRect(100,100,250,175); // WORKING
  17.  
  18. context.drawImage(brique, 250, 80); // WORKING because "brique" is created at the beginning of the file
  19.  
  20. -------------------------------------------------------------------------------------------------
  21. IN MAP.JS
  22.  
  23. function drawMap(index, canvas){
  24.    
  25.     $.ajax(
  26.     {
  27.     url : '../map/' + "level"+index+'.json',
  28.        type : 'GET',
  29.  
  30.        
  31.  
  32.        dataType : 'json',
  33.        success: function(result){
  34.         console.log(result.tilesets[0].name);
  35.          var image = new Image();
  36.         image.src = 'images/'+result.tilesets[0].name+'.png';
  37.        
  38.         image.onload = function() {
  39.         console.log(image.src);
  40.         canvas.drawImage(image, 0, 0);
  41.     };
  42.        
  43.    
  44.     }});
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement