Skip to main content
August 19, 2010
Question

hitTest Help AS2.0

  • August 19, 2010
  • 3 replies
  • 2736 views

I am fairly new to this "Actionscript" thing and don't  know how to code something. I am making a maze type game and made it so that when your character hits a wall it stops. But now I want to make it so that when your character touches an end level icon the screen resets to a new frame with the next level on it. I spent some time looking up code for hitTest and can't seem to find a way that works. If someone else knows an answer to this it would be sincerely appreciated. And if this isn't something that can be done with hitTest it would be useful to know a way to do this with other codes or something.

Thanks again!

This topic has been closed for replies.

3 replies

August 19, 2010

Now becomes visible until clicked when intersects object

onClipEvent (load) {

root.nextlevel.visible = false;

}

onClipEvent (enterFrame) {

if (_root.circle, hitTest(_root.star))

{

root.nextlevel.visible = true;

}

}

Known Participant
August 19, 2010
August 19, 2010

Thanks!

Ned Murphy
Legend
August 19, 2010

There are a couple of other postings regarding using hitTest not too far from yours in the forums.  You should see if they can help give you a kick start with what you are trying to do.

August 19, 2010

i looked thre and the codes don't seem to work. I dont know what im doing wrong

Ned Murphy
Legend
August 19, 2010

I think the code being used in those is AS1, though I can't be sure.  I couldn't get it working either, but had to believe it would based on the tutorial mentioned.

Try searching Google using "AS2 hitTest tutorial" as the search terms and you should find some step by step help to get you started.  If you get something going but not to your intended end, post again showing the code you have.