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;
心有法竹
相关分类