删除小球的方法
function updateBalls(){ /*更新小球属性*/ for(var i=0;i<balls.length;i++){ balls[i].x += balls[i].vx; balls[i].y += balls[i].vy; balls[i].vy += balls[i].g; /*下边缘检测*/ if(balls[i].y >= Window_Height-Radius){ balls[i].y = Window_Height-Radius; balls[i].vy = - balls[i].vy*0.75; } /*右边缘检测*/ if(balls[i].x >= Window_Width+Radius && balls[i].x+Radius >= 0){ delete aBall;//删除小球 } } }
可以用delete删掉出界的小球吗?