任何人都可以在阵列部分帮助我吗?我正在制作一个颜色拖放游戏,其中项目将被拖到一个盒子里,当它的错误或正确时人们会收到通知。
我如何从以下位置调用数组:
var items=[]
items.push({x:400,y:330,width:30,height:30,color:"rgba(100,223,0, 0.5)",isDragging:false});
items.push({x:300,y:330,width:30,height:30,color:"rgba(220,0,0, 0.5)",isDragging:false});
items.push({x:200,y:330,width:30,height:30,color:"rgba(220,223,0, 0.5)",isDragging:false});
至:
if (items[0].push(x > 400 && x <175 && y>50 &&y<235)){
//console.log("ok");
canvas2.innerHTML = "Score:" + 1;
}
else if(x > 255 && x < 376 && y > 50 && y <235){
canvas2.innerHTML = "WRONG! please try again."
rect = false;
myMove = false;
}
else if(x > 455 && x < 576 && y > 50 && y <235){
canvas2.innerHTML = "WRONG! please try again."
rect = false;
myMove = false;
}