Be a Supporter!

Having problems with Hit tests...

  • 130 Views
  • 6 Replies
New Topic Respond to this Topic
Davidrfc
Davidrfc
  • Member since: May. 27, 2009
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Having problems with Hit tests... 2009-10-05 17:43:07 Reply

I'm making a gun game and i have the gun shooting the bullet prefectly, but i want it when the bullet collides with a box or whatever the box will go to its next frame... but i also have to have the

if(this.hitTest(_root.box))
	{
		_root.nextFrame();
	}

Oh yeah, this is for AS2 and the bullet's instance is shot


If you are angry... Don't talk to me! :D

BBS Signature
Davidrfc
Davidrfc
  • Member since: May. 27, 2009
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Having problems with Hit tests... 2009-10-05 17:45:30 Reply

Shit sorry the code i need is

if(this.hitTest(_root.box))
	{
		this.removeMovieClip();
	}

The first code i gave sadly wont work and is the problem.


If you are angry... Don't talk to me! :D

BBS Signature
Davidrfc
Davidrfc
  • Member since: May. 27, 2009
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Having problems with Hit tests... 2009-10-05 17:47:17 Reply

Actually the first code isn't even what i have as a problem LOL


If you are angry... Don't talk to me! :D

BBS Signature
Grind29
Grind29
  • Member since: May. 6, 2007
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to Having problems with Hit tests... 2009-10-05 17:47:26 Reply

i too am having this problem

your best try SO FAR

is:

onClipEvent(enterframe){
if(my_mc.hitTest(_root._xmouse, _root._ymouse))
{
_root.gotoAndStop(your frame)
}
}

Grind29
Grind29
  • Member since: May. 6, 2007
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to Having problems with Hit tests... 2009-10-05 17:49:01 Reply

forget the mouse assignment lol.

Davidrfc
Davidrfc
  • Member since: May. 27, 2009
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Having problems with Hit tests... 2009-10-05 17:50:16 Reply

The thing is i wanted the collision to make a movie clip go to it's next frame, but whenever i set up the code

if(this.hitTest(_root.mymovieclip))
	{
		_root.mymovieclip.nextFrame();
	}

It doesn't do as i wish


If you are angry... Don't talk to me! :D

BBS Signature
mkmetalhead
mkmetalhead
  • Member since: Aug. 9, 2008
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to Having problems with Hit tests... 2009-10-05 19:32:10 Reply

At 10/5/09 05:50 PM, Davidrfc wrote:
if(this.hitTest(_root.mymovieclip))
{
_root.mymovieclip.nextFrame();
}

Try:

if(_root.mymovieclip.hitTest(_x,_y,true)
{
_root.mymovieclip.nextFrame();
}