Does anyone here know why hitTest doesn’t work?
(Look at score)
I tried loooooooots of things, but none of them worked.
the hitTest works, it’s just that your coding is a bit screwed up
here’s what i think the problem is: you check the hitTest for the _root[“bom”+i] when you actually incremented the i variable for the next bomb…
which means that when the bomb drop on the house the hitTest won’t work because the house is waiting for the bomb that’s coming after, and so on
to be sure i changed the i to a certain value (because the first two bombs always dropped on their own, dunno why), bom3
and it worked
onClipEvent (enterFrame) {
if (_root["bom"+3].hitTest(_root.chalethuis)) {
trace("bomb works")
_root.score = _root.score +1 ;
}
}
what i would recommend is to actually create a function with the hitTest() and then apply that function to each bomb… (using coding of course)
of it helped =)
mlk
First, thanks for reply.
But it doesn’t work fully on my PC.
Can you post a .fla please?
PS What’s the “trace” for?
Here’s my second .fla. I made some minor changes to the “chalethuis” code and I limited bomb use.
Can anyone find the bug?
Anyone?
Originally posted by mlkdesign
and then apply that function to each bomb…
That’s the key, luster.
[AS]// bomb actions
onClipEvent (load) {
bomMoveSpeed = 20;
this._x = _root.vliegtuigje._x;
this._y = _root.vliegtuigje._y+10;
}
onClipEvent (enterFrame) {
this._y += bomMoveSpeed;
if (this.hitTest(_root.chalethuis)) {
_root.score++;
this.removeMovieClip();
}
if (this._y>400) {
this.removeMovieClip();
}
}[/AS]
Thanks for all the helpful replies. There’s only one little problem. If I copy “chalethuis” , it doesn’t hitTest with the copy. I solved this by giving it another instance name and adding some code, now it works fine, but is there an explanation for that? Just a question.
But, ALL THANKS FOR REPLYING!!!
Sorry! But why doesn’t it play “ontploffing”?
? Anyone?
[AS]_root.chalethuis.gotoAndPlay(“ontploffing”);[/AS]
:sigh: