Hittests for mcs inside other mcs

Advertisement
I have a hittest code that's supposed to prevent an mc from moving into a space occupied by another mc. The thing is, the first mc is inside another mc and for some reason the hittest isn't registering. The code I'm using is below. Is it wrong somehow, or is there another code I should be using?
Key.addListener(keyListener);
this.onEnterFrame=loopF;
function loopF() {
     if (border.hitTest(player.playerHit._x+(player.playerHit._width/2), player.playerHit._y, true)) {
        player._x -= speed;
    if (border.hitTest(player.playerHit._x-(player.playerHit._width/2), player.playerHit._y, true)) {
        player._x += speed;
    if (border.hitTest(player.playerHit._x, player.playerHit._y+(player.playerHit._height/2), true)) {
        player._y -= speed;
    if (border.hitTest(player.playerHit._x, player.playerHit._y-(player.playerHit._height/2), true)) {
        player._y += speed;
Advertisement

Replay

it's not wrong but you probably want to use something like:
border.hitTest(player._x+player.playerHit._x+player.playerHit._width/2,player._y+player.pl ayerHit._y,true){
etc

How to wrap an existing javabean for using inside a form

I have an existing java bean(meterbar.jar) I would like to try and intergrate into a bean area of a form. I have looked at a bunch of documentation but am still lost. How can I use jdeveloper to "wrap" the bean for use inside a form. I am in tot

Extractor for Infotype 23 - other / previous employers

Dear coleagues, i would like to know if is there any extractor for Infotype 23 ( other / previous employers ) . Regards, Fabricio Vaz de SouzaDear coleagues, i would like to know if is there any extractor for Infotype 23 ( other / previous employers

How can i cancel an at&t contract on iphone 5 for use in other country

how can i cancel an at&t contract on iphone 5 for use in other countryContact AT&T and ask about paying the early termination fee.  You'll also need them to unlock it. In any case, you need to contact AT&T as they have the final say.Read other

I am trying to detect signal peaks (derivatives of the peaks both +ve and -ve peaks). simultaneously 2 peaks detectors are running, 1 for +ve and other for -ve peaks.

i am trying to detect signal peaks (derivatives of the peaks both +ve and -ve peaks). simultaneously 2 peaks detectors are running, 1 for +ve and other for -ve peaks. when a peaks get detected it would trigger a pulse of approx 1 sec duration and at

Documentation for wwv_flow_utilities and other wwv packages

Hi, Where can I find documentation for wwv_flow_utilities and other wwv packages? It seems we have to use many of the variables/procedures/functions provided in certain situations. Thanks, PareshHello Paresh, The documentation is here. Click on the '

Copa assessment value as base for allocation of other costs

Hello, We have a scenario wherein certain costs like travel, communication should get allocated in copa based on Employee Cost... This employee cost is getting transferred to copa through assessment in two stages  namely as Direct employee cost and I

Mail server automatically cc all email for user to other acct but group...

Back on April 2007, David_X answered this question: How to have the mail server automatically cc all e-mail for user to other accounts, (gmail, hotmail, etc). Here is the old post that explains that: http://discussions.apple.com/thread.jspa?messageID

Dv6-LT069av has a input connector for mic or other input devices, to connect a LP player

Pavillion dv6 has an input connector for mic or other input devices next to headphones connector on left side, to connect a LP player or other device thru the mic connector, what kind of cable is required? I used an RCA to male cord but no input on t

I am having problems with the month of October.  When I have the full month view, the synced items from google calendars won't show.  But they do for all the other months.

I am having problems with the month of October.  When I have the full month view, the synced items from google calendars won't show.  But they do for all the other months.  There is definitely a glitch somewhere because if I am on day view and try to

8.0.2 - problem 1 - unable to scroll screen when the keyboard is present. Huge problem for emails and other cloud based providers that allow for data entry. We need a fix ASAP!

8.0.2 - problem 1 - unable to scroll screen down or up when the keyboard is present. When typing text, I am unable to see the text I am writing due to this problem. Huge problem for emails and other cloud based providers that allow for data text entr

My webcam is not working for skype and other appli...

Hello, My webcam is not working for skype and other applications i have used tinychat and tango..i have updated all version of skype as you said in other topics but all of them is not working for me...my device name is vimicro usb 2.0 and i have acci

Is there acharge for connections to other tv's without a converter box?

is there acharge for connections to other tv's without a converter box? Solved! Go to Solution.I assume you mean hooking a TV directly to the coax and use the TVs QAM tuner. If that is what you mean, then there is no extra charge for that. If a forum

Attaching movieclips inside other framed mcs?

This is a program I wrote to attach a movie clip to a target: function avi(target, clip, hval, num, coordinatex, coordinatey){     var hval:MovieClip = target.attachMovie(clip,clip+num , num+5); hval._x = coordinatex; hval._y = coordinatey;} example:

Can we put margin for text inside available Tile Templates ?

Hi all ,         We are developing a windows phone silverlight 8.1 application. Using WNS as push notification service. For tile notification using the template "TileWide310x150PeekImage02" for wide tile . Text attribute with id 2 is appearing a

Blue Smart Cover - Some grey on the inside, others are blue??

Hi, A friend of mine bought a new Smart Cover for her iPad. She got the BLUE polyurethane version. On the inside, her's is blue also. But i've noticed other people's (esp' on YouTube) are grey on the inside. It's not a fake because it was bought from

How can I deal with case-sensitive filenames referred to inconsistently inside other files?

I have downloaded into Dreamweaver an existing web site that I'll be taking over from someone else.  The site was built with Microsoft Front Page and apparently now runs on a Windows web server.  While redesigning the site, I'd like to upload it to a

For Loop Inside A For Loop

Is it possible to execute all the iterations of the inside for loop for each iteration of the outside for loop? I have attached a screenshot of my program if it helps. If it is possible could you tell me how to do it plz? Solved! Go to Solution. Atta

Should I use Standard C++ Containers and Stuff for games and other real time activities?

Hello, I'm a C++ developer using VS 2012 and VS 2010 for developing AAA titles. I have read about not using STL and other stuff provided in the standard headers that come with VS. I read most of the stuff on the websites based on game programming and

Search for strings inside html tags ?

Is there any way to get Spotlight to find search strings inside html documents? One example is I want to find any file that includes a certain alt=" " string inside an img src tag. Spotlight does not seem to include anything inside html tags in