Hi, I am working on a game, and i am using HitTest. BTW, I am using Flash 5. The code I am using lets me use the HitTest just fine, but on only one instance of the object.. Here is my code...
}
onClipEvent (enterFrame) {
if (_root.car.hitTest(_root.red)) {
_x = _x+10;
}
}
onClipEvent (enterFrame) {
if (_root.car.hitTest(_root.blue)) {
_y = _y+10;
}
}
onClipEvent (enterFrame) {
if (_root.car.hitTest(_root.yellow)) {
_x = _x-10;
}
}
onClipEvent (enterFrame) {
if (_root.car.hitTest(_root.green)) {
_y = _y-10;
}
}
The car is supposed to stop (or bounce) when it hits an instance of each color wall, and that works fine. But if I have 2 instances of red, it only works on the first one I made. Let me know if you need an example, but if I post one, it will be on my forum and I know advertising forums is not aloud.
Thank you in advance!
}
onClipEvent (enterFrame) {
if (_root.car.hitTest(_root.red)) {
_x = _x+10;
}
}
onClipEvent (enterFrame) {
if (_root.car.hitTest(_root.blue)) {
_y = _y+10;
}
}
onClipEvent (enterFrame) {
if (_root.car.hitTest(_root.yellow)) {
_x = _x-10;
}
}
onClipEvent (enterFrame) {
if (_root.car.hitTest(_root.green)) {
_y = _y-10;
}
}
The car is supposed to stop (or bounce) when it hits an instance of each color wall, and that works fine. But if I have 2 instances of red, it only works on the first one I made. Let me know if you need an example, but if I post one, it will be on my forum and I know advertising forums is not aloud.
Thank you in advance!