【发布时间】:2015-03-03 12:17:41
【问题描述】:
我正在学习动作脚本,我正在尝试从教程中做一个基本的乒乓球游戏,但我无法找到正确编码碰撞的方法。一切正常,但碰撞墙超出了屏幕底部我的符号边缘。我需要整个游戏都在一个符号内,这样我就可以在我计划稍后将其导入的菜单界面中拥有它。双击乒乓球可以找到代码框。
我的问题出在代码中:
//if the bottom of the ball is lower than the bottom of the screen
if(ball.y >= stage.stageHeight-ball.height/2){
ball.y = stage.stageHeight-ball.height/2; //reposition it
}
我需要找到一种方法来更改代码以根据符号边界或像素高度而不是舞台高度检测碰撞,但我不知道如何。你可以下载the flash file查看。
【问题讨论】:
标签: actionscript-3 flash adobe collision-detection flash-cs6