I was looking at the tut on using score with buttons. I tried that and that works fine. But when I try it with hitTest it doesn’t work. Here’s the script I have.
My score box has the var total and my player has thr instance name guy…but it’s just not working. When the player hitTest’s the mc which has the above script score should increase by 1. I’ve attached my .fla…Thanks in advance :).
I tried that but it doesn’t remove the clip. Is there a better way to do this. Otherwise I end up with 30 after like 3 secs. Thanks a lot for your help so far!
[AS]
onClipEvent (enterFrame) {
if (_root.guy.hitTest(this)) {
if(!this.updated){
_root.total+=1;
this.updated = 1;
}
this.gotoAndStop(“empty”);
}
}
[/AS]
RemoveMovieClip will only work with duplicated or attached clips which doesn’t seem to be your case.
It looks to me that your clips physically exist in the timeline. If that’s the case I would use an empty keyFrame ‘inside’ them and send their timeline to that frame (in this example that frame’s been labeled “empty”).
If I were you I would rethink the approach to the project as doing it this way : do you have an enterFrame for every obstacle?
that enterFrame in this case never gets deleted. And all this will make the performance of your game very bad (slow).
Clip events were a Flash5- thing that are not needed anymore. and enterFrames can be declared in the main timeLine (in your case you could have just one enterFrame to make the whole game work so improving performance)