1 Replies - 1396 Views - Last Post: 17 August 2010 - 01:56 PM

#1 copenhagen   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 90
  • Joined: 16-March 08

hitTest question as2

Posted 15 August 2010 - 08:09 AM

Hi there!

My problem is that I won`t allow a movieClip to cross another movieClip, so I used this code:
//playerens paddle hit the lines
		if (player.hitTest(sidex2)){
			player._x = 80;
			player._y = 40;
		}



The code above doesn`t work at all. However if I change the values like this:
//playerens paddle hit the lines
		if (player.hitTest(sidex2)){
			player._x = 0;
			player._y = 0;
		}



Then the player movieClip are moved to the x and y values on the screen??????? But again I don`t want the x value to be 0, I want it to be 80 and the y value to be 40 and not 0.

Any ideas of how I do this?
Thanks :helpsmilie:

Is This A Good Question/Topic? 0
  • +

Replies To: hitTest question as2

#2 Aurel300   User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 230
  • Joined: 10-November 07

Re: hitTest question as2

Posted 17 August 2010 - 01:56 PM

What do you mean by "doesn't work at all"?

Could you contribute on that? I mean - does it just ignore the hitTest, or it visually doesn't move?
Replace that code with this:
if (player.hitTest(sidex2)){
  trace("yes");
}



Then test the movie, do something that SHOULD make the hit test respond and look at the output - did it write yes?

This post has been edited by Aurel300: 17 August 2010 - 01:57 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1