<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: دانش کلیم</title>
    <description>The latest articles on DEV Community by دانش کلیم (@danish_kalim_1).</description>
    <link>https://dev.to/danish_kalim_1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F189460%2Fad735496-13b3-4342-aea5-7a033aa83398.jpg</url>
      <title>DEV Community: دانش کلیم</title>
      <link>https://dev.to/danish_kalim_1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/danish_kalim_1"/>
    <language>en</language>
    <item>
      <title>when i move image to new positon it also shows the old image with old position which i dont want pls help</title>
      <dc:creator>دانش کلیم</dc:creator>
      <pubDate>Tue, 02 Jul 2019 16:11:33 +0000</pubDate>
      <link>https://dev.to/danish_kalim_1/when-i-move-image-to-new-positon-it-also-shows-the-old-image-with-old-position-which-i-dont-want-pls-help-5h0b</link>
      <guid>https://dev.to/danish_kalim_1/when-i-move-image-to-new-positon-it-also-shows-the-old-image-with-old-position-which-i-dont-want-pls-help-5h0b</guid>
      <description>&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const cvs = document.getElementById("game");
const ctx = cvs.getContext("2d");
const ROW = 15;
const COL =15;
const VACANT = "WHITE"
const SQ =40;
function drawSquare(x,y,color){
  ctx.fillStyle = color;
  ctx.fillRect(x*SQ,y*SQ,SQ,SQ);
  ctx.strokeStyle = "Black";
  ctx.strokeRect(x*SQ,y*SQ,SQ,SQ);
}
//create board 
let board= [];
for(r =0;r&amp;lt;ROW; r++){
   board[r] = [];
   for(c=0;c&amp;lt;COL;c++){
       board[r][c]=VACANT;
   }
}
//Draw the Board
function drawBoard(){
  for(r =0;r&amp;lt;ROW; r++){
   for(c=0;c&amp;lt;COL;c++){
       drawSquare(c,r,board[r][c]);
   }
  }
}

drawBoard();



let foodImg = new Image();
foodImg.src = "images/food.png" ;
let playerImg1 = new Image();
playerImg1.src = "images/player1.jpg" ;
let playerImg2 = new Image();
playerImg2.src = "images/player2.jpg" ;
//Block image
let blockImg = new Image();
blockImg.src = "images/block.jpg" ;
//let  blockImg = document.getElementById('block1');
let food = {
x: Math.floor(Math.random()*8 + 12) * SQ,
y: Math.floor(Math.random()*13 + 1) * SQ
}
let player1 ={
x: Math.floor(Math.random()*0 + 2) * SQ,
y: Math.floor(Math.random()*4+ 0) * SQ

}
let player2 ={
x: Math.floor(Math.random()*3 + 12) * SQ,
y: Math.floor(Math.random()*13 + 6) * SQ

}
//control Player
let d;
document.addEventListener("keydown",direction)
function direction(event){

  if(event.keyCode == 37){

      player1.x -= SQ * 3;

  }else if(event.keyCode == 38 ){
     player1.y -= SQ * 3;
  }else if(event.keyCode == 39){
     player1.x += SQ * 3;
  }else if(event.keyCode == 40){
     player1.y += SQ * 3;
  }

moveCharacter();
}
function moveCharacter(){
 ctx.clearRect(0,0, player1.x.width, player1.y.height);

  ctx.drawImage(playerImg1,player1.x,player1.y) ;

  ctx.drawImage(playerImg2,player2.x,player2.y);

}
function draw(){

    ctx.drawImage(foodImg,food.x,food.y);
    ctx.drawImage(playerImg1,player1.x,player1.y);

    ctx.drawImage(playerImg2,player2.x,player2.y);
    for(let i = 0 ; i&amp;lt;=10; i++ ){
        let block ={
x: Math.floor(Math.random()*8 + 3) * SQ,
y: Math.floor(Math.random()*13 + 2) * SQ

}    

let j = ctx.drawImage(blockImg,block.x,block.y) ;

      j

    }


}

draw();
var button = document.getElementById("button");
button.addEventListener("click", draw); 


&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>javascript</category>
    </item>
  </channel>
</rss>
