почему код не работает
window.onload=function() {
var a=350,b=348,c=50,d=50;
var a0=360,b0=358,c0=30,d0=30;
var a1=372,b1=320,c1=6,d1=40;
x.strokeStyle='#007439';
x.lineWidth=5;
x.strokeRect(a,b,c,d);
x.strokeStyle='red';
x.strokeRect(a0,b0,c0,d0);
x.fillRect(a1,b1,c1,d1);
function f(){
document.getElementsByClassName('cl0')[0].onmouseup=function(){
return 0;
}
return 1;
}
document.getElementsByClassName('cl0')[0].onmousedown=function(){
x.fillRect(a1=320,b1=373,c1=40,d1=6);
var v=1;
function q(){
while(v){
x.clearRect(a-4,b-4,c+10,d+10);
x.clearRect(a0,b0,c0,d0);
x.clearRect(a1,b1,c1,d1);
x.strokeStyle='#007439';
x.lineWidth=5;
x.strokeRect(a=a-1,b,c,d);
x.strokeStyle='red';
x.strokeRect(a0=a0-1,b0,c0,d0);
x.fillRect(a1=a1-1,b1,c1,d1);
v=f();
}
}
}
}
imgExample
Обновите браузер
var example = document.getElementById("example"),
x = example.getContext('2d');
left
right
up
down
shoot