-
Jack Foster
help with hitTest.
hi,
I'm doing a pacman style type of simple game ,
I have the circle_mc and the wall_mc,
I can move the circle to left and right with the arrow keys no probs,
but when the circle hits the wall , it stops, But;
almost half of the circle is Over the Wall_mc,
how can I correct this ?
here is the code on circle;
onClipEvent (load) {
speed = 15;
stop();
}
onClipEvent (enterFrame) {
if (Key.isDown(key.LEFT)) {
this.onEnterFrame = function() {
if (this._x>=0) {
this._x = this._x-speed;
this._xscale = -100;
} else {
this._x = 800;
}
};
}
}
and here is the code on the wall_mc
onClipEvent (enterFrame) {
if (this.hitTest(_root.circle)) {
_root.circle._x += 15;
}
}
thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|