timeSconde = getTimeSeconds();
setInterval(function(){
timeSconde = timeSconde-0.1;
render(context);
},100)
这样也可以
setInterval(function(){
timeSconde = timeSconde-0.1;
render(context);
},100)
这样也可以
2016-03-06
在画布的左右两侧我都设置了碰撞检测,最后使小球停止在左边缘
function update(){
if(ball.x>800-ball.r){
ball.x = 800 - ball.r;
ball.vx = - 2*ball.vx
}
if(ball.x<0){
ball.x = ball.r;
ball.vx = 0;
ball.vy = 0;
ball.g = 0;
}
}
function update(){
if(ball.x>800-ball.r){
ball.x = 800 - ball.r;
ball.vx = - 2*ball.vx
}
if(ball.x<0){
ball.x = ball.r;
ball.vx = 0;
ball.vy = 0;
ball.g = 0;
}
}
2016-03-05
老师、为什么加了cxt.clearRect(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);效果没出来
2016-03-04