I have some Images which i want to rotate and some which i dont want.
first see this code :
var mainInterval = setInterval(() => {
ctx.clearRect(-width,-height,width,height);
ctx.fillStyle = "green";
ctx.fillRect(0,0,width,height);
ctx.drawImage(pistolInv,width / 4,height - 60 * graphics,width / 8,60 * graphics);
ctx.drawImage(submachinegunInv,width / 2,height - 60 * graphics,width / 8,60 * graphics);
ctx.drawImage(ak47Inv,width / 4 * 3,height - 60 * graphics,width / 8,60 * graphics);
ctx.rotate(angle);
debugger;
if(equippedGun != -1){
var gun = new Image();
gun.src = "assets/guns/" + guns[equippedGun] + ".png";
ctx.drawImage(gun,width / 2,height / 2,120 * graphics,20 * graphics);
}
ctx.drawImage(player,width / 2 - (30 * graphics),height / 2 - (30 * graphics),60 * graphics,60 * graphics);
ctx.drawImage(hand,width / 2 + (15 * graphics),height / 2 - (33 * graphics));
ctx.drawImage(hand,width / 2 - (40 * graphics),height / 2 - (33 * graphics));
},10);
in this example i want the 3 first images not to rotate and 4 second images be rotated.
but because of the interval the old rotate will effect on the 3 first images.
I think its because of that im rotating the whole ctx.
If yes is there anyway to rotate just shapes?