关于FLASH中hitTest的问题。
来源:百度知道 编辑:UC知道 时间:2024/05/04 12:45:02
我做了个FLASH,是个吃豆子的游戏,游戏目地是为了让玩家操控小人吃从天而降的豆子,累计积分。
小人实例名:men
豆子实例名:douzi
炸弹实例名:bomb
帧语句如下:
stop();
speed = 10;
theMen.onEnterFrame = function() {
if (this.hitTest(_root.douzi)) {
gotoAndStop(2);
}
};
theMen.onEnterFrame = function() {
if (this.hitTest(_root.bomb)) {
gotoAndStop(3);
}
};
小人语句如下
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
}
问题是我实现不了我的预想效果!
小人实例名:men
豆子实例名:douzi
炸弹实例名:bomb
帧语句如下:
stop();
speed = 10;
theMen.onEnterFrame = function() {
if (this.hitTest(_root.douzi)) {
gotoAndStop(2);
}
};
theMen.onEnterFrame = function() {
if (this.hitTest(_root.bomb)) {
gotoAndStop(3);
}
};
小人语句如下
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
}
问题是我实现不了我的预想效果!
那你的问题是什么???没有问题的?
=========================================
theMan有三个onEnterFrame??你可以写在一起的
theMan.onEnterFrame=function(){
if (this.hitTest(_root.douzi)) {
gotoAndStop(2);
}
if (this.hitTest(_root.bomb)) {
gotoAndStop(3);
}
if (Key.isDown(Key.LEFT)) {
this._x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
this._x += speed;
}
你放在帧上试试??
}