Forums

ForumsProgramming Forum

How to make a perfect hitTest in as2?

Posted Jun 2, '11 at 12:55pm

Oseb

Oseb

29 posts

Thanks!
You are pretty good in AS2. That technic is good for walls but nt good for moving objects what about them?
Thanks Again you really helped me a lot!

 

Posted Jun 14, '11 at 4:37pm

Oseb

Oseb

29 posts

I have two more questions.
1) how to make moving wall, i mean my main character hits the moving object. Here i think those coordinates dont work.

2) arobegamr you said this code.
if(this._y>200){
this._y=200
}
But this code makes that my charecter stops at y=200 but i want that my character stops when Y=200 X>100 X

 

Posted Jun 13, '13 at 8:41pm

ReillyGregorio

ReillyGregorio

1 post

is there anyway i can do this without on clip event i am using
function onEnterFrame(){

}
the hit test i use is this but it makes the player bounce and i just want him to stop and still be able to jump
     if (floor.hitTest(char._x, char._y, true )) {
         yspeed --;
     }

 

Posted Jul 1, '13 at 9:02pm

mightybob

mightybob

351 posts

Why not just

If(still_object.hitTest(moving_object2.x, moving_object2.y, true))
{
       //your code
}

Of course for this to work you need registration point where it's gonna hit.
Be sure to add in _root.'s or a movieClip var.

 
Reply to How to make a perfect hitTest in as2?

You must be logged in to post a reply!