var speed=2; //反弹系数 enemy.x=30; canvas.width=700; enemy.size=50; function animate(){ if(enemy.x+speed > canvas.width - enemy.size){ if(enemy.x+speed < enemy.size ){ speed = speed; }else{ speed = -speed; } } enemy.x +=speed;
添加回答
举报
0/150
提交
取消