flash as3.0中用代码控制元件的运动,怎么使元件不超出舞台外面
functionFoodPosition():void{food.x=int(Math.random()*rows)*2*radius+2*radius;food.y=i...
function FoodPosition():void
{
food.x = int(Math.random() * rows) * 2 * radius + 2 * radius;
food.y = int(Math.random() * cols) * 2 * radius + 2 * radius;
if (food.x > 580 || food.y > 580 || food.x < 0 || food.y < 0)
{
food.visible = false;
}
}
当元件的坐标超出舞台时,让其可见性为false,这样写发现总是没有效果 展开
{
food.x = int(Math.random() * rows) * 2 * radius + 2 * radius;
food.y = int(Math.random() * cols) * 2 * radius + 2 * radius;
if (food.x > 580 || food.y > 580 || food.x < 0 || food.y < 0)
{
food.visible = false;
}
}
当元件的坐标超出舞台时,让其可见性为false,这样写发现总是没有效果 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询